Install ROS System on Jetson Nano & Environment Cofiguration
From Waveshare Wiki
JetBot ROS AI Kit Advanced Tutorial Directory
- How to Analysis the Radar Data?
- SLAM Lidar Mapping
- Autonomous Navigation
- ROS OpenCV
- ROS Intelligent Voice
- Install ROS System on Jetson Nano & Environment Cofiguration
- Install ROS System in Ubuntu Virtual Machine & Environment Configuration
- ROS Voice Environment Configuration
- JetBot ROS AI Kit Main Page
Introduction
- The configured image is provided, and you can refer to the following steps if you want to install the ROS system configuration environment. It is recommended to use the configured image we provided.
- The Internet must be stable when you install and configure the image.
- The version of Jetson Nano we use is Ubuntu 18.04. The latest ROS system version you can install is Melodic.
Step 1: Jetson Nano Programming System
It is recommended to use Jetson image configuration. Jetbot program library is required when using Jetson Nano original image, or the OLED and Jetbot function cannot work normally.
- Jetbot website: http://jetbot.org/
- 4G image version: jetbot-043_nano-4gb-jp45.zip
- Please prepare SD card (more than 64G) to program, and insert it to Jetson Nano. Please connect to the power enable it.
- Connect the network cable and log in by SSH.
- Enter the following command to scan the available WiFi, and then find the WiFi we can connect:
sudo nmcli device wifi list
- Connect the WiFi. Please set your account and password in <ssid_name>, <password>.
sudo nmcli device wifi connect <ssid_name> password <password>
- Please run the following command to query the IP of wlan 0 on the WiFi interface, and OLED will display it.
ifconfig
Step 2: Configure ROS Software Repository
- After installing Ubuntu system, please open the terminal and enter the following command to configure ROS software repository.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
- Configure keys. This step is to make sure our system can recognize this path is safe to download the documents, or the documents we download will be canceled.
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
Step 3: Install ROS Melodic
- After adding the new source, we need to update the source list. Please enter the following command on the terminal:
sudo apt-get update
- There are many different libraries and tools in ROS. Generally, it includes Desktop-Full, Desktop, and ROS-Base.
- Desktop-Full includes ROS, rpt, rviz, the general library for robots, 2D/3D simulator, navigation, and 2D/3D perception package. Desktop-Full is installed here.
sudo apt install ros-melodic-desktop-full
Step 4: Add Environment Variables and Install ROS Dependencies
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc #Add environment variables source ~/.bashrc #Effective environment variables sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential #Install dependencies
Step 5: Initialize rosdep
- Before using ROS, you need to initialize rosdep, which can help you install the source code or the required system dependencies for the ROS core components. You can enter the following command in the terminal:
sudo apt install python-rosdep sudo rosdep init rosdep update
Step 6: Verify the ROS Environment
- Use the ROS welcome applet: crawling turtle to demonstrate the ROS system.
- The startup of the ROS system requires a ROS Master, that is, a node manager. We can enter the roscore command in the terminal to start the ROS Master.
roscore
- Finish.
Step 7: Set up Workspace
- Set up catkin_ws workspace, and put the project under this directory.
mkdir -p ~/catkin_ws/src cd ~/catkin_ws catkin_make #Compile sudo sh -c 'echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc' #Add environment variables source ~/.bashrc #Effective environment variables
Step 8: Download & Compile Jetbot_pro
cd ~/catkin_ws/src git clone https://github.com/waveshare/jetbot_pro.git cd ~/catkin_ws && catkin_make && source ~/catkin_ws/devel/setup.bash
Step 9: Install Dependency Libraries
sudo apt-get install ros-melodic-robot-pose-ekf sudo apt-get install ros-melodic-gmapping sudo apt-get install ros-melodic-hector-slam sudo apt-get install ros-melodic-slam-karto sudo apt-get install ros-melodic-cartographer-ros sudo apt-get install ros-melodic-navigation sudo apt-get install ros-melodic-teb-local-planner sudo apt-get install ros-melodic-audio-common
Step 10: Install Camera Function Package
sudo apt-get install gstreamer1.0-tools libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev 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
- If the IMX219-160 camera image is too red, you can enter the following command to improve:
wget http://www.waveshare.net/w/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
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 has been mostly completed. If you need an intelligent voice function, you also need to add the settings.