|
Re: How do you get Tank Drive working?
I'll assume you know the basics of LabVIEW programming - how to wire, how to get around the palettes.
You need to do two things: - Add another joystick for tank drive
- Switch Arcade Drive to Tank Drive
First open/close the joystick: - In Begin.vi copy the creation of Joystick 1 and paste it.
- Change the new joystick open to another USB port
- Give the new joystick a descriptive new name. e.g., "joystick 2"
- Wire the error output to the little Build Array box. It can be expanded to expose a new node for wiring.
- In Finish.vi copy the code for joystick 1 and paste it.
- Change the name to "joystick 2"
Next switch to Tank Drive: - In Teleop.vi, in the inner case statement box select the False case.
- Remove the axis 1 (x) wire leading to the Arcade Drive
- Right-click on Arcade Drive, select Replace -> RobotDrive Palette -> Tank Drive
- Copy the Joystick Get and the unbundled axis box and paste it.
- Wire the new axis 2 (y) to the Left Axis Value node on Tank Drive
- Now the new joystick should be added to the Joystick Read vi if you wanted to maintain the style used here, but I'm going to fall back to a simple approach and just have you add it to the left side of the block diagram.
- Add a Joystick RefNum Registry Get.vi (the one that looks like the # Drive icon) on the far left.
- Add a constant to the "refnum name" input node and give it the name of your second joystick
- Wire the output JoystickDevRef through the two case statements to the Joystick Get you added.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Last edited by Mark McLeod : 30-01-2010 at 20:43.
|