JetBot 2GB AI Kit

From Waveshare Wiki
Jump to: navigation, search
JetBot 2GB AI Kit
JetBot AI Kit

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

{{{name3}}}

{{{name4}}}

{{{name5}}}

Introduction

This is a 2GB AI Robot kit based on Jetson Nano Developer Kit. Supports facial recognition, object tracking, auto line following or collision avoidance, and so on.

Feature

  • Onboard three 18650 batteries with a large capacity of 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 voltage of 5V 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, which can display the real-time IP address of the car, memory, power, etc.
  • Onboard ina219 chip, convenient for real-time monitoring of battery power and charging current.

User Guides

Install Image

Method 1: Use the configured SD image

【Note】 The software part of this guide is mostly based on NVIDIA jetbot wiki , you can also directly refer to it.
Step 1. Write JetBot image to SD card

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 (the slot is under Jetson Nano board).
  • Connect HDMI display (if you don't have HDMI or DP display and want to buy one, recommend our HDMI display), keyboard, and mouse to Jetson Nano Developer Kit.

【Note】You had better test the Jetson Nano Developer Kit before you assemble JetBot.
Step 3. Connect Jetbot to WIFI
As all the programs we use later require WiFi, we need to connect JetBot to WIFI first.

  • Start Jetson nano Developer Kit, the default user name and password of Jetbot are both jetbot
  • In order to reduce memory, the new version of the image has disabled the graphical interface, you need to use the command line to connect to WiFi.
sudo nmcli device wifi connect <SSID> password <PASSWORD>
  • SSID is the WiFi account to be connected, and PASSWORD is the WiFi password to be connected.
  • Start Jetson nano again. After booting, Ubuntu will automatically connect WIFI, the IP address is also displayed on OLED.

Step 4. Access JetBot via Web

  • Shut down JetBot by the command line.
sudo shutdown now
  • After networking. You can remove peripherals and power adapter.
  • Turn the Power switch of Jetbot into On.
  • After booting, the IP address of OLED can be displayed on OLED
  • Navigate to http://<jetbot_ip_address>:8888 from your desktop's web browser.
  • Now you have access to JetBot's remote programming environment! The browser displays the following interface.

JetBot 2GB AI Ki-step4.jpg

  • Now that the image is installed, when the JetBot is powered on, the robot will automatically connect to WiFi and display its IP address. Just reconnect the robot with your browser and start programming!

Method 2: Configuring images with Docker containers

Step 1. Program the Jetson Nano SD image

Step 2. Start jetson nano and connect to WiFi

  • Insert the SD card into the Jetson Nano (the SD card slot is on the back of the Jetson Nano core board.
  • Connect the HDMI monitor, keyboard and mouse to Nano.
  • Connect the power supply to the Jetson Nano, power on the Jetson Nano.
  • Login to the system, click the network icon in the upper right corner of the system to connect to WIFI, if you are not sure how to operate it, you can refer to WiFi Setup Guide.
  • [Note] It is recommended to start the test Jetson Nano first without installing the car to ensure that the Jetson Nano hardware can start normally without any problems.

Step 3. Clone the jetbot GitHub program

  • Copy Waveshare's JetBot GitHub program.
git clone -b jetbot_0.4.2 https://github.com/waveshare/jetbot.git
  • [Note] The program we provide is slightly different from the one given by JetBot's official GitHub. If you directly update the latest official software, the program will no longer display the current battery level, and the motor may be unable to drive normally.

Step 4. Configure the system

  • Call scripts/configure_jetson.sh script to configure power mode and other parameters.
cd jetbot
./scripts/configure_jetson.sh
  • configure_jetson.sh also disables the GUI in order to save system memory (DRAM) consumption.

If you want to re-enable the GUI, you can execute the command sudo systemctl set-default graphical.target, or you can also execute the script (./scripts/re_enable_gui.sh). Step 5. enable all containers

  • Call the following command to enable the JetBot Docker container.
cd docker
./enable.sh $HOME
  • Now the IP address of the car has been displayed on the OLED screen. jetbot can be programmed via browser.
  • Enter the IP address of JetBot in the browser to open. Port is 8888, for example: 192.168.32.10:8888. Login to jetbot with a password.
  • Now you have access to JetBot's remote programming environment! The browser displays the following interface.
JetBot AI Kit Manual 2.jpg
  • The enable.sh script will make the Docker container start automatically when it is powered on, so when the JetBot is powered on, the Docker container will start automatically, and the OLED screen will display the IP address. Just reconnect the robot with your browser and start programming right away!

Basic motion

  • Access jetbot by going to http://<jetbot_ip_address>:8888, navigate to ~/Notebooks/basic_motion/
  • Open basic_motion.ipynb file and following the notebook.

【Note】You can click icon ▶ to run codes, or select Run -> Run Select Cells. Make sure the JetBot has enough space to run.
JetBot AI Kit03.jpg

  • When running robot.left(speed=0.3), the car will turn left in a circle (need to ensure that the car has enough space to move). If the car does not turn left, it may be that the wiring is wrong, and you need to check it again.
  • After running this program, two sliders on the left and right will be output. Drag the slider to change the speed of the left and right clicks.

JetBot AI Kit04.jpg

  • After running this code, you can control the front, back, left and right movement of the car through the web buttons. [Note] You can open the output window as a new page by right-clicking the code ->Create New View for Output.

JetBot AI Kit06.jpg

  • This code uses "heartbeat" to maintain the normal operation of the car. After dragging the slider to reduce the heartbeat frequency, the car will stop rotating.

JetBot AI Kit05.jpg

Teleoperations

  • Access JetBot by going to https://<jetbot_ip_address>:8888, navigate to ~/Notebooks/teleoperation/.
  • Open teleoperation.ipynb file and following notebook.
  • Connect USB adapter to PC.
  • Go to https://html5gamepad.com, check the INDEX of Gamepad.
Before you run the example, let's learn how the gamepad work.
The gamepad included supports two working modes. One is PC/PS3/Andorid mode and another is Xbox 360 mode.
The gamepad is set to PC/PS3/Andorid mode by default, in this mode, the gamepad has two sub-modes. You can press the HOME button to switch it. In Mode 1, the front panel lights on only one LED, the right joystick is mapped to buttons 0,1,2 and 3, and you can get only 0 or -1/1 value from the joysticks. In Mode 2, the front panel lights on two LEDs, the right joystick is mapped to axes[2] and axes[5]. In this mode, you can get No intermediate values from joysticks.
JetBot AI Kit Manual 7.jpg
To switch between PC/PS3/Andorid mode and the Xbox 360 mode, you can long-press the HOME button for about 7s. In Xbox mode, the left joystick is mapped to axes[0] and axes[1], right joystick is mapped to axes[2] and axes[3]. This mode is exactly what the NVIDIA examples use. We recommend you to set your gamepad to this mode when you use it. Otherwise, you need to modify the codes.
JetBot AI Kit Manual 43.JPG
  • Modify the index. Run and test Gamepad.
JetBot AI Kit Manual 8.jpg
  • Modify axes values if required, here we use axes[0] and axes[1]
JetBot AI Kit Manual 9.jpg
  • At this point, the window will display the picture captured by the current camera.
JetBot AI Kit Manual 10.jpg
  • "Heartbeat" check, the car will stop automatically when the car is disconnected from the network.
JetBot AI Kit Manual 11.jpg
  • Control the car to take pictures by pressing the button. You can choose different buttons by changing the button. Here, buttons[0] is selected for the convenience of control.
Gamepad Control 07.jpg
  • After running the program, you can control Jetbot through the remote control handle. Asex[0] controls the left wheel, Asex[1] controls the right wheel, button[0] controls the camera, the left image shows the real-time camera image, the right is the captured image, and the image is saved in the snapshots file.

Collision_avoidance

In this example, we'll collect an image classification dataset that will be used to help keep JetBot safe! We'll teach JetBot to detect two scenarios free and blocked. We'll use this AI classifier to prevent JetBot from entering dangerous territory.

Step 1. Collect data on JetBot
  • Access JetBot by going to https://<jetbot_ip_address>:8888, navigate to ~/Notebooks/collision_avoidance/.
  • Open data_collection.ipynb file and following notebook.
  • After running the program, the interface as shown in the figure appears, put the car in a different position, and click "add free" if there is no obstacle in front of the car. If there is an obstacle in front of the car, please click "add blocked". The captured pictures will be saved in the dataset folder, and as many pictures of various situations as possible will be taken. You can try different orientations, brightness, object or collision types (walls, ledges, etc.), and can try untextured floors/objects (patterned, smooth, glass, etc.).
JetBot AI Kit Manual 13.jpg
  • The more scene data the car collects, the better the obstacle avoidance effect will be. Therefore, it is very important to obtain as much different data as possible for the obstacle avoidance effect. Generally, at least 100 pictures are required for each situation.
  • Finally, run the program to package the pictures. After packaging, a dataset.zip compressed file will appear in the current directory.
JetBot AI Kit Manual 14.jpg
Step 2. Train neural network
  • Access JetBot by going to https://<jetbot_ip_address>:8888, navigate to ~/Notebooks/collision_avoidance/
  • Open and follow the tain_model.ipynb notebook.
  • If you already have the dataset.zip file you just compressed, you do not need to run this statement to decompress it, otherwise you will be prompted to overwrite the existing file.
JetBot AI Kit Manual 15.jpg
  • When the program runs here, the alexnet model will be downloaded, and the download time is a bit long. After downloading the program, an alexnet-owt-4df8aa71.pth file will appear in the /home/hetbot/.torch/models directory.
JetBot AI Kit Manual 16.jpg
  • Finally, run the program to train the neural network, and the running time is relatively long. After the training is completed, a best_mode.pth file will appear in the current directory.
JetBot AI Kit Manual 17.jpg
Step 3. Automatic Obstacle Avoiding
  • Access JetBot by going to https://<jetbot_ip_address>:8888, navigate to ~/Notebooks/collision_avoidance/
  • Open and follow the live_demo.ipynb notebook.
  • After running the program, the camera live image and a slider are displayed. Intermodulation represents the probability of encountering an obstacle, 0.00 means that there is no obstacle ahead, and 1.00 means that the obstacle ahead needs to be turned to avoid.
JetBot AI Kit Manual 18.jpg
  • Here, adjust the speed a little to avoid hitting the obstacles too fast. If obstacle avoidance cannot be achieved in some places, it is recommended to collect more data.
JetBot AI Kit Manual 19.jpg
  • [Note] Some statements may take a long time to run. There is a program running promptly in the upper right corner of JupyterLab. When the small dot is black, it means the program is running, and white means it is idle.
JetBot AI Kit Manual 20.jpg

Object-detection

The current image of the latest jetpack4.5 does not support the target tracking demo.
In this chapter we demonstrate how to use jetbot to track objects, we use a pre-trained coco dataset neural network that can detect 90 different objects. Including people (index 0), cups (index 47), apples (index 54) and other objects. For specific objects that can be detected, you can refer to data list

  • Enter http://<jetbot_ip_address>:8888 in the browser to connect to the car, open Notebook/object_following/ on the left side and the live_demo.ipynb file.
  • Before running the program, you need to download the pre-trained ssd_mobilenet_v2_coco.engine model, decompress it, and copy it to the current folder directory.
  • It should be noted that the program in this chapter needs to use the module established in the previous chapter for autonomous obstacle avoidance, and the car needs to be performed in the same environment.
  • Before running this code, you need to put the detection object in front of the camera. The detected coco objects are output after running the program. Empty data [[ ]] is output if no object is detected. The output information can be seen through the table lookup that an apple has been detected, and the apple's ID is 53. If multiple objects are detected at the same time, multiple messages are output.
JetBot AI Kit Manual 023.jpg

After running the program, the output is as shown in the figure, a blue box is drawn around the detected object, and the target object (jetbot follows the target) will display a green frame.

JetBot AI Kit Manual 23.jpg
  • You can adjust the speed and turn gain appropriately to avoid the jetbot running too fast.
  • When jetbot detects the target, it will turn to the target, if blocked by an obstacle, jetbot will turn left.

Line tracking

This chapter we will use data collect, link tracking and auto-detecting to realize robot auto line-tracking function.

Step 1. Collect data by JetBot
  • Access JetBot by going to https://<jetbot_ip_address>:8888, navigate to ~/Notebooks/road_following/
  • Open data-collection.ipynb file.
JetBot AI Kit Manual 24.jpg
  • Running the codes and a video is played, you can follow it.
JetBot AI Kit Manual 25.jpg
  • On the image captured by camera, there are a green point and a blue line. The point and line is the expected road which Robot run.
  • The content below is similar to [#3. Teleoperation], modify the index and axes values.

【Note】The axes keys here must be analogized by Wie, that is, decimals can be output. If you use the gamepad we configured, you need to press the HOME button to switch the mode. Make the indicator light in the state of two lights.

JetBot AI Kit Manual 26.jpg
  • Modify button value for capturing. (you can also keep default setting).
JetBot AI Kit Manual 27.jpg
  • Collecting data. Set JetBot to different places of the lines, and use Gamepad to move the green point to the black line. The blue line is the way Jetbot expected to run. You can press the capture button to capture a picture. You should collect pictures as soon as possible, count shows the amount of the pictures captured.

【Note】If Gamepad is inconvenient for you, you can set the position of green point by dragging steering and throttle sliders.

  • Save pictures
JetBot AI Kit Manual 28.jpg
Step 2. Training model
  • Access Jetbo by going to https://<jetbot_ip_address>:8888, navigate to ~/Notebooks/road_following/
  • Open train_model.ipynb file.
  • If you use the data collected above, you needn't to unzip files next.
  • If you use external data, you need to modify the name road_following.zip to the corresponding file name.
JetBot AI Kit Manual 29.jpg
JetBot AI Kit Manual 30.jpg
  • Download Model
JetBot AI Kit Manual 31.jpg
  • Train model, it will generate best_steerin_mdel_xy.pth file.
Step 3. Road following
  • Access Jetbo by going to https://<jetbot_ip_address>:8888, navigate to ~/Notebooks/road_following/.
  • Open live_demo.ipynb file.
  • Load model and open camera for living video.
  • You can drag the sliders to modify parameters.
JetBot AI Kit Manual 32.jpg
  • x, y are forecast values. Speed is VSL of jetbot, steering is steering speed of jetbot.
JetBot AI Kit Manual 33.jpg
  • Move Jetbot by change the speed gain.
【Note】 You cannot set the speed gain too high, otherwise, JetBot may run fast and go off the rail. You can also set the steering smaller to make the motion of jetbot much more smooth.
JetBot AI Kit Manual 34.jpg


Resources

Development Resource


FAQ

 Answer:
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.

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.
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 12.6V power supply cannot directly supply power to the Jetson Nano. It is used to plug into the 12.6V port on the expansion board, charge the battery, and then power the Jetson Nano from the battery. Please do not directly connect to Jetson Nano. If you need to buy a Jetson nano power supply, you can click here to get it.
{{{4}}}

{{{5}}}


 Answer:
The charging indicator is on the charger, the green light is full, and the red light is charging.
{{{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:
If you are installing the battery for the first time, or have disassembled the battery before, please note that you need to connect the distributed power supply to charge the car for a few seconds, and then turn on the protection circuit before it can be used normally.
{{{4}}}

{{{5}}}


 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 removable 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.
{{{4}}}

{{{5}}}


 Answer:
The 12V power adapter is used to charge the batteries. DO NOT directly connect it to Jetson Nano Developer board.
{{{4}}}

{{{5}}}


 Answer:
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 updated the one from NVIDIA's, please remove the Jetbot folder and download ours by following step 5.
{{{4}}}

{{{5}}}


Support

If you require technical support, please go to the Support page and open a ticket.