So, I went and downloaded Kevin Watson’s “bells and whistles” version of the camera code. I made sure I got the most updated version.
I have not changed anything within the code besides changing the pwm’s for the drive motors to 08 and 09 (because the camera utilizes 01 and 02 I believe).
However, once uploading the code, absolutely none of our PWM’s are receiving any output or input. The PWM lights are not showing on the operator controller and the terminal window says “searching…”, but the pan/tilt servo motors will not move.
I tried making revisions by adding pwm.h, but I realized that library should only affect PWM’s 13-16. Any ideas?
I’ve scanned through the code, it’s the most recent on Kevin’s website, and I haven’t found any large sections of code commented out. Is anyone else experiencing this? I’m pretty sure that I haven’t augmented anything that would completely disable the PWM outputs.
Also, I did add in one line of code to power the camera. I’m pretty sure that this should be no problem. It’s in the User_Initialization() under User_Routines.c, right after all of the pwm’s and digital i/o’s are set:
digital_io_17 = 1;
The camera is getting the green light and receiving data, but the servo’s are not. Is it ok to set this variable to power the camera?
Ok, my apologies for the series of stupid questions, but I think I’m making progress.
After tracking down a commented out Default_Routines(); and uncommenting it, I made a step forward. Now, when running, the Operator Interface LED’s will light up when I move the joysticks accordingly. However, the camera servo motors (in addition to the drive motors) are still not responding at all.
I don’t understand what you are trying to do here. The camera is supposed to get its power from the backup battery through a pwm connection. Digital I/O pin 1 is already set to be an input by the initialization code, so setting its direction control to 1 a second time will have no effect. Even if it did have an effect, it wouldn’t change anything having to do with powering the camera.
If your servos and motor speed controllers are not responding, that sounds like the pwm outputs are disabled. What are the lights on the Victors doing? A steady yellow means the code is setting the outputs to neutral. A blinking yellow means the robot has been disabled and there is no pwm signal at all.
I am changing the value of digital i/o pin 17, which is the only one designated as an output. I wasn’t getting any power at all when I plugged the camera power into a PWM slot.
Also, when I move the joystick, the victors are still blinking and not receiving any setting at all. I’m trying to scan for anywhere where the PWM’s might be disabled, but so far I haven’t had any luck.
No, you’re not. You’re setting Digital I/O pin 17 to be an input. But let’s ignore that for now, as it still has absolutely nothing to do with powering the camera.
Also, when I move the joystick, the victors are still blinking and not receiving any setting at all.
That means the robot is disabled. Are you using the tether or the radio link? Do you have anything connected to the OI’s competition port?
Yes, we initially took the default IRC code and uploaded it to the robot with no problem at all. The PWM’s worked perfectly, but after uploading Kevin Watson’s code we ran into a problem.
The first problem you ran into is probably the fact that Kevin’s code does not control motors. He commented out the call to Default_Routine() so it would not interfere with the control of the pan and tilt servos. You’re going to have to replace the mapping of joystick to pwm output with something that matches how you have your Victors connected.
And you didn’t respond to Mike’s important comment about having a backup battery connected. That’s what supplies the 7.2 volt output which powers the servos.
Thanks for the post, We are a rookie team from the UK and the “c” code has been driving me and my students mad. If we got the motors running on the default code then when we loaded the camera code with the same mods, it was dead. Then your post made me look at the default routine being remarked out. Ok so that got the pwm back on line, but now the camera was dead, remarked out the two lines calling pwm1 and pwm2 and hey presto the whole thing works.
It seems so simple now but having spent all my life programming Basic - including my robonova1, “c” still kills my confidence. But less and less each day.
This is the only site that has had any help whatsoever including first themselves.