Line Tracking

From Waveshare Wiki
Jump to: navigation, search

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 place of the lines, use Gamepad to move green point to the black line. Blueline is the way Jetbot expected to run in. 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
7. ROS