Jetson Nano + Sphero RVR Mash-up (PART 2)
The [HACKED] Sphero RVR SDK
With this project being a mash-up of two different projects we cannot assume that we can just use the JetBot API and have it work with the Sphero RVR out of the box! The RVR has its own Python libraries that we need to use because the Jetson Nano is not just controlling motors directly as it is on a JetBot, but sending instructions to the RVR to then move the motors over a UART connection. You can learn more about the details of the SDK at Sphero SDK webpage as well as the GitHub repo for the SDK itself.
So, we need to install the Sphero SDK on the Jetson Nano. But wait, not just the Sphero RVR SDK! One that has been modified for use with the NVIDIA Jetson Nano.
The Python libraries for the Sphero RVR assume that you are using a Raspberry Pi and can be found here. They are an exceptional collection of classes and methods to control your RVR, read sensors, and communicate with other devices that our friends over at Sphero created! The original API specifies the directory path for the proper serial port / UART port name on a Raspberry Pi, but not a NVIDIA Jetson Nano!
So, we had to make some minor changes to the SDK to point it to the correct UART for use with the SparkFun Servo pHAT combined with the NVIDIA Jetson Nano. It was no real feat of hacker magic here; the only changes we made to our fork of the SDK was to take an instance of the UART path of
/dev/ttyS0 which is the path for the UART pin on the Pi header for the the Raspberry Pi to
/dev/ttyTHS1 which is the path for the same pin, but on the NVIDIA Jetson Nano. In all, this was in four different places throughout the SDK.
Downloading and Installing the [HACKED] SDK
We forked the official Sphero SDK to make the UART directory path changes and you can download it and install the SDK from Jupyter Notebooks on your NVIDIA Jetson Nano by following these simple instruction:
- Open a terminal window in Jupyter Notebooks by selecting File > New > Terminal. This will open up a familiar bash looking terminal for you… essentially this is a fancy SSH connection to your Jetson Nano.
- Download the [Hacked] SDK by running to following command:
sudo git clone https://github.com/d1runberg/sphero-sdk-raspberrypi-python.gitand type the password
- Move into the SDK repository with
- Install the SDK using the following command:
sudo python3 setup.py install
- Change Read write permissions of the UART connection by typing the following command:
sudo chmod 660 /dev/ttyTHS1.