Welcome to Jetson Orin NX Developer Kit repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
2.ROS2 install Jazzy
2. ROS2 install Jazzy
ROS2 Jazzy corresponds to Ubuntu 24.04; this tutorial installs ROS2 Jazzy on Ubuntu 24.04.
The software sources, packages and interfaces may differ between Ubuntu and ROS2 versions, so please use the ROS2 version that matches your system, and do not simply replace the version name and run the commands directly.
The factory system already comes with the jazzy ROS environment set up; this tutorial applies to pure systems.
1. Setting the language environment
First check whether the local language environment supports UTF-8 encoding. You can check it and set UTF-8 encoding with the following commands:
xlocale # check whether UTF-8 is supported
sudo apt update && sudo apt install localessudo locale-gen en_US en_US.UTF-8sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8export LANG=en_US.UTF-8
locale # verify that the setting workedNote: the language environment can be different, but it must support UTF-8 encoding.
2. Setting the software source
Enable the Ubuntu universe repository
xxxxxxxxxxsudo apt install software-properties-commonsudo add-apt-repository universeInstall the ROS 2 software source configuration package. This method automatically configures the GPG key and the software source that matches the current Ubuntu version:
xxxxxxxxxxsudo apt update && sudo apt install curl -yexport ROS_APT_SOURCE_VERSION=$(curl -s https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest | grep -F 'tag_name' | awk -F\" '{print $4}')curl -L -o /tmp/ros2-apt-source.deb "https://github.com/ros-infrastructure/ros-apt-source/releases/download/${ROS_APT_SOURCE_VERSION}/ros2-apt-source_${ROS_APT_SOURCE_VERSION}.$(. /etc/os-release && echo ${VERSION_CODENAME})_all.deb"sudo dpkg -i /tmp/ros2-apt-source.debrm -f /tmp/ros2-apt-source.deb3. Installing Jazzy
First update the apt repository cache:
xxxxxxxxxxsudo apt updateThen upgrade the installed software (the ROS2 packages are built on an Ubuntu system that is updated frequently, so please make sure your system is up to date before installing new packages):
xxxxxxxxxxsudo apt upgradeInstall the desktop version of ROS2 (recommended), which includes ROS, RViz2, the examples and the tutorials:
xxxxxxxxxxsudo apt install ros-jazzy-desktop python3-argcompleteInstall the colcon build tool
xxxxxxxxxxsudo apt install python3-colcon-common-extensions4. Configuring the environment
In the terminal, when you run a ROS2 program, you have to call the following command to configure the environment:
xxxxxxxxxxsource /opt/ros/jazzy/setup.bashEvery time you open a new terminal you have to run the command above, or you can run the following command to write the environment configuration command into the "~/.bashrc" file, so that you do not have to configure the environment manually every time you start a new terminal
xxxxxxxxxxecho '[ -f /opt/ros/jazzy/setup.bash ] && source /opt/ros/jazzy/setup.bash' >> ~/.bashrcAfter reopening the terminal, check the environment with the following command:
xxxxxxxxxxecho $ROS_DISTROcommand -v ros2You should see jazzy and /opt/ros/jazzy/bin/ros2 respectively. If you additionally set PYTHONPATH, do not overwrite the Python package search path of ROS2; it is recommended to use the append form, for example:
xxxxxxxxxxexport PYTHONPATH="/home/jetson/jetcam${PYTHONPATH:+:$PYTHONPATH}"At this point ROS2 has been installed and configured.
5. Running the example publisher and subscriber nodes
The ros2 desktop version integrates some example nodes for us, and we can run the example nodes to test whether ros2 has been installed successfully.
Run the publisher node
xxxxxxxxxxros2 run demo_nodes_cpp talkerRun the subscriber node
xxxxxxxxxxros2 run demo_nodes_cpp listener6. Running the little turtle example
The turtle simulator turtlesim is a classic teaching tool in ros. Through turtlesim you can quickly get to grips with the core concepts in ros.
Run the turtle simulator
xxxxxxxxxxros2 run turtlesim turtlesim_nodeRun the keyboard control node
xxxxxxxxxxros2 run turtlesim turtle_teleop_keyView the velocity topic data
xxxxxxxxxxros2 topic echo /turtle1/cmd_vel