JetRacer 2GB AI Kit
This is an AI Racing Robot kit based on Jetson Nano 2GB Developer Kit. Supports deep learning, auto line following, autonomous driving, and so on.
- Onboard three 18650 batteries, 7800mAh, up to 12.6V voltage output, and stronger motor power.
- Onboard S-8254AA + AO4407A lithium battery protection circuit, with anti-overcharge, anti-over-discharge, anti-over-current and short-circuit protection functions.
- The onboard APW7313 voltage regulator chip can provide a stable 5V voltage to the Jetson Nano.
- The onboard TB6612FNG dual H-bridge motor driver chip can drive the left and right motors to work.
- Onboard 0.91-inch 128×32 resolution OLED, real-time display of car IP address, memory, power, etc.
- The onboard ADS1115 AD acquisition chip is convenient for real-time monitoring of battery power.
1. Hardware setup
2. Software setup
- Step 1. Write JetRacer image to SD card
- You need to prepare an SD card which should be at least 64G.
- Download the JetRacer image and unzip it. Click here to download it
- Connect the SD card to the PC via card reader.
- User Etcher software to write the image (unzip above) to SD card. Click here to download Etcher software.
- After writing, eject the SD card.
- Step 2. Startup Jetson Nano 2GB Developer Kit
- Insert SD card to SD card slot of Jetson nano (slot is under Jetson Nano board).
- Power on JetRacer AI Kit, and connect the micro USB interface of Jetson Nano Developer Kit to your PC.
【Note】You had better test the Jetson Nano 2GB Developer Kit before you assemble JetRacer.
- Turn on the power switch to start the Jetson Nano. After the system starts, the computer will recognize the USB network card. If the network card does not automatically obtain an IP, you need to manually set the IP address to 192.168.55.1.
- Open a browser and navigate to 192.168.55.1:8888 and log into Jupyter Lab with the default password jetson.
- Step 3. Connect JeRacer to WIFI
All the examples use WIFI, we need to connect JetRacer to WIFI firstly.
- Open a browser (we recommend you to use Chrome) and navigate to 192.168.55.1:8888
- Sign in with default password jetbot
- Open a terminal in Jupyter Lab by click File -> New -> Terminal
- In the terminal, type the following command to list available WiFi networks, and find the ssid_name of your network. You can also skip this step if you have known the available network.
sudo nmcli device wifi list
- Connect to the selected WIFI network. Please replace the <ssid_name> and <password> to the actual name and password.
sudo nmcli device wifi connect <ssid_name> password <password>
- After getting the successfully information, please check the ip_addtess of Wlan0 interface by the following command
- Step 4. Connect to JetRacer over WIFI
- Unplug the USB cable from Jetson Nano.
- Close the previous Jupyter Lab Browser tab.
- Open a new browser tab and navigate to http://<jetracer_ip_address>:8888. "jetson_ip_address" is the actual IP displayed on the OLED, for example: 192.168.32.10:8888.
- Login to Jupyter Lab with password jetson.
- Step 5. Install the python package
- Access JetRacer by going to http://<jetracer_ip_address>:8888
- Launch a new terminal. Default user name and password are both jetbot
- Get and install the latest JetRacer repository from GitHub.The some of the python package provided here are modified by Waveshare for Waveshare JetRacer AI Kit.
- Update JetRacer package
cd jetracer git chekcout master sudo python3 setup.py install sudo reboot
- Step 6. Configure power mode
To ensure that the Jetson Nano doesn't draw more current than the battery pack can supply, place the Jetson Nano in 5W mode by calling the following command
- You need to launch a new Terminal and enter the following commands to select 5W power mode
sudo nvpmodel -m1
- Check if the mode is correct
sudo nvpmodel -q
【Note】m1: 5W power mode, m2: 10W power model
- Enter http://<jetbot_ip_address>:8888 in the browser address bar to connect to the car, open /jetracer/notebooks/ on the left side. Open the basic_motion.ipynb file.
- Files with lpynb suffix are lpython Notebook files, including comment text and python programs. You can run a single-segment program by clicking Run->Run Select Cells or clicking the Run shortcut icon ▶.
[Note] There are detailed program notes in the text. Read the notes carefully to understand the program functions.
- When running the statement car.steering = 0, the car steering will turn. 0 means forward, 1 means the wheel goes to the far left, -1 means the wheel goes to the far right. Change the wheel to different directions to different values, the value range is [-1,1]
- After running this program, the steering gain car.steering_gain and the steering initial displacement car.steering_offset will be output.
- The steering gain car.steering_gain can represent the maximum angle the wheel can turn.
- The initial steering displacement car.steering_offset can represent the initial offset of the wheels. When car.steering = 0, when the car does not run in a straight line, you can adjust the length of the steering rod or modify the value of the initial steering displacement to make the car go straight.
- car.throttle is the throttle size, the range is [-1,1], 0 means stop, 1 means forward at maximum speed, -1 means backward at maximum speed, after modifying the secondary value and running the program, the rear wheel will turn.
- car.throttle_gain is the throttle gain, which can indicate the maximum speed at which the car can move. When car.throttle_gain = 1 and car.throttle = 1, the car can run to the maximum speed.
- Summary: This section mainly learns how to control the movement of the car. The car is divided into two parts to control, one part is steering steering to control the car turning, and the other part is the throttle to control the speed of the rear wheels.
- The steering gain car.steering_gain controls the maximum rotation range of the wheel, and the initial steering displacement car.steering_offset can compensate for the steering error caused by mechanical assembly.
- The throttle gain car.throttle_gain controls the maximum speed range of the rear wheels.
- Enter http://<jetbot_ip_address>:8888 in the browser address bar to connect to the car, open /jetracer/notebooks/ at the left side. Open the teleoperation.ipynb file.
- Plug the gamepad receiver into the USB port of the computer. [Note] The receiver should be connected to the computer instead of the jetson nano. The gamepad needs to be connected to the device that opens the JupyterLab webpage.
- Open the https://html5gamepad.com/ webpage to see if the remote controller is detected. Write down the INDEX value of the corresponding device.
- The value corresponding to pressing the remote controller button will change. Press the name of the corresponding key a few times. (The handle needs to press the home button so that the two lights of the remote control handle are on).
- After running this code, the window will output the buttons corresponding to the gamepad. Note that the index in the program needs to be modified to the value corresponding to the actual remote control handle, and the corresponding INDEX can be seen on the web page just opened. The button icon corresponding to the button pressed will indicate that the button has been pressed.
- The maximum speed of the throttle is set to 0.2 here, in order to collect data later to limit the speed.
- Set the steering offset to 0.18, this value is adjusted according to the actual situation, until the car can drive in a straight line without steering.
- Modify the axes value to correspond to different buttons, here is set to axes, and axes for the convenience of remote control.
- After running the program, you can control the car through the remote control handle. Asex controls the front wheel steering, and Asex controls the rear wheel speed.
- The left joystick controls the steering of the front wheel of the car in the left and right directions, and the right joystick controls the speed of the rear wheels in the up and down direction.
In this chapter, we also need to collect the data, patrol, and run autonomously to realize the function of autonomous patrolling.
- Enter http://<jetson_ip_address>:8888 in the browser address bar to connect to the car, find / jetracer/notebooks/. Open the interactive-regression.ipynb file.
- In this section, the camera is turned on, and the image resolution is set to 224*224.
- Note: Re-opening after program exit may prompt an error. You need to run this statement to restart the camera.
sudo systemctl restart nvargus-daemon
- Run all program units directly, the last program will display the following interface.
- At this time, you can put the car on the track, and open the teleoperation.ipynb program in the previous section to run, so that the remote control handle can control the movement of the car.
- Control the car to run along the track, every time you move a small position, use the mouse to move to the ideal running path of the car in the picture and click to save the picture and control the car to shoot 10 laps along the track.
- After collecting the data, select the value of epochs as 10, and then click train to train for 10 rounds.
- After training the data, you can click evaluate to evaluate the training model. If there is no problem with the collected data, you can see the ideal direction of the current car position in the leftmost image.
- Note that the collected data needs to move the trolley to different positions, offsets, and directions along the track, and select the farthest point along the ideal path to save it to ensure that the trolley will not leave the track or collide with objects.
In this chapter, we use the trained model to implement autonomous driving.
- Enter http://<jetson_ip_address>:8888 in the browser address bar to connect to the car and find jetracer /noteboot/. Open the road_following.ipynb file.
- After the program runs to this section, the model file road_following_model_trt.pth converted and optimized using touch2trt will be produced in the directory. This optimization process may take several minutes to complete.
- Create a car and a camera. If the camera prompts an error, run the following command to restart the camera and run it again.
sudo systemctl restart nvargus-daemon
- This program is to run the output of image processing through the PD control trolley.
The *car.steering_offset parameter is to correct the initial state offset of the car caused by the mechanical error of the car. This parameter needs to be changed to the actual value of the car.
- car.throttle sets the maximum speed for the car to run. If the second value is set too high, the car will easily run off the track.
- Kp, and Kd are PID parameters, and PD adjustment is used here. This parameter can be debugged according to the actual running effect of the car.
Guide of DonkeyCar
- Setup Jetson Nano
- Setup Linux PC
- WEB Control
- Calibrate DonkeyCar
- Data Collection
- Train Data
BTW, Power of JetBot is down when the voltage of the whole system is similar to 9V (it is not accurate), we recommend you to charge batteries if the voltage displayed is lower than 10V.
We recommend you to use high-quality batteries like Sanyo or Panasonic.
If you require technical support, please go to the Support page and open a ticket.