Get started on the Linux host
Needs first: Install
Status: Verified on host (daily). From the board support registry:
nros-board-linux; Board Support Levels explains the words.
This starter builds a talker as an ordinary program on your Linux machine, runs it, and shows its messages arriving in ROS 2. It is the fastest way to try nano-ros: no emulator, no cross-compiler, and no router. The talker uses Cyclone DDS, which runs inside the talker’s own process and finds its peers on the network the way any ROS 2 node does. The project has the same shape as every board’s: change the board in the scaffold line and the same steps target an embedded board. You write the talker in Rust, C or C++; pick a tab and every tab on the page follows.
What you need
- A Linux host with the install done, so
nrosis on yourPATH. Only Linux is supported as a host board: macOS, Windows and FreeBSD are not. - ROS 2 (Humble on Ubuntu 22.04, Jazzy on 24.04; which edition),
with its Cyclone DDS middleware, so that
ros2 topic echocan read what the talker publishes. Both installs on the Install page include it; for any other ROS 2 install, add it on Debian or Ubuntu:
sudo apt-get install -y ros-humble-rmw-cyclonedds-cpp
Nothing else: no board, no cable, and nothing to keep running beside the talker.
Provision
nros setup linux --rmw cyclonedds
That installs the Cyclone DDS runtime and its IDL compiler, prebuilt for your
host, into a shared store under ~/.nros. Nothing is installed system-wide.
There is no cross-compiler to fetch: a host build uses your own C and C++
compilers.
Scaffold the project
Source ROS 2 first, in the shell you scaffold from. nros new writes
the ROS 2 edition the project speaks, and it takes it from the sourced
ROS 2; with none sourced, it writes Humble. On Jazzy, source
/opt/ros/jazzy/setup.bash instead:
source /opt/ros/humble/setup.bash
nros new host_ws --board linux --template talker --lang rust --rmw cyclonedds
cd host_ws
nros new host_ws --board linux --template talker --lang c --rmw cyclonedds
cd host_ws
nros new host_ws --board linux --template talker --lang cpp --rmw cyclonedds
cd host_ws
That wrote a workspace with two packages:
host_ws/
└── src/
├── host_node/ # the talker: manifest, build file, source
└── host_node_bringup/ # what it runs on: board, RMW
host_node is the talker, a library with no main() that names no board. It
publishes std_msgs/String on /chatter once a second. host_node_bringup
says what the talker runs on: its system.toml holds one image,
[image.linux], whose board = "linux" line is what makes it a host program.
Run it on this machine
The build generates the message bindings from your ROS 2 install, so source it
before the first run. That run records the ROS 2 prefix in the workspace, so
later runs of host_ws need no sourced shell:
source /opt/ros/humble/setup.bash
nros run host_node
nros run builds the talker (the first build compiles nano-ros, a minute or
two; later builds take seconds) and runs it. It keeps running until you press
Ctrl-C. It prints:
Publishing: 'Hello World: 1'
Publishing: 'Hello World: 2'
See it in ROS 2
Leave nros run going. In a second terminal, ask ROS 2 for the topic over
Cyclone DDS:
source /opt/ros/humble/setup.bash
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
ros2 topic echo /chatter std_msgs/msg/String --qos-reliability best_effort
data: 'Hello World: …'
Both sides use domain 0, the ROS 2 default, so they find each other with no configuration. Asking for best-effort receives from a best-effort or a reliable publisher alike.
If it doesn’t work
nros runstops at once and namesAMENT_PREFIX_PATH: this shell has not sourced ROS 2, and no earlier build of the workspace recorded it. Source it and run again.ros2 topic echoprints nothing: check theRMW_IMPLEMENTATIONline, and that neither shell sets aROS_DOMAIN_IDother than 0. A firewall that drops multicast also stops DDS discovery.nros setuprefusesnativeorposix: the host board is namedlinux. The other two names are retired.- Everything else: Troubleshooting - First 10 Minutes.
Next
- The host board with zenoh, its configuration and deployment: Linux host.
- The same project on an emulated microcontroller: mps2-an385 in QEMU (bare-metal).
- The project, grown: the Tutorial.