Objective
To move the Tribot forward, backward, left and right.
Final Program
As in the first program launch Labview and open a Blank VI and switch to the Block Diagram window. Set up the Function palette and have the NXT Toolkit pinned on. Make sure your window looks as follows :
Figure : Getting Started
Forward
Go to Addons -> NXT Toolkit -> NXT Library -> Output.
Figure : Choosing Output from NXT Library
Now, place a Sync Time on the Block Diagram to command the Tribot to move forward.
For this, do the following on the Sync Time block :
This would make the Tribot move forward for three secondes with a a power of 50% and stop. The final block should look like this :
Figure : Block for moving the Tribot forward for 3 seconds at 50% power
Note : The panes that you see on the top, left and bottom of the block with the words Duration, Power and Travel Forwards 3 s are the comment panes. To insert a comment pane, just double click anywhere inside the Block Diagram window, and you will get a field into which you can type the comments.
Backward
The next block is to command the Tribot to move backwards. To do this, we do not have to do the whole process again. All we need to do is :
This done, the Tribot will get back to its starting position.
Figure : Copying a block (Method 1)
Figure : Copying a block (Method 2)
Remember : In case you are not able to find the terminals properly, make sure you use Context Help to figure out what the terminals are and where they are on the block.
Left Turn and Reverse Left Turn
In this section, you will add the blocks to make the robot turn left and then do a "reverse" left turn.
This is very similar to the earlier blocks, except that, here you let the motors run for a specific distance, rather than a duration. For this, choose the Sync Distance block from the Output sub menu in the NXT Toolkit on the Functions Palette.
For the left turn
For the reverse left turn
Once this is done, you should see these two blocks to look like this
Turning while moving
While the last two blocks make the Tribot turn abruptly, the following blocks will make the Tribot make a smoother turn, along an arc of a circle, much like a real vehicle.
The blocks for this task are the same as the ones used in the last section, except, make the following changes after making copies of the previous blocks to the right of the existing blocks.
Make sure the second block of these two has the Direction (T:Fwd) terminal set to F.
Once done, it should look like this
So the program, at this stage should look like this
Now that all the blocks are ready for our program, the next task is to let the program know the sequence in which the tasks are to be executed. For this, each block has two special terminals called the Sequence Flow In terminal and the Sequence Flow Out terminal. These two terminals provide the "direction" of the program. Use the Context Help to find out where the Sequence Flow In and Sequence Flow Out terminals are on the Sync Time and Sync Distance blocks.
To do this, click on the Sequence Flow Out terminal of the first block (note that once you take the cursor near this terminal, the cursor changes to a wire spool) and drag a wire and when you reach the Sequence Flow In terminal of the second block , click again to make the connection.
Repeat this for all the blocks until you see this :
Now, the program is complete!
Follow these instructions from the previous program to save the program with an appropriate name.
Download the program on to the brick in the following way.
The Sync Distance and Sync Time blocks are made in such a way that they control the Right Motor through Port B and Left Motor through Port C. Make sure the Tribot has motors connected in this fashion.
Challenge
The challenge is to create a program that would take a path as shown in Pg 13 of the attached file on this page below.