JetRacer AI Kit Tutorial IV: Road-following

From Waveshare Wiki
Jump to: navigation, search

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 6003.png
  • This program is to adjust the output of the image processing to control the operation of the car.
    • The STEERING_GAIN parameter is the output ratio, and the size of this parameter can be adjusted for a more realistic running situation. Set to a negative value if the direction of rotation is reversed.
    • car.throttle sets the maximum speed of the car. If this value is set too small, the car will not move or the movement will be stuck. If the value is too large, the car will easily run off the track.

If you want a better line-following effect, you can change the program to use PID to adjust the steering of the car.

JetRacer AI Kit Manual 6004.png
  • This program is to run the output of image processing through the PD control trolley.
    • car.throttle sets the maximum speed for the car to run. If the secondary value is set too high, the car will easily run off the track.
    • Kp, Kd are PID parameters, only PD adjustment is used here. This parameter can be debugged according to the actual running effect of the car.