備註
您正在閱讀開發版本的文件。對於最新發行的版本,請參見 Kilted。
Ubuntu (source Pixi)
系統要求
The current Debian-based target platforms for Rolling Ridley are:
Tier 1: Ubuntu Linux - Noble (24.04) 64-bit
Tier 3: Debian Linux - Bookworm (12) 64-bit
As defined in REP 2000.
System setup
Set locale
Make sure you have a locale which supports UTF-8.
If you are in a minimal environment (such as a docker container), the locale may be something minimal like POSIX.
We test with the following settings.
However, it should be fine if you're using a different UTF-8 supported locale.
$ locale # check for UTF-8
$ sudo apt update && sudo apt install locales
$ sudo locale-gen en_US en_US.UTF-8
$ sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
$ export LANG=en_US.UTF-8
$ locale # verify settings
Create a location for the ROS 2 installation
This location will contain both the installed binary packages, plus the ROS 2 installation itself.
Start a terminal, then create a directory to store the installation.
$ mkdir ~/ros_ws_pixi
Install prerequisites
安裝 pixi
ROS 2 uses conda-forge as a backend for packages, with pixi as the frontend.
Continue using the previous terminal session, and use the instructions from https://pixi.sh/latest/ to install pixi.
Once pixi has been installed, close the terminal session and start it again, which will ensure pixi is on the PATH.
安裝相依項
Download the pixi configuration file in the existing terminal session:
$ cd ~/ros_ws_pixi
$ wget https://raw.githubusercontent.com/ros2/ros2/rolling/pixi.toml -O pixi.toml
安裝相依項:
$ pixi install
建置 ROS 2
Source the pixi environment
This is required in every command prompt you open to set up paths to the dependencies:
$ cd ~/ros_ws_pixi
$ pixi shell
獲取 ROS 2 程式碼
Now that we have the development tools we can get the ROS 2 source code.
Setup a development folder, for example ~/ros_ws_pixi/src:
$ mkdir ~/ros_ws_pixi/src
$ cd ~/ros_ws_pixi
Get the ros2.repos file which defines the repositories to clone from:
$ vcs import --input https://raw.githubusercontent.com/ros2/ros2/rolling/ros2.repos src
Build the code in the workspace
To build the workspace folder tree:
$ colcon build --merge-install --event-handlers console_direct+ --cmake-args -D LTTNGPY_DISABLED=1 --packages-skip qt_gui_cpp --packages-skip-by-dep qt_gui_cpp --packages-skip-build-finished
備註
Source installation can take a long time given the large number of packages being pulled into the workspace.
Setup environment
Start a new terminal, which will be used in the examples.
Source the pixi environment
This is required in every command prompt you open to set up paths to the dependencies:
$ cd ~/ros_ws_pixi
$ pixi shell
Source the ROS 2 environment
This is required in every command prompt you open to setup the ROS 2 workspace:
$ source ~/ros_ws_pixi/install/local_setup.bash
This will automatically set up the environment for any DDS vendors for which support was built.
嘗試一些範例
You can run the tests using this command:
$ colcon test --merge-install
備註
--merge-install should only be used if it was also used in the build step.
Afterwards you can get a summary of the tests using this command:
$ colcon test-result
To run the examples, set up the workspace by sourcing the local_setup.bash file.
Then, run a C++ talker:
$ source ~/ros_ws_pixi/install/local_setup.bash
$ ros2 run demo_nodes_cpp talker
In a separate command prompt you can do the same, but instead run a Python listener:
$ source ~/ros_ws_pixi/install/local_setup.bash
$ ros2 run demo_nodes_py listener
You should see the talker saying that it's Publishing messages and the listener saying I heard those messages.
This verifies both the C++ and Python APIs are working properly.
Hooray!
備註
It is not recommended to build in the same cmd prompt that you've sourced the local_setup.bash.
下一步
Continue with the tutorials and demos to configure your environment, create your own workspace and packages, and learn ROS 2 core concepts.
Stay up to date
See Maintain source checkout to periodically refresh your source installation.
If you installed your workspace with colcon as instructed above, "uninstalling" could be just a matter of opening a new terminal and not sourcing the workspace's
setupfile. This way, your environment will behave as though there is no Rolling install on your system.If you're also trying to free up space, you can delete the entire workspace directory with:
$ rm -rf ~/ros_ws_pixi