tower-broadcastROS2 Communication & Tools

Master ROS2 topics, services, and essential debugging tools


Tutorial Overview

🎯 Learning Objectives

By the end of this tutorial, you will:

  • βœ… Understand ROS2 communication paradigms (topics, services, actions)

  • βœ… List and inspect topics, services, and nodes

  • βœ… Publish and subscribe to topics from command line

  • βœ… Call services to control robot

  • βœ… Use rqt tools for visualization and debugging

  • βœ… Record and playback data with rosbags

  • βœ… Debug communication issues

  • βœ… Understand message types and interfaces

⏱️ Time Required

  • Reading & Concepts: 25 minutes

  • Command Line Tools: 30 minutes

  • RQT Tools: 25 minutes

  • Rosbag Practice: 20 minutes

  • Debugging: 15 minutes

  • Total: ~115 minutes

πŸ“š Prerequisites

  • βœ… Completed Getting Started

  • βœ… Robot powered on and connected

  • βœ… SSH access to robot

  • βœ… Basic Linux command line knowledge

  • βœ… Understanding of terminal navigation

πŸ› οΈ What You'll Need

  • βœ… Beetlebot (powered on, base system running)

  • βœ… Laptop with ROS2 Jazzy installed

  • βœ… Both robot and laptop on same WiFi network

  • βœ… Terminal access (SSH to robot or direct)


Part 1: ROS2 Communication Paradigms

Topics (Publish-Subscribe)

What are topics?

  • Continuous data streams

  • Many-to-many communication

  • Publishers send data, subscribers receive

  • Asynchronous (fire-and-forget)

Example:

When to use:

  • Sensor data (LiDAR, camera, IMU)

  • Status updates (battery, position)

  • Continuous streams (video, telemetry)


Services (Request-Response)

What are services?

  • One-time request-response

  • Synchronous (wait for response)

  • Client sends request, server responds

  • Like function calls

Example:

When to use:

  • Commands (ARM, DISARM, emergency stop)

  • Queries (get parameter, check status)

  • One-time actions


Actions (Goal-Based)

What are actions?

  • Long-running tasks with feedback

  • Can be cancelled

  • Provides progress updates

  • Goal β†’ Feedback β†’ Result

Example:

When to use:

  • Navigation goals

  • Long tasks (mapping, complex motions)

  • Need progress updates or cancellation


Part 2: Exploring Your Robot's Topics

List All Topics

Your robot has these key topics:


Get Topic Information


Exercise 2.1: Topic Discovery

Task: Identify all sensor topics and their rates

chevron-rightExpected Answershashtag
  1. Highest rate: IMU (~100 Hz) - fast dynamics, needs high sampling

  2. Lowest rate: Battery (~1-10 Hz) - slow changing, doesn't need frequent updates

  3. Rate differences: Based on sensor physics and application needs

    • LiDAR: 10 Hz (motor rotation speed)

    • IMU: 100 Hz (capture fast dynamics)

    • Odometry: 20-30 Hz (control loop rate)

    • Battery: 1-10 Hz (slow changing)


Part 3: Reading Topic Data

Echo Topics (View Live Data)


Exercise 2.2: Understanding Sensor Data

Task: Examine different sensor message formats

LiDAR data:

IMU data:

Odometry data:


Part 4: Publishing to Topics

Understanding Message Structure

First, see what a message looks like:

For differential drive (Beetlebot):

  • linear.x: Forward/backward speed (m/s)

  • angular.z: Turn rate (rad/s)

  • Other fields unused (can't strafe sideways or fly!)


Publishing Commands

⚠️ CRITICAL: Command Timeout

Your robot has a 500ms command timeout. Commands must be published continuously (at least 2 Hz) or the robot will automatically DISARM and stop.

❌ THIS WILL NOT WORK:

βœ… THIS WORKS:


Exercise 2.3: Manual Robot Control

Task: Drive robot using command line

Test 1: Forward motion

Test 2: Rotation

Test 3: Arc motion

Test 4: Using timeout command


Part 5: Services

List Available Services


Calling Services

ARM/DISARM robot:


Check Service Type and Interface


Exercise 2.4: Service Control Flow

Task: Test ARM β†’ Drive β†’ DISARM sequence

What you learned:

  • Robot automatically DISARMs after 500ms without commands

  • Must continuously publish commands to maintain motion

  • Services provide control over robot state


Part 6: Understanding the Communication Graph

Using rqt_graph

Visualize node connections:

What you'll see:

[PLACEHOLDER: Screenshot of rqt_graph showing Beetlebot nodes]


Exercise 2.5: Trace a Command

Task: Follow /cmd_vel from joystick to motors

chevron-rightAnswershashtag
  1. 3 nodes: joy_node β†’ teleop_twist_joy_node β†’ cmd_vel_gate β†’ lyra_bridge

  2. Robot stops: cmd_vel_gate provides safety (ARM check, limits), without it, no commands reach motors

  3. Multiple sources: /cmd_vel_joy (joystick), /cmd_vel_nav (autonomous), /cmd_vel (keyboard/manual) all merge into single /cmd_vel topic via multiplexer


Part 7: Recording and Playback (rosbag)

Recording Data

Record specific topics:

Record all topics:

Record with compression:


Playback Data

Play recorded bag:


Exercise 2.6: Record and Analyze

Task: Record driving session, analyze offline

Recording:

Analysis:


Part 8: RQT Tools

rqt_plot (Time Series)

Plot data over time:

Add topics to plot:

[PLACEHOLDER: Screenshot of rqt_plot showing odometry]


rqt_image_view (Camera)

View camera stream:


rqt_console (Logs)

View system logs:


rqt_topic (Topic Monitor)

Monitor multiple topics:


Exercise 2.7: Multi-Tool Monitoring

Task: Monitor robot with multiple tools

Setup:

Observe:

  • rqt_plot shows position changing

  • rqt_console shows any warnings/errors

  • rqt_topic shows bandwidth and rates


Part 9: Troubleshooting Communication

Problem: Topic Not Publishing

Symptoms: ros2 topic hz /scan shows nothing

Debug steps:


Problem: Can't Send Commands

Symptoms: Robot doesn't respond to /cmd_vel

Debug steps:


Problem: Services Not Responding

Symptoms: Service call hangs or fails


Part 10: Knowledge Check

Concept Quiz

  1. What's the difference between topics and services?

  2. Why must cmd_vel be published continuously?

  3. What does /odometry/filtered provide that /wheel/odom doesn't?

  4. When would you use rqt_graph?

  5. What information does rosbag store?


Hands-On Challenge

Task: Record, analyze, and report driving behavior

Requirements:

  1. Record 60-second driving session with:

    • /scan

    • /odometry/filtered

    • /imu/data

    • /cmd_vel

    • /battery_voltage

  2. Include in recording:

    • Forward motion

    • Rotation in place

    • Arc motion

    • Full stop

  3. Analyze recording:

    • Maximum linear velocity achieved

    • Maximum angular velocity achieved

    • Total distance traveled (from odometry)

    • Battery voltage drop

    • Any anomalies (gaps, errors)

  4. Create report:

    • Bag file statistics

    • Plots of key data (position, velocity)

    • Summary of findings

    • Recommendations


Part 11: What You've Learned

βœ… Congratulations!

You now understand:

Communication Basics:

  • βœ… Topics, services, and actions

  • βœ… When to use each paradigm

  • βœ… Publish-subscribe architecture

Command Line Tools:

  • βœ… Listing and inspecting topics/services/nodes

  • βœ… Publishing to topics (with correct --rate!)

  • βœ… Calling services

  • βœ… Reading topic data

Robot Control:

  • βœ… ARM/DISARM mechanism

  • βœ… Velocity command structure

  • βœ… Command timeout (500ms)

  • βœ… Safety systems

Debugging:

  • βœ… rqt_graph visualization

  • βœ… rosbag recording/playback

  • βœ… rqt tools (plot, console, topic)

  • βœ… Common issues and solutions


Next Steps

🎯 You're Now Ready For:

Immediate Next: β†’ Robot Simulation with Gazebo - Test safely in simulation

Hardware Tutorials: β†’ Sensor Data Visualization - Deep dive into sensor topics β†’ Teleoperation Control - Advanced driving techniques

Advanced Topics:

  • Custom node development (Python/C++)

  • Message type creation

  • Action servers/clients

  • Parameter management


Quick Reference

Essential Commands


Key Topics Reference

Topic
Type
Rate
Purpose

/cmd_vel

Twist

10 Hz

Main velocity control

/scan

LaserScan

10 Hz

LiDAR data

/odometry/filtered

Odometry

30 Hz

Fused position (EKF)

/wheel/odom

Odometry

20 Hz

Wheel-only position

/imu/data

Imu

100 Hz

IMU filtered

/battery_voltage

Float32

1-10 Hz

Battery status

/joy

Joy

50 Hz

Joystick input

/pi_camera/image_raw/compressed

CompressedImage

30 Hz

Camera stream


Important Services

Service
Type
Purpose

/lyra/arm

Trigger

Enable motors

/lyra/disarm

Trigger

Disable motors

/lyra/emergency_stop

Trigger

Emergency stop


Completed ROS2 Communication & Tools! πŸŽ‰

β†’ Continue to Robot Simulation with Gazebo β†’ Or return to Tutorial Index


Last Updated: January 2026 Tutorial 2 of 11 - Beginner Level Estimated completion time: 115 minutes

Last updated