FIRST Tech Challenge Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the correct way to pivot (spin wheels in opposite directions )using Textix motors and encoders?

Solved!
Go to solution

I have been trying to using LabVIEW to write code that will move forward, pivot left, and then move forward again.   I cannot seem to get it to work reliably or properly.  This should be something that is simple but I am not getting very far.  Sometimes it will work and sometimes it skips steps and only executes half of the program (and not the same part each time!).  I have replaced all the hardware (encoders, motors, NXT brick, too).  I am running 4 motors on my robot.  Each side is connected in parallel and I have encoders on each front motor.  Is this not a valid way to connect the motors?  I read that it was okay to parallel the motors on each side, but I don't know if this will cause issues when using encoders.  Secondly, when I pivot is there a special way I need to write the code to run both motors at the same time?  I tried splitting the pink NXT bundle into two separate wires and running them into two Move Distance functions.  I then recombined the pink NXT wires and continued my program.  That didn't work as the functions were executed sequentially with the left motor spinning first and then the right motor.  Is there a good way to do this that works reliably?  I have attached a VI (Method 1) for the method I just described that does not work.  I have also attached a second VI for a method that works, but is not reliable and fails (skips parts of the program) about 25% of the time.  Help!

Thanks!

Download All
0 Kudos
Message 1 of 2
(6,074 Views)
Solution
Accepted by topic author lyoncf

lyoncf,

I would recommend instead of using 2 VIs that opporate in parallel to use one Move Fixed Distance VI and select Moved Fixed Distance (multi) from the drop down selector from the VI. 

2009-12-28_130933.png

I modified your code to use Moved Motors Fixed distance with this method.  As you can see the DC Motors inputs use the same control as is used for the other Move Motors Fixed Distance VIs in your program.  The inputs for Encoder counts and power are now also array inputs.  Each element in the array corresponds to the Motor name at the same index in your motor control array.  I've attached my VI (method 3) for your reference.  Please feel free to ask any more questions.

Cheers,

Mark

Mark
NI App Software R&D
0 Kudos
Message 2 of 2
(3,134 Views)