View Full Version : Need some Labview help!
Bill Taylor
07-02-2010, 19:36
I am the primary programmer for our team this year and as far as programming goes I have about a 3rd grader level of expertise. I take that back...my 3 yr old son could probably do better than i am doing. My question is... I am using the out-of-box labview FRC project wizard and switched drive to arcade using 4 motors. This is working fine with no hangups. i want to be able to turn one of those 4 motors (ex.motor #1) on using a joystick button (ex.button#8) independently. essentially, when the robot's arcade drive is parked and the operator is off the stick, push a button to run a single drive motor by itself. if someone could tell me how i might do this it would be appreciated. please be specific or show me a wired diagram as i am apt to miss a step. thanks.
Interresting. I can only wonder what you would need this for.
There are two ways to do this.
The first way would be to open all of the motors individually, then write the arcade code and send it to each of the four motors (you could open the arcade drive VI if you wanted to copy the algorithm) and then have a case structure when setting the first motor. That would probably be the best way to go if you have little experience with LabVIEW and the WPI library. I would recommend putting your arcade drive code in a subVI.
You could alternatively open Motors.vi (the VI that takes two motors from the Tank Drive and Arcade Drive VI's and sets it to two or four motors; it's in RobotDrive=>Advanced) and find a VI that says "Get PWM Ref". This is used inside the WPIlib to get the PWM ref from an array. Copy it to where you are using it. Feed it the RobotDrive ref, and it will feed you a Motor ref you can use with Set Motor. You could probably put the Arcade Drive in a case and the Get Ref/Set Motor in the other case. This will allow you to keep your Open 4 Motor and keep all of your wiring neat, as well as keeping the existing code as it is.
If you have any other questions, ask.
Darn, apalrd you beat me to answering his question!
I have included the extracted vi, which has to be added to your robot project, as the original version is out of scope -- the library doesn't share it. Also an example and a picture of it.
Good luck
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.