Running the program

The first thing you need to do is to connect your computer to the your robot (be sure that you have actually connected the battery). Each robot is configured as a WiFi hotspot with a specific name. Find the name of your robot, and connect your WiFi to that hotspot.

Next, let’s take a look at the run configurations. Select the Run / Open Configurations menu option:

OpenConfig

Which should display the following in the right pane:

RunConfig

This shows the available run configurations. The one we are interested in is the last one. This one is not configured to run your program, but, rather, to run a program which will copy your program to the robot, and then execute your program on the robot. The important thing to note here is the last line of the configuration:

            "args": "172.24.1.1:8999 robot.Main --"

This line tells the program the IP address of your Raspberry Pi, as well as what port to use to transfer the program. It also tells the program what main class to execute once the program has been download. By default the IP address is 172.24.1.1 with port 8999. If  you have configured your Raspberry Pi at a different address, you will need to change this.

In order for any of this to work, we must have a program running on the Raspberry Pi which listens on port 8999. Your PC will then connect to this port and transfer your program to the Pi for execution. We will use a utility called PuTTY to start this program on the Pi.

To configure the PuTTY program, double click on the putty.exe program that is in the PiUtils folder. The PuTTY configuration window should look like:

Putty1

Let’s test to see if we can connect to the robot. Enter the IP address 172.24.1.1 into the Host Name (or IP address) field and enter the name Robot in the Saved Sessions field and click Save. Then click Open and the following window should appear:

Putty2

Log in using the user name pi and password raspberry. Note that when you type in the password, the keys you type will not be echoed so you have to type in the password blind.  Once you get this working, close the PuTTY window.  If this window does not appear, check to make sure that your WiFi is connected to your robot.

We now want to configure the session so that it automatically logs in and starts the remote launcher program on the pi. Once again, double click on the putty.exe program. Then click on the Robot session and click Load.  Now click on the Connection/Data option on the left and enter pi in the Auto-login username field like this:

Putty3

Now click on the Connection/SSH option on the left and enter ./run in the Remote command field, as follows:

Putty4

Finally, click on the Session option on the left and change the Saved Sessions name to Robot.Run, then click Save to save this session.

Putty5

Now test this out by clicking the Open button.  If everything is set up correctly, the terminal window should open and ask for your password. Enter raspberry as the password, and you should then see the following:

moreputtyrunning

When you have this working, close the PuTTY window.

Now we want to create a second PuTTY session which we can use to shutdown the Pi gracefully. Launch PuTTY again, click on the Robot.Run entry and click Load. Then change the Saved Sessions name to Robot.Shutdown as shown and click Save.

Putty6

Then click on the SSH Category on the left and change the Remote command field as follows:

Putty7

Finally, click back on the Session Category and click the Save button and close the PuTTY window.

Next, start the Driver Station by double clicking PiDriverStation in the PiUtils folder. Note that there will be two PiDriverStation files in the folder, one named PiDriverStation.cmd and one named PiDriverStation.jar and you need to double click on the cmd version.

PiDriverStation

Now we must configure the driver station by clicking the Settings button and set the fields as follows:

DriverStationSettings

Now with your computer connected to the robot, click on the Launch Putty button on the Driver Station. If everything is working the following console window should open:

Putty8

If you don’t see this window, or the two lines you see aren’t being displayed, then something is wrong.

With this PuTTY window open, we are finally ready to run our program. One last thing we must do is configure VSCode to launch the correct configuration. In VSCode click on the RunButton button on the left. Then open the Debug dropdown and choose the last Launch option.

DebugSelection

We can now run our program by choosing the Run / Start Debugging option from the menu or pressing F5. When you run your program, you should see something like this:

Run

The output you see in the TERMINAL window at the bottom comes from the Logger statements we discussed earlier. You can add your own logging commands to output to this window when your program is running.

Now that the program is running, you can switch to the Driver Station and connect to the robot by clicking the Connect button. At this point your robot is disabled. To enable the robot, click the Enable button. Doing these two things displays some additional logging in the TERMINAL window:

Run2

Here we can see the logging indicates that the robot has connected to the Driver Station, was Enabled and now has teleop mode running.

On a final note, when starting a whole new session, these are the steps that you must take to get your program running and enabled:

  1. Connect your PC’s WiFi to the robot.
  2. Use the Driver Station to start PuTTY.
  3. Run your program from within VS Code by pressing F5.
  4. Using the Driver Station, connect to your robot
  5. Finally use the Driver Station enable your robot.

Once you have launched putty, you do not need to do that again unless you shutdown or reboot your raspberry Pi. When you make changes to your program, to run it again, you need to stop the current version by pressing the stop button (Stop) at the top, you can then run your program again following steps 3-5.

When you are through working with the robot, it is advisable to shut the Pi down gracefully rather than simply unplugging it. This can be done by clicking the Shutdown Pi on the Driver Station. Once you have done this wait about a minute for the Pi to shut down (you can tell when it is done when the green light on the Pi stops flashing). You can then safely unplug the Pi.

Next: Drive Subsystem

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.