Line Tracking
From Waveshare Wiki
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.
- Running the codes and a video is played, you can follow it.
- 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.
- Modify button value for capturing. (you can also keep default setting).
- 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
- 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.
- Download Model
- 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.
- x, y are forecast values. Speed is VSL of jetbot, steering is steering speed of jetbot.
- Move Jetbot by change the speed gain.