Choose services, actions, and behavior states

Choose the right interface for a stream, a quick request, or a cancelable task.

Exercise brief·Beginner·3 min read

Opening the Python editor…

Requirements and learning goals

Before you start

  • The learn-go2 simulator from lesson 1
  • Familiarity with ROS 2 topics

You will be able to

  • Choose the right interface for a stream, a quick request, or a cancelable task.

The browser exercise above works without extra setup. The project brief below assumes the listed prerequisites and gives you a task and checks to perform. Need a guided first project?

Streams, requests, and goals

A continuously distributes messages, such as camera frames. A service answers a request, such as reading a setting. An action represents a longer task, such as navigating to a location, with progress and cancellation.

Choosing the right interface saves you from inventing a separate progress and stop protocol. A navigation goal being accepted means the server will attempt it, not that the robot has arrived.

Rendering diagram…
An action over time. "Accepted" means the server will attempt the goal, not that the robot has arrived.
Checkpoint 1 of 2

Your app must send a robot to its charging dock. The move takes about a minute, the app shows progress, and the user can abort it. Which interface fits?

Commit to an answer. Every choice explains itself.

Existing service and action servers work through their normal interfaces. These remote commands do not require replacing servers with a platform-specific API.

Try cancellation in the navigation simulator exercise, then confirm the observed motion stopped rather than trusting the request acknowledgment.

Read a setting through a service

Keep the shared Go2 simulator running. List its services and . Choose learn-go2 in the Simulator tab whenever the device picker opens.

wendy device ros2 services
wendy device ros2 nodes

Find a listed /NODE/get_parameters service. Substitute its actual path below. Standard parameter services use this type:

wendy device ros2 call /NODE/get_parameters rcl_interfaces/srv/GetParameters '{names: [use_sim_time]}'

Expect a parameter value in the response. An unset value means that node has not declared that parameter. use_sim_time selects the ROS simulation clock. Keep it false on this Go2 runtime, which timestamps observations using its wall clock.

Inspect a longer task

wendy device ros2 action list

An empty list is expected when only the stock Go2 runtime is running. You have completed this check; do not try sending /navigate_to_pose to this VM. The navigation lesson installs a separate simulator for sending and canceling goals. The distinction matters: a robot publishing sensor topics does not necessarily provide a navigation action.

Make the outcome visible

Represent your app's task as idle, executing, succeeded, failed, or canceled. Show which state it reached. Decide whether a second request is rejected, queued, or replaces the first.

Checkpoint 2 of 2

In the browser exercise the action reaches succeeded at step 6. You set cancel_at = 7, so the cancel arrives one step later. Which terminal state is reported?

Commit to an answer. Every choice explains itself.

A behavior tree organizes tasks and recovery branches. Each task still needs a clear completion and cancellation rule. For a hackathon, a small explicit state machine is often enough.

Can you do each of these?

  • Choose the right interface for a stream, a quick request, or a cancelable task.

0 of 2 checkpoints solved. Try checkpoint 1

Previous: Understand coordinate frames and transforms
All lessons in this topic
  1. 1. ROS 2 nodes, topics, and QoS
  2. 2. Understand coordinate frames and transforms
  3. 3. Choose services, actions, and behavior states
  4. 4. Estimate motion and compare it with commands
  5. 5. Separate mapping, localization, and navigation

Ask Wendy

Answers about Wendy and WendyOS

What would you like to know?

Ask about devices, development, and deployment.

Check linked docs for technical details.