Driver station control

We want to do one final thing before we wrap up. It would be really cool if we could control the robot by clicking on the field map on the driver station.  As it turns out, the Robot Mapper program is capable of sending two different commands to the robot:

The first command consists of the letter ‘p’ followed by and X and Y position (in inches). This command will be sent to the robot whenever you click on the map.  We will use this position and the RotateToPosition and DriveToPosition commands to make the robot move to that location.

The second command consists of only the letter ‘g’ which will be sent when the Reset button on the mapper program is pressed.  We will use this command to reset the gyro.  The gyro we are using is fairly stable, but it does have some drift which causes it to become increasingly off over time. We can re-register the gyro position by aligning the robot so that it is exactly facing the tower, and pressing the Reset button.

Now in our Navigation class we already have a function ProcessData that will be called when the class receives data from the driver station.  All we need to do is add a couple of cases to handle the data:

The Drive function will handle the position command. It will need to parse the X and Y positions and then create and call the proper RotateToPointCommand and DriveToPointCommand commands.

Note that we are again creating a CommandGroup and adding the two needed commands to rotate and then drive.  We then can start this command immediately by calling the start() function of the CommandGroup.

Also, because the X and Y values of this command are floating point numbers, we cannot use the ParseIntegers function we used before, so we must create a new ParseDoubles function along the same line:

Finally, for the reset gyro command we create:

Your Navigator.java file should now look like:

Now deploy and run your program and verify that you can click on the map to make your robot move to that point.  Also, line the robot up with the tower and press the Reset button on the mapper program and see that the gyro value is reset.

This concludes our tutorial.

Pierre Pierre, who replica handbag 185cm tall, gucci replica handbags the "Diamond King" in his hermes replica handbags . He has been selected as one of the handbag replica most beautiful 50 people in the "People" magazine. It is also known as replica handbags most elegant and quiet in the world. Unforgettable prince.