Team, We are using Kevin’s ‘bells and whistles’ code. It works great in RC mode, we are able to acquire and track the target at a distance using the default settings. We have defined the pan and tilt servos to be pwm08 and pwm09 respectively. When tracking in RC mode we display the pan servo value and it shows expected readings, changing as the camera pan angle changes.
When we try to use the camera in autonomous mode the pan servo seems to be getting conflicting commands. It shudders and does not move normally. When we display the pwm08 value it shows as zero. We are only using the following 3 functions within the autonomous mode loop, at the position indicated by the “add your autonomous code here” comment.
When we display the pwm08 value via printf it shows as zero.
The pwm outputs for pan and tilt are commanded from the Servo_Track function, called from Camera_Handler and should remain set while in autonomous mode, correct? Am I missing something obvious? Naturally, we were able to command pwm outputs in autonomous mode in the past.
Thanks in advance for your help.
Thank you for posting that message it will help our team out a great deal. We have been pondering over this subject for a long time.
Thank you again
I’m going to assume that you are using a dongle to attach to the competition port on the OI and that everything’s connected right. The only other problem I can think of is that you might be sending too many requests to the RC’s serial port and that’s causing some issues for you. Other than that, I can’t see any reason why your code wouldn’t work. I haven’t tried to get the camera to function in Autonomous Mode myself yet, so I’m not sure if that’s the only possible problem.
Thanks for the replies -
Yes, we are using a dongle and momentary switch to activate autonomous mode. It has worked in other cases.
In essence all that we are trying to do is to capture the commanded PWM output of the pan servo to make some decisions on the relative position of the target - nothing fancy - but when we attempt to inquire the value of the pan PWM the value shows zero. Also when in auto mode the pan servo seems to be getting conflicting commands, the pan attempts to track but is rapidly reset. Based on my understanding of auto mode we are simply in the “while autonomous mode” loop with little outside interaction… will be at it again this evening - will post findings.
It sounds very much like something else is setting that pwm output. I’d look closely at the code to make sure that’s not happening. And if you’re trying to print the pwm value on the terminal, remember to cast it as an (int) when you pass it to printf().