Hello I was wondering how (if possible) I would be able to allow a joystick to be used to control the camera on the robot.
Assuming you mean that you want to move the servos on the camera mount using a joystick, yes it is indeed possible.
We’ve been playing around with such control for about a week. Here is a one method in LabVIEW. Essentially you can tell the servo “goal” position to increment by 1 (or another value) every time the main loop loops if a certain condition is met (i.e. a joystick in a particular position). The servos will constantly goal seek on this new position. We accomplished this by storing the “goal” position in a shift register and incrementing/decrementing/not changing this value depending on a case statement triggered by a joystick.
Again this in LabVIEW but the same principle should apply in Java and C.
Hope this helps,
Student Programmer, Team #2614.
how about setting the angle of the servos proportionate to the axes of the joystick? works great!
This requires you to hold the joystick in a non-centered position if you want the camera to be anywhere but centered.
So, if I understand correctly, In order to run this code, it must be in a while loop INSIDE the initial teleop case structure? I tried doing this and every time, I would get a watchdog error. I know that I didn’t have a shift register. Do I need one on each side of the loop?
No while loops inside while loops.
Use a shift register and put the code in the main loop.
You can also do without the shift register. Since the FPGA knows what value you’ve set the servo to, you can use a Get Angle or Get Position vi to retrieve it, apply whatever modifications you wish to the value, and give it to a Set Angle or Set Position vi.
(If you’re changing the value by extremely small amounts, you might need to watch out for rounding errors in the conversion between servo position and PWM value.)
I’m not doing that. In the code this year, the teleop is all inside a case structure. Can I place a while loop inside a case structure?
You know what, I just realized that you were referring to the robot main.vi, not the teleop.vi. My apologies. So instead of using the while loop, I should just use comparison vi’s on the joysticks to lead to increment vi’s inside case structures?
Got it, thanks.