These examples (ZIP) demonstrate motor control in LabVIEW.
Front Panel Steering Control
- This example shows how to control the steering icon using the front panel.
- This example shows how to keep an object a set distance away from the robot.
Rotation Position Control
- This example demonstrates how to control the rotation of a motor very accurately. On the front panel, the user inputs the desired position (in degrees) of the motor. The user can also adjust the control gains, Kp and Ki which affects the input power of the motor. Kp is a proportional gain, it scales the difference between the motor’s current position and the desired position–this difference is known as the error. Ki is an integral gain, it scales the total accumulated error during the program. Play around with the gains to see what works the best.
Run for Distance
- This program allows the user to input a desired distance for an NXT vehicle to move forward.
Run for Time
- This example demonstrates controlling how long a motor will run.
- This example demonstrates some simple movements and motor functions. The program goes forward until the touch sensor is pressed, brakes, then waits again for the touch sensor in order to go backwards.
- This example shows one way of compensating for differences in steering for a robot moving in a straight line. By taking the difference in rotation between the two motors and multiplying by a gain, the program accounts for variations in motor distance.
- This “Table Car” will drive forward until its light sensor senses it is at the edge of the table. Then, it will back up and turn randomly. This process is repeated until the user aborts the program.
Straight Line Steering Alternative
- This example shows another way of keeping the wheels at the same speed, even with differences in motors and environment. By keeping track of the differences between rotation of each motor, and using that difference to adjust the motor power, this program ensures that the wheels rotate the same amount.
While Loop Motor Control
- This program runs a motor using a “while loop” until a touch sensor is pressed.