JetRacer ROS AI Kit Advanced Tutorial V: Install ROS System on Jetson Nano & Environment Configuration
Introduction
This guide provides comprehensive instructions for installing the ROS system and configuring the environment on a Jetson Nano. While using the pre-configured image provided is recommended, these steps will help you set up the system manually. Ensure a stable internet connection throughout the installation and configuration process. The tutorial uses Ubuntu 18.04 and ROS Melodic.
Step 1: Jetson Nano Programming System
-
Download Jetbot Image:
- Jetbot website: Jetbot GitHub
- 4G image version:
jetcard_nano-4gb-jp451.zip
-
Prepare SD Card:
- Use an SD card with at least 64GB capacity.
- Insert the SD card into the Jetson Nano.
- Connect the power to enable the device.
-
Network Configuration:
-
Connect the network cable and log in via SSH.
-
Scan available WiFi networks:
sudo nmcli device wifi list
-
Connect to WiFi:
sudo nmcli device wifi connect <ssid_name> password <password>
-
Query the IP of wlan0 on the WiFi interface:
ifconfig
-
Step 2: Configure ROS Software Repository
-
Add ROS repository:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
-
Add repository keys:
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
Step 3: Install ROS Melodic
-
Update source list:
sudo apt-get update
-
Install Desktop-Full version of ROS:
sudo apt install ros-melodic-desktop-full
Step 4: Add Environment Variables and Install ROS Dependencies
-
Add environment variables:
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc source ~/.bashrc
-
Install dependencies:
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
Step 5: Initialize rosdep
-
Install
rosdep
:sudo apt install python-rosdep
-
Initialize and update
rosdep
:sudo rosdep init rosdep update
Step 6: Verify the ROS Environment
-
Start ROS Master:
roscore
Step 7: Set up Workspace
-
Create and compile catkin workspace:
mkdir -p ~/catkin_ws/src cd ~/catkin_ws catkin_make sudo sh -c 'echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc' source ~/.bashrc
Step 8: Download & Compile JetRacer ROS
-
Clone JetRacer ROS repository and compile:
cd ~/catkin_ws/src git clone https://github.com/waveshare/jetracer_ros.git cd ~/catkin_ws catkin_make source ~/catkin_ws/devel/setup.bash
Step 9: Install Dependency Libraries
-
Install various ROS libraries:
sudo apt-get install ros-melodic-robot-pose-ekf ros-melodic-gmapping ros-melodic-hector-slam ros-melodic-slam-karto ros-melodic-cartographer-ros ros-melodic-navigation ros-melodic-teb-local-planner ros-melodic-audio-common
Step 10: Install Camera Function Package
-
Install GStreamer and related packages:
sudo apt-get install gstreamer1.0-tools libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev
-
Clone camera repositories and compile:
cd ~/catkin_ws/src git clone https://github.com/peter-moran/jetson_csi_cam.git git clone https://github.com/ros-drivers/gscam.git cd gscam sed -e "s/EXTRA_CMAKE_FLAGS = -DUSE_ROSBUILD:BOOL=1$/EXTRA_CMAKE_FLAGS = -DUSE_ROSBUILD:BOOL=1 -DGSTREAMER_VERSION_1_x=On/" -i Makefile cd ~/catkin_ws catkin_make source ~/catkin_ws/devel/setup.bash
-
Adjust camera settings if the image is too red:
wget https://files.waveshare.com/upload/e/eb/Camera_overrides.tar.gz tar zxvf Camera_overrides.tar.gz sudo cp camera_overrides.isp /var/nvidia/nvcam/settings/ sudo chmod 664 /var/nvidia/nvcam/settings/camera_overrides.isp sudo chown root:root /var/nvidia/nvcam/settings/camera_overrides.isp
Step 11: Install the Lidar Function Package
-
Clone Lidar repository and compile:
cd ~/catkin_ws/src git clone https://github.com/Slamtec/rplidar_ros.git cd ~/catkin_ws catkin_make source ~/catkin_ws/devel/setup.bash
By now, the ROS environment of the Jetbot robot should be mostly completed. If you need an intelligent voice function, additional settings will be required.