We (the programmers) are rookies and are having trouble figuring out LabVIEW. We have our drive system working and are moving on to programming functions. The next step is to program two servos mounted on the front of the robot. They are meant to spin opposite of each other to pull the ball up between two rods. We were looking for a example program in LabVIEW to add servos and attach them to buttons on a Attack 3 Logitech Joystick and were not able to find any such example. Does anyone here know of a simple way to add 2 servos to the VI, regulate their speed and rotation direction, and attach their use to a button (the trigger)? Any help would be greatly appreciated.
I am a bit confused on how you are using servos. Are they actually servos or are they just motors? is it a mechanism like Ri3D team boom done?
A good resource for some examples is http://team358.org/files/programming/ControlSystem2009-/LabVIEW/.
If you are using motors then I made something that I think should work for you.
You can change the value from one to something else if you don’t want it to spin at full speed. You may also have to change which motor it is that gets multiplied by -1 if it goes backwards. You should also add the motors to the finish.vi but I didn’t show that.
I have no idea what button is the trigger on an attack 3. You can either look that up or just do trial and error. It may even be that the trigger isn’t a button and is an analog signal which would probably make it one of the axis values.
If you want it to make it so that every time you hit the button it changes between on and off instead of having to hold it you can use a toggle.vi which I have attached. To use this you just put it in between the button and the select.
I hope this works I am new to this stuff too but I think that this should do what you want it to.
Toggle.vi (9.65 KB)
Toggle.vi (9.65 KB)
Thanks for the help. That website was really helpful! Yes they are motors not servos, sorry. How does one set the speed of a motor controlled by a button? Is there a rpm number somewhere that we can change?
The way you change the speed is by changing the true value of the triangular Select function. I have it set at 1. You can change the number from anything from 1 to -1. 1 is full forward, 0 is stop, and -1 is full backwards.
I’m not sure I understand the question. A button has only two states. If you want to set the motor’s speed beyond simply “running” and “not running”, you’ll need some other kind of control. Usually one uses a joystick for that.
Perhaps you’re asking how to change what value is sent to the motor controller when the button tells it to be “running”? That’s controlled by the orange constant 1 wired into the True input of the triangular Select function in the posted code. You can make it anything from -1 to +1. If you want to be able to modify the value under driver control, the throttle input of an Attack 3 joystick is Axis 3. Wire it to the Select instead of the constant, and you can set the run speed using the throttle.
Is there a rpm number somewhere that we can change?
To control RPM, you’ll need a way to measure the RPM and some programming to change the motor output value to increase it when it’s too low and decrease it when it’s too high. For your application, do you really need a specific RPM, or are you just asking about being able to make it run relatively faster or slower?
If you want to be able to modify the value under driver control, the throttle input of an Attack 3 joystick is Axis 3. Wire it to the Select instead of the constant, and you can set the run speed using the throttle.
Kinda off topic question but do you know if there is a list of what each button/axis of the attack 3 is in labview?
Here is the Attack 3 mapping
http://team358.org/files/programming/ControlSystem2009-/sm_Attack3Joystick.png](http://team358.org/files/programming/ControlSystem2009-/Attack3Joystick.png)