Difference between revisions of "JetRacer AI Kit"

From Waveshare Wiki
Jump to: navigation, search
 
(22 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
<div class="wiki-pages jet-green-color">
 
{{infobox item
 
{{infobox item
 
|img=[[File:JetRacer-AI-Kit-1.jpg|300px|alt=JetRacer AI Kit|{{Amazon_nolink|default={{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}|url=link=https://www.waveshare.com/jetracer-ai-kit.htm}}|JetRacer AI Kit]]
 
|img=[[File:JetRacer-AI-Kit-1.jpg|300px|alt=JetRacer AI Kit|{{Amazon_nolink|default={{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}|url=link=https://www.waveshare.com/jetracer-ai-kit.htm}}|JetRacer AI Kit]]
Line 11: Line 12:
 
}}
 
}}
 
==Introduction==
 
==Introduction==
This is an AI Racing Robot kit based on Jetson Nano Developer Kit. Supports deep learning, auto line following, autonomous driving and so on.
+
This is an AI Racing Robot kit based on Jetson Nano Developer Kit. Supports deep learning, auto line following, autonomous driving, and so on.
 +
==Features==
 +
*Support three 18650 batteries <font color="#FF0000">(not included)</font>, 7800mAh large capacity, up to 12.6V output, stronger motor power.
 +
*On-board S-8254AA + AO4407A Li-ion battery protection circuit, with anti-overcharge, anti-over-discharge, anti-over-current and short-circuit protection functions.
 +
*Onboard APW7313 voltage regulator chip, which can provide stable 5V voltage to Jetson Nano.
 +
*Onboard TB6612FNG dual H-bridge motor driver chip can drive the left and right two motor work.
 +
*Onboard 0.91" 128×32 resolution OLED, real-time display of car IP address, memory, power, and other conditions.
 +
*Onboard INA219 acquisition chip, convenient for real-time monitoring of battery voltage.
 +
 
 
==User Guides==
 
==User Guides==
 
===1. Hardware setup===
 
===1. Hardware setup===
 
*[[JetRacer Assembly Manual]]
 
*[[JetRacer Assembly Manual]]
 
 
===2. Software setup===
 
===2. Software setup===
<!--【Note】 The software part of this guide mostly based on [https://github.com/NVIDIA-AI-IOT/jetracer NVIDIA JetRacer wiki ], you can also refer to it -->
+
<!--【Note】 The software part of this guide is mostly based on [https://github.com/NVIDIA-AI-IOT/jetracer NVIDIA JetRacer wiki ], you can also refer to it -->
; Step 1. Write JetRacer image to SD card
+
; Step 1. Write JetRacer image to SD card.
*You need to prepare an SD card which should be at least 64G
+
*You need to prepare an SD card which should be at least 64G.
 
*Download the JetRacer image and unzip it.
 
*Download the JetRacer image and unzip it.
** <font color=red> The Jetracer AI Kit use the same image with the Pro version, the non-pro version should switch the jetracer resposity to mast batch at Step 5.</font>
+
** <font color=red> The Jetracer AI Kit uses the same image as the Pro version, the non-pro version should switch the jetracer resposity to mast batch at Step 5.</font>
**[https://drive.google.com/file/d/1bgCAUJ9m16g5FGuYgKy3WmGI-pGjPXN0/view?usp=sharing Pre-Built image based on Jetpack4.5]
+
**[https://drive.google.com/file/d/1ZBdqrwhW2n1uN8rughF7Puw98o76kUcH/view?usp=sharing Pre-Built image based on Jetpack4.5]
*Connect the SD card to PC via card reader
+
*Connect the SD card to the PC via the card reader.
*User Etcher software to write image (unzip above) to SD card.[https://www.balena.io/etcher/ Click here to download Etcher software]
+
*User Etcher software to write the image (unzip above) to the SD card. [https://www.balena.io/etcher/ Click here to download Etcher software].
 
:[[File:JetBot_AI_Kit_Manual_1.jpg|400px]]
 
:[[File:JetBot_AI_Kit_Manual_1.jpg|400px]]
*After writing, eject the SD card
+
*After writing, eject the SD card.
; Step 2. Startup Jetson Nano Developer Kit
+
; Step 2. Startup Jetson Nano Developer Kit.
*Insert SD card to SD card slot of Jetson nano (slot is under Jetson Nano board)
+
*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
+
*Power on JetRacer AI Kit, and connect the micro USB interface of the Jetson Nano Developer Kit to your PC.
<font color=red>【Note】You had better test the Jetson Nano Developer Kit before you assemble JetRacer</font>
+
<font color=red>【Note】You had better test the Jetson Nano Developer Kit before you assemble JetRacer.</font>
 
; Step 3. Connect JeRacer to WIFI
 
; Step 3. Connect JeRacer to WIFI
All the examples use WIFI, we need to connect JetRacer to WIFI firstly.
+
All the examples use WIFI, we need to connect JetRacer to WIFI first.
*Open a browser (we recommend you to use Chrome) and navigate to <font style="background-color:#EEEEEE; color:red">192.168.55.1:8888 </font>
+
*Open a browser (we recommend you use Chrome) and navigate to <font style="background-color:#EEEEEE; color:red">192.168.55.1:8888 </font>
 
*Sign in with default password <font style="background-color:#EEEEEE; color:red">jetson</font>
 
*Sign in with default password <font style="background-color:#EEEEEE; color:red">jetson</font>
 
*Open a terminal in Jupyter Lab by click '''File''' -> '''New''' -> '''Terminal'''
 
*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.
+
*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 know the available network.
 
<pre>sudo nmcli device wifi list</pre>
 
<pre>sudo nmcli device wifi list</pre>
*Connect to the selected WIFI network. Please replace the <ssid_name> and <password> to the actual name and password.
+
*Connect to the selected WIFI network. Please replace the <ssid_name> and <password> with the actual name and password.
 
<pre>sudo nmcli device wifi connect <ssid_name> password <password></pre>
 
<pre>sudo nmcli device wifi connect <ssid_name> password <password></pre>
*After getting the successfully information, please check the ip_addtess of Wlan0 interface by the following command
+
*After getting the successful information, please check the ip_addtess of Wlan0 interface by the following command.
 
<pre>ifconfig</pre>
 
<pre>ifconfig</pre>
 
; Step 4. Connect to JetRacer over WIFI
 
; Step 4. Connect to JetRacer over WIFI
Line 46: Line 54:
 
*Close the previous Jupyter Lab Browser tab
 
*Close the previous Jupyter Lab Browser tab
 
*Open a new browser tab and navigate to <font style="background-color:#EEEEEE"  color=red><nowiki>http://<jetracer_ip_address>:8888</nowiki></font>  
 
*Open a new browser tab and navigate to <font style="background-color:#EEEEEE"  color=red><nowiki>http://<jetracer_ip_address>:8888</nowiki></font>  
 +
*Enter http://<jetson_ip_address>:8888 in the browser address bar to connect to the car, where jetson_ip_address is the actual IP displayed on the OLED, for example: 192.168.32.10:8888.
 +
*Login to Jupyter Lab with the password jetson.
 +
[[File:JetBot 2GB AI Ki-step4.jpg]]
 +
 
; Step 5. Install the python package
 
; Step 5. Install the python package
 
*Access JetRacer by going to <font style="background-color:#EEEEEE"  color=#red><nowiki>http://<jetracer_ip_address>:8888</nowiki></font>
 
*Access JetRacer by going to <font style="background-color:#EEEEEE"  color=#red><nowiki>http://<jetracer_ip_address>:8888</nowiki></font>
*Launch a new terminal. Default user name and password are both '''jetson'''
+
*Launch a new terminal. The default user name and password are both '''jetson'''.
* Switch the Jetracer batch to the Master
+
* Switch the Jetracer batch to the Master.
 
<pre>
 
<pre>
 
cd Jetracer
 
cd Jetracer
 
sudo git checkout master
 
sudo git checkout master
sudo python3 setup.py
+
sudo python3 setup.py install
 +
sudo reboot
 
</pre>
 
</pre>
 
<!--
 
<!--
*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.  
+
*Get and install the latest JetRacer repository from GitHub. Some of the Python packages provided here are modified by Waveshare for Waveshare JetRacer AI Kit.  
 
*Update Jetcard Python
 
*Update Jetcard Python
 
<pre>
 
<pre>
Line 73: Line 86:
 
sudo python3 setup.py install
 
sudo python3 setup.py install
 
</pre>
 
</pre>
*Install JetCam Python package
+
*Install JetCam Python package.
 
<pre>
 
<pre>
 
cd  
 
cd  
Line 80: Line 93:
 
sudo python3 setup.py install
 
sudo python3 setup.py install
 
</pre>
 
</pre>
*Install torch2trt Python package
+
*Install torch2trt Python package.
 
<pre>
 
<pre>
 
cd  
 
cd  
Line 87: Line 100:
 
sudo python3 setup.py install
 
sudo python3 setup.py install
 
</pre>
 
</pre>
*Install JetRacer package
+
*Install JetRacer package.
 
<pre>
 
<pre>
 
cd
 
cd
Line 94: Line 107:
 
sudo python3 setup.py install
 
sudo python3 setup.py install
 
</pre>
 
</pre>
 
+
-->
 
; Step 6. Configure power mode
 
; 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
 
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 following commands to select 5W power mode
+
*You need to launch a new Terminal and enter the following commands to select 5W power mode
 
  sudo nvpmodel -m1
 
  sudo nvpmodel -m1
 
*Check if mode is correct
 
*Check if mode is correct
 
  sudo nvpmodel -q
 
  sudo nvpmodel -q
【Note】m1: 5W power mode, m2: 10W power model
+
*At the same time, OLED will display:
-->
+
MODE: MAXN
 +
 
 
===3. Examples===
 
===3. Examples===
; (1) Basic motion
+
====Basic motion====
*Access JetRacer by going to <font style="background-color:#EEEEEE" color=#red><nowiki>http://<jetracer_ip_address>:8888</nowiki></font>, navigate to ~/Notebooks/basic_motion/
+
*Enter <font style="background-color:#EEEEEE" color=#B94A48><nowiki>http://<jetbot_ip_address>:8888</nowiki></font> in the browser address bar to connect to the car, open /jetracer/notebooks/ on the left side. Open the basic_motion.ipynb file.
*Browse to the folder ~/jetracer/notebooks in the Jupyter Lab file browser
+
*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 ▶.<br/>
*Open basic_motion.ipynb file and following the notebook
+
[Note] There are detailed program notes in the text. Read the notes carefully to understand the program functions.<br/>
【Note】You can click icon ▶ to run codes, or select Run -> Run Select Cells. Make sure the JetRacer has enough space to run.
+
:[[File:JetRacer AI Kit Manual 3-1.jpg.png|600px]]<br/>
;Note
+
*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]<br/>
:If you get error when running the motion script, please open a new termial, resintall Adafruit-PureIO librares with following commands and try again.
+
:[[File:JetRacer AI Kit Manual 3-2.png|600px]]<br/>
 +
*After running this program, the steering gain car.steering_gain and the steering initial displacement car.steering_offset will be output.<br/>
 +
*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.
 +
:[[File:JetRacer AI Kit Manual 3-3.png|600px]]
 +
*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 introduces 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.
 +
====Teleoperations====
 +
*Enter <font style="background-color:#EEEEEE" color=#B94A48><nowiki>http://<jetbot_ip_address>:8888</nowiki></font> 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).
 +
:[[File:JetBot_AI_Kit_Manual_7.jpg|600px]]
 +
*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.
 +
:[[File:JetBot_AI_Kit_Manual_8.jpg|600px]]
 +
*The maximum speed of the throttle is set to 0.2 here, 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.
 +
[[File:JetRacer AI Kit Manual 4-1.png|600px]]
 +
*Modify the axes value to correspond to different buttons, here is set to axes[0], and axes[5] for the convenience of remote control.
 +
:[[File:JetRacer AI Kit Manual 4-2.png|600px]]
 +
*After running the program, you can control the car through the remote control handle. Asex[0] controls the front wheel steering, and Asex[1] 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.
 +
:[[File:JetRacer AI Kit Manual 4-3.png|600px]]
 +
====interactive-regression====
 +
In this chapter, we also need to collect the data, patrol, and run autonomously to realize the function of autonomous patrolling.
 +
*Enter <font style="background-color:#EEEEEE" color=#B94A48><nowiki>http://<jetson_ip_address>:8888</nowiki></font> in the browser address bar to connect to the car, find / jetracer/notebooks/. Open the interactive-regression.ipynb file.
 +
 
 +
:[[File:JetRacer AI Kit Manual 5-1.png]]
 +
*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.
 
<pre>
 
<pre>
sudo pip3 install --upgrade pip
+
sudo systemctl restart nvargus-daemon
sudo pip3 uninstall Adafruit-PureIO
 
sudo pip3 install Adafruit-PureIO
 
 
</pre>
 
</pre>
;(2) Teleoperations
+
*Run all program units directly, the last program will display the following interface.
*Access JetRacer by going to <font style="background-color#EEEEEE" color=#red><nowiki>https://<jetracer_ip_address>:8888</nowiki></font>, navigate to ~/Notebooks/teleoperation/
+
[[File:JetRacer AI Kit Manual 5-2.png|600px]]
*Open teleoperation.ipynb file and following notebook
+
*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.
;(3) Interactive-regression
+
*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.
*Navigate to <font style="background-color#EEEEEE" color=#red><nowiki>https://<jetracer_ip_address>:8888</nowiki></font>
+
*After collecting the data, select the value of epochs as 10, and then click train to train for 10 rounds.
*Sign in with the default password jetson
+
*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.
*Browse to the folder ~/jetracer/notebooks in the Jupyter Lab file browser
+
*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.
*Open the notebook interactive_regression.ipynb and following it
+
 
;(4) Road-following
+
====Road-following====
*Navigate to <font style="background-color#EEEEEE" color=#red><nowiki>https://<jetracer_ip_address>:8888</nowiki></font>
+
In this chapter, we use the trained model to implement autonomous driving.
*Sign in with the default password jetson
+
*Enter <font style="background-color:#EEEEEE" color=#B94A48><nowiki>http://<jetson_ip_address>:8888</nowiki></font> in the browser address bar to connect to the car and find jetracer /noteboot/. Open the road_following.ipynb file.
*Browse to the folder ~/jetracer/notebooks in the Jupyter Lab file browser
+
:[[File:JetRacer AI Kit Manual 6-1.png|600px]]
*Open the notebook road_following.ipynb and following it
+
*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.
 +
:[[File:JetRacer AI Kit Manual 6-2.png|600px]]
 +
*Create a car and a camera. If the camera prompts an error, run the following command to restart the camera and run it again.
 +
<pre>
 +
sudo systemctl restart nvargus-daemon
 +
</pre>
 +
 
 +
:[[File:JetRacer AI Kit Manual 6-3.png|600px]]
 +
*This program is to run the output of image processing through the PD control trolley.
 +
*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==
 
==Guide of DonkeyCar==
Line 140: Line 195:
 
*[[DonkeyCar for Jetson Nano-Auto-Driving|Auto-Driving]]
 
*[[DonkeyCar for Jetson Nano-Auto-Driving|Auto-Driving]]
 
=Resources=
 
=Resources=
*[https://www.waveshare.com/w/upload/4/4a/JetRacer_Schematic.pdf Schematic of JetRacer Expansion board]
+
*[https://files.waveshare.com/upload/4/4a/JetRacer_Schematic.pdf Schematic of JetRacer Expansion board]
 
===Datasheet===
 
===Datasheet===
*[[:File:Ina219.pdf]]
+
*[[:File:Ina219.pdf|Ina219]]
*[[:File:PCA96_datasheet.pdf]]
+
*[[:File:PCA96_datasheet.pdf|PCA96_datasheet]]
*[[:File:S-8254AA.PDF]]
+
*[[:File:S-8254AA.PDF|S-8254AA]]
*[[:File:Ads1115.pdf]]
+
*[[:File:Ads1115.pdf|Ads1115]]
*[[:File:TB6612FNG_datasheet_en.pdf]]
+
*[[:File:TB6612FNG_datasheet_en.pdf|TB6612FNG]]
 +
==Jetson Official Resources==
 +
*[https://files.waveshare.com/upload/6/6f/Jetson_Nano_Developer_Kit_User_Guide.pdf Jetson Nano Developer Kit User Guide]
 +
*[https://www.nvidia.com/JetsonNano-Start Jetson Nano Get Start]
 +
*[https://developer.nvidia.com/embedded/dlc/jetson-nano-3D-CAD-Step-Model Jetson Nano 3D Drawing]
 +
*[https://developer.nvidia.com/jetson-nano-developer-kit-b01-3d-cad-step-model Jetson Nano Deverloper Kit 3D Drawing]
 +
*[https://developer.nvidia.com/embedded/downloads Jetson Download Center]
 +
*[https://forums.developer.nvidia.com/c/agx-autonomous-machines/jetson-embedded-systems/jetson-nano/76/ Jetson Nano Forum]
 +
*[https://github.com/dusty-nv Jetson Github]
  
 
= FAQ =
 
= FAQ =
 +
{{FAQ|What batteries does JetBot AI Kit use?
 +
|
 +
Support three 18650 batteries '''(not included)''' and the voltage of every battery is 3.7V. Generally, the voltage per battery is 4.2V when fully charged. Please use batteries without a protective plate.
 +
BTW, the 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.<br />
 +
We recommend you to use high-quality batteries like Sanyo or Panasonic.<br />
 +
[[File:batteries _18650_en.jpg|500px]]
 +
|}}
 +
{{FAQ|Why is my Jetbot turning in the wrong direction?
 +
|When the motor rotates in the wrong direction, check whether the motor wires are reversed.
 +
|}}
 +
 +
{{FAQ|What are the system account and passwords?
 +
|The account and password of the JetBot system are jetbot.
 +
|}}
 +
{{FAQ|You are prompted to enter a password, but you cannot enter the password, or an error is reported?
 +
|The Linux system does not display the input content when entering the password. Please enter jetbot directly on the keyboard and press Enter.
 +
|}}
 +
 
{{FAQ|How to fix the problem '''"AttributeError: module 'torch' has no attribute reciprocal_'"''' while running the road_following script?
 
{{FAQ|How to fix the problem '''"AttributeError: module 'torch' has no attribute reciprocal_'"''' while running the road_following script?
 
|Please open the terminal and run the following command to install torch-1.2.0
 
|Please open the terminal and run the following command to install torch-1.2.0
Line 160: Line 241:
 
Do not forget to reboot at the end.
 
Do not forget to reboot at the end.
 
|||}}
 
|||}}
{{FAQ|What batteries does JetRacer AI Kit use?
+
 
| Three 18650 batteries are used and the voltage of every battery is 3.7V. Generally, the voltage per battery is 4.2V when full charging. Please use batteries without a protective plate.
+
{{FAQ|After flashing the image of Jetson Nano, the TF card cannot be recognized on a Windows computer?
BTW, Power of JetRacer 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.<br />
+
|Due to the partition problem, the TF card with the image of the Jetson Nano programmed cannot recognize the drive letter normally on the Windows computer. If you need to reformat it, search for Disk Management in the search bar of Windows and open the Disk Management interface. Find the mobile disk where the TF card is located (be careful not to mistake it for another disk), right-click and select Delete Volume, then create a new volume and format it by default. After the default format, the drive letter of TF will be recognized again. At this time, the space and memory of the TF card are incorrect. Note that you need to use the formatting software to quickly format the new drive letter again. After formatting, if the memory space of the TF card is normal, the new image can be re-programmed normally.
We recommend you to use high-quality batteries like Sanyo or Panasonic.<br />
+
}}
[[File:batteries _18650_en.jpg|500px]]
+
 
|}}
+
=Support=
{{FAQ|What is the power adapter used to do?
+
{{Servicebox1}}
|The 12V power adapter is used to charge the batteries. '''DO NOT''' directly connect it to Jetson Nano Developer board.
 
|||}}
 
{{FAQ|Why doesn't the motor work after setting up?
 
|Please make sure that you have installed the codes of Waveshare instead of NVIDIA's. The drive codes of the motor are different between Waveshare's and NVIDIA's. If you have update the one from NVIDIA's, please remove the Jetracer folder and download ours by following step 5.
 
|||}}
 
==Supports==
 
{{Service02}}
 

Latest revision as of 08:55, 4 January 2024

JetRacer AI Kit
JetRacer AI Kit

AI Racing Robot Kit base on Jetson Nano Developer Kit
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Introduction

This is an AI Racing Robot kit based on Jetson Nano Developer Kit. Supports deep learning, auto line following, autonomous driving, and so on.

Features

  • Support three 18650 batteries (not included), 7800mAh large capacity, up to 12.6V output, stronger motor power.
  • On-board S-8254AA + AO4407A Li-ion battery protection circuit, with anti-overcharge, anti-over-discharge, anti-over-current and short-circuit protection functions.
  • Onboard APW7313 voltage regulator chip, which can provide stable 5V voltage to Jetson Nano.
  • Onboard TB6612FNG dual H-bridge motor driver chip can drive the left and right two motor work.
  • Onboard 0.91" 128×32 resolution OLED, real-time display of car IP address, memory, power, and other conditions.
  • Onboard INA219 acquisition chip, convenient for real-time monitoring of battery voltage.

User Guides

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.
    • The Jetracer AI Kit uses the same image as the Pro version, the non-pro version should switch the jetracer resposity to mast batch at Step 5.
    • Pre-Built image based on Jetpack4.5
  • Connect the SD card to the PC via the card reader.
  • User Etcher software to write the image (unzip above) to the SD card. Click here to download Etcher software.
JetBot AI Kit Manual 1.jpg
  • After writing, eject the SD card.
Step 2. Startup Jetson Nano 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 the Jetson Nano Developer Kit to your PC.

【Note】You had better test the Jetson Nano Developer Kit before you assemble JetRacer.

Step 3. Connect JeRacer to WIFI

All the examples use WIFI, we need to connect JetRacer to WIFI first.

  • Open a browser (we recommend you use Chrome) and navigate to 192.168.55.1:8888
  • Sign in with default password jetson
  • 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 know the available network.
sudo nmcli device wifi list
  • Connect to the selected WIFI network. Please replace the <ssid_name> and <password> with the actual name and password.
sudo nmcli device wifi connect <ssid_name> password <password>
  • After getting the successful information, please check the ip_addtess of Wlan0 interface by the following command.
ifconfig
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
  • Enter http://<jetson_ip_address>:8888 in the browser address bar to connect to the car, where jetson_ip_address is the actual IP displayed on the OLED, for example: 192.168.32.10:8888.
  • Login to Jupyter Lab with the password jetson.

JetBot 2GB AI Ki-step4.jpg

Step 5. Install the python package
  • Access JetRacer by going to http://<jetracer_ip_address>:8888
  • Launch a new terminal. The default user name and password are both jetson.
  • Switch the Jetracer batch to the Master.
cd Jetracer
sudo git checkout 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 mode is correct
sudo nvpmodel -q
  • At the same time, OLED will display:
MODE: MAXN

3. Examples

Basic motion

  • 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.

JetRacer AI Kit Manual 3-1.jpg.png
  • 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]
JetRacer AI Kit Manual 3-2.png
  • 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.
JetRacer AI Kit Manual 3-3.png
  • 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 introduces 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.

Teleoperations

  • 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).
JetBot AI Kit Manual 7.jpg
  • 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.
JetBot AI Kit Manual 8.jpg
  • The maximum speed of the throttle is set to 0.2 here, 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.

JetRacer AI Kit Manual 4-1.png

  • Modify the axes value to correspond to different buttons, here is set to axes[0], and axes[5] for the convenience of remote control.
JetRacer AI Kit Manual 4-2.png
  • After running the program, you can control the car through the remote control handle. Asex[0] controls the front wheel steering, and Asex[1] 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.
JetRacer AI Kit Manual 4-3.png

interactive-regression

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.
JetRacer AI Kit Manual 5-1.png
  • 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.

JetRacer AI Kit Manual 5-2.png

  • 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.

Road-following

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.
JetRacer AI Kit Manual 6-1.png
  • 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.
JetRacer AI Kit Manual 6-2.png
  • 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
JetRacer AI Kit Manual 6-3.png
  • This program is to run the output of image processing through the PD control trolley.
  • 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

Resources

Datasheet

Jetson Official Resources

FAQ

 Answer:

Support three 18650 batteries (not included) and the voltage of every battery is 3.7V. Generally, the voltage per battery is 4.2V when fully charged. Please use batteries without a protective plate. BTW, the 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.
Batteries 18650 en.jpg

{{{4}}}

{{{5}}}


 Answer:
When the motor rotates in the wrong direction, check whether the motor wires are reversed.
{{{4}}}

{{{5}}}


 Answer:
The account and password of the JetBot system are jetbot.
{{{4}}}

{{{5}}}


 Answer:
The Linux system does not display the input content when entering the password. Please enter jetbot directly on the keyboard and press Enter.
{{{4}}}

{{{5}}}


 Answer:
Please open the terminal and run the following command to install torch-1.2.0
wget https://nvidia.app.box.com/public/static/06vlvedmqpqstu1dym49fo7aapgfyyu9.whl -O torch-1.2.0a0+8554416-cp36-cp36m-linux_aarch64.whl
sudo apt-get install python3-pip libopenblas-base libopenmpi-dev 
pip3 install Cython
pip3 install numpy torch-1.2.0a0+8554416-cp36-cp36m-linux_aarch64.whl --user
sudo reboot

Do not forget to reboot at the end.


 Answer:
Due to the partition problem, the TF card with the image of the Jetson Nano programmed cannot recognize the drive letter normally on the Windows computer. If you need to reformat it, search for Disk Management in the search bar of Windows and open the Disk Management interface. Find the mobile disk where the TF card is located (be careful not to mistake it for another disk), right-click and select Delete Volume, then create a new volume and format it by default. After the default format, the drive letter of TF will be recognized again. At this time, the space and memory of the TF card are incorrect. Note that you need to use the formatting software to quickly format the new drive letter again. After formatting, if the memory space of the TF card is normal, the new image can be re-programmed normally.
{{{3}}}
{{{4}}}

{{{5}}}


Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 AM GMT+8 (Monday to Friday)