Documented target: Ubuntu 24.04 · ROS 2 Jazzy · Gazebo Harmonic where used. Browser labs tested; ROS/Ubuntu/hardware execution not performed here.
What you will understand
- Inspect a message type.
- Publish and echo data.
- Diagnose QoS mismatches.
Prerequisites: Nodes, packages and workspaces and its stated environment.
The idea, made clear.
A topic carries a typed stream. Publishers send without directly calling a chosen subscriber. A topic name is not its data contract: inspect the message definition before consuming it. Structured messages communicate units and geometry better than undocumented text.
Quality of Service settings describe reliability, durability and retained history. They do not guarantee correct sensor readings. A reliable subscriber may be incompatible with a best-effort publisher. Inspect endpoint settings when a topic exists but no data reaches your callback.
Use descriptive names and namespaces so several robots cannot accidentally share commands. Start with a String exercise, then choose standard sensor or geometry messages for real observations. Validate timestamps and frames as well as payload values.
Try it, step by step.
Inspect String
Read the fields first.
ros2 interface show std_msgs/msg/StringExpected: A string data field.
Send one sample
Quote the YAML request.
ros2 topic pub --once /nexviora/status std_msgs/msg/String "{data: ready}"Expected: One published sample.
Watch a stream
Use separate sourced terminals.
ros2 topic pub --rate 2 /nexviora/status std_msgs/msg/String "{data: learning}"
# Other terminal:
ros2 topic echo /nexviora/status
ros2 topic info /nexviora/status --verboseExpected: Repeated samples and endpoint QoS information.
If something goes wrong
- No samples
- Check topic spelling, type, domain ID and QoS.
- Invalid payload
- Use fields from interface show and valid YAML quoting.
Check your understanding
Make it yours
Compare a publisher with two subscribers in the lab and in ROS.
Optional progress stays in this browser. No account needed.
Go to the source documentation
Commands are educational examples for the stated environment, not a transcript of local ROS execution. Verify actual behavior on your machine.