Now that all libraries and frameworks are installed on the Jetson Nano, the configuration of the donkey car can begin. The configuration is important, as it determines, for example, the steering angle, the cruise control configuration or even the use of a gamepad. The configuration is done in the myconfig.py file and here you should not be scared when you open it for the first time. It has become really long with version 3.x of the framework but with calm and thought it is no problem to configure myconfig.py correctly.
Configuration of the Donkey Car
Now the configuration of the donkey car starts. It is important to configure the steering and cruise control so that you can steer the donkey car without any problems. So the directional stability should fit and the steering angle to the left and right should be the same. The configuration of the speed controller must be correct so that the donkey car can stop, accelerate and reverse.
A description of the basics of the configuration which is still valid I have described here in an article: Autonomously driving Raspberry Pi KI robot car – calibration
Please transfer the determined values for the steering and for the speed control of the cruise control into the myconfig.py file in the folder ~/mycar.
Below is my myconfig.py file packed as a ZIP file which I use for my Jetson Nano. I have built in a controller that can distinguish by the MAC address on which donkey car the myconfig.py file is currently loaded. So I can distinguish different donkey cars with Jetson Nano as SBC.
After successful configuration it is now time to start the Donkey Car Framework and get familiar with the Donkey Car. Because from now on you are ready to record training data.
With the following command you start the Donkey Car Framework with the goal to record training data.
ATTENTION: Error pattern known to me
It can happen that the Donkey Car Framework crashes during loading. The error message always went in the direction of OpenCV and the NVIDIA G streamer.
Here is the error message I got:
OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /home/nvidia/build_opencv/opencv/modules/imgproc/src/color.cpp, line 11016
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
File "/usr/lib/python3.6/threading.py", line 864, in run
File "/home/donkey/donkeycar/donkeycar/parts/camera.py", line 172, in update
File "/home/donkey/donkeycar/donkeycar/parts/camera.py", line 167, in init_camera
File "/home/donkey/donkeycar/donkeycar/parts/camera.py", line 179, in poll_camera
self.frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
cv2.error: /home/nvidia/build_opencv/opencv/modules/imgproc/src/color.cpp:11016: error: (-215) scn == 3 || scn == 4 in function cvtColor
I then tried a few things and found that the initial resolution was too high for the GStreamer. I reduced the resolution significantly and after that I had no more problems. You can find the location in the file “camera.oy” and here in the class “class CSICamera(BaseCamera):”.
I have adapted this class as follows in the resolution in the following line.
def __init__(self, image_w=160, image_h=120, image_d=3, capture_width=3280, capture_height=2464, framerate=60, gstreamer_flip=0):
Line adapted by me:
def __init__(self, image_w=160, image_h=120, image_d=3, capture_width=160, capture_height=120, framerate=60, gstreamer_flip=0):
After this adjustment, the Donkey Car Framework worked for me without any problems and I could record training data, train the neural network and then let the Donkey Car drive autonomously.
The commands for recording the training data and training the neural network are described here.
(Not yet translated)
- Autonom fahrendes Raspberry Pi KI Roboter-Auto – Trainingsdaten aufzeichnen
- Autonom fahrendes Raspberry Pi KI Roboter-Auto – das Neuronale Netz trainieren
Note Power supply
I use a strong PowerBank in mobile operation to supply the Jetson Nano with energy. So the RC battery is only used for the drive motor and the Jetson Nano will not crash if the drive motor takes up too much power. Also the Donkey Car drives much longer. At the Power Bank I recommend to buy a very strong Power Bank which delivers about 5A output current at 5V voltage. In this way it is possible to intercept power peaks of the Jetson Nano and obtain a very stable vehicle from an operational point of view.
I recommend the following Powerbank which I use myself. The following link leads back to the Amazon web shop.
For those who prefer an easier introduction to the world of the Jetson Nano, I would like to recommend the JetBot. This small robot was completely developed by Nvidia and offers a one-stop solution from hardware to software. If you don’t want to print the case yourself using the 3D files published by Nvidia, you can also purchase a complete kit from Waveshare. The Waveshare NVIDIA JetBot AI Kit Smart Robot Based offers everything you need. I became aware of this robot kit because NVIDIA recommended it in their blog. I myself have built the Jetson Nano, an autonomous AI robotic car, and I am convinced that this kit can be a great source of joy for anyone wishing to gain initial experience in AI based on the NVIDIA JetBot.
asa2 tpl=”Flat_box_horizontal_CBR” associate_id_set=”IngmarStack”]B07V8JL4TF[/asa2]
If you would like to build your own donkey car based on an RC model and use the computing power of the Jetson Nano instead of the Raspberry Pi, follow the installation instructions below.