|
Using xbox thumbstick to control servos on pan/tilt
Here's a good one.
I am using the right thumbstick (let's say axis 1 and 2) of an xbox controller to control the two servos for the pan and tilt for our axis camera. The servos are plugged right into the PWM8 and PWM9 spots on the roboRIO. Now, the thumbstick is already running these servos, but the problem is once you let the thumbstick go back to center, the servos also return to there zero position (far left and straight down). This is an issue when you have to constantly compensate to keep the camera in the right position at all times. What I need is the servos to start at the centered position (camera looking straight ahead) so that when you move the thumbstick around to view, the camera follows the joystick commands and stays there without returning to the far left and straight down position. Can anyone provide some sample coding for this?
Thank you ahead of time for any effort to help!
|