|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Hello, I am looking for help on how to program in LabView how to move the servo with 2 joystick buttons. What I want it to do is move the camera servo 1 degree/increment everytime a press a joystick button. I could not figure this out on my own and any help or ideas would be greatly appreciated.
|
|
#2
|
|||
|
|||
|
Re: Moving Camera Servos With Joystick Button
Create a setpoint for the servos using either a control, a shift register, or a feedback variable. Depending on the buttons, either increment or decrement the value of the setpoint. Then add the function to update the servo to the setpoint.
Greg McKaskle |
|
#3
|
|||
|
|||
|
Re: Moving Camera Servos With Joystick Button
Thanks for the speedy reply. That is what I thought needed to happen. Im still a little confused by what you said, could you show me a screenshot of that code please?
|
|
#4
|
|||
|
|||
|
Re: Moving Camera Servos With Joystick Button
Sorry, I'm not at a PC right now. The code I'd write first is the joystick stuff. Inside the teleop you are either unbundling buttons already, or you are about to. Use the buttons to affect the servo setpoint with + or -. Then add a shift register to the loop initialized to centered I guess. Run the shift register wire to the cases doing the + and -. Prove the wire and test it out. Once you are happy with it, connect up the servo open, close, and the write angle.
Greg McKaskle |
|
#5
|
||||
|
||||
|
Re: Moving Camera Servos With Joystick Button
What Greg suggests will work great, just be careful about how often you change the angle. If you change the servo setpoint whenever the button is held down, then the servo will almost instantly go to it's extreme angle. The reason being that the loop runs really fast, so you increment the setpoint very fast and it builds up to the max quickly.
I would check the time and only do the servo code when a certain amount of time has passed. |
|
#6
|
|||||
|
|||||
|
Re: Moving Camera Servos With Joystick Button
Quote:
Wire the Joystick Get "Buttons" output to an "Unbundle by name" and select the desired button from the unbundle's popup menu. Wire the unbundle's boolean output to one input of a boolean And gate, and also to the input to a feedback node. Wire the output of the feedback node to a boolean Not. Wire the output of the boolean Not to the other input of the boolean And. The output of the boolan And will be true only during the single loop when the joystick button has changed from false to true. You can use that single-time signal as the select input to a Case structure which passes a numeric input straight through to its output when false, and increments it by one when true. Duplicate this entire process for another joystick input and another Case that decrements the numeric value. Wire a numeric value through both Case structures and a shift register on the surrounding While loop. That way the joystick buttons will bump the value up or down by one each time one gets pressed. Use that value as the input to the Servo Set Angle. If you feel like it, run the value through a range check and coerce on its way through the process so that it never exceeds the proper range for a servo angle. |
|
#7
|
|||
|
|||
|
Re: Moving Camera Servos With Joystick Button
Thanks for all the help, still a bit confused, but having LabView in front of me will help. Alan, where exactly do I set a constant of the angle I want the servo to be at? It sounds like I create a constant then run a wire to the border of a case structure. I am also confused on what a feedback node is. Is it in the same menu as Not, And, Or functions?
|
|
#8
|
|||||
|
|||||
|
Re: Moving Camera Servos With Joystick Button
Quote:
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Servos not moving | Marlfox | Electrical | 2 | 09-02-2009 18:24 |
| joystick button | furiousgeorge | Programming | 5 | 07-02-2009 15:57 |
| Programming a joystick button... | programmr | Programming | 2 | 05-01-2009 16:13 |
| using servos with camera | team877 | Programming | 2 | 01-02-2007 21:26 |
| Moving robot while tracking with camera questions... | Steve Orr | Programming | 6 | 02-02-2006 22:24 |