CodeTheRobot

Ubuntu Linux for Robotics · Lesson 86 of 96

Fleet management

Running several robots, task assignment and open-source fleet software.

Estimated time · 60–90 min

Learning goals

What you will understand

  • Explain fleet management in your own words
  • Use it in a small workstation example
  • Verify the result instead of assuming it worked

Understand the idea first

The mental model

A fleet manager accepts tasks, assigns them to robots, tracks robot state and handles failures. Open-RMF is the ROS 2 framework for large systems; a small fleet can use a simple manager node with a task queue and a rule such as 'the nearest idle robot'. The robots remain autonomous: the manager only sends goals.

On Ubuntu each robot has its own namespace, computer and service, and the fleet manager runs on a server. Log every state change so a crash can resume, and monitor each robot's battery, position and heartbeat. Test with two simulated robots before real ones.

Guided lesson

Work through these steps

  1. 1.

    Open a terminal and record the current state before changing anything.

  2. 2.

    Read the fleet management commands and predict what each one does.

  3. 3.

    Run the commands one at a time and compare each output with your prediction.

  4. 4.

    Write the commands that worked in a setup note you can repeat later.

Worked example

Read it before you run it

ros2 node list | grep '^/robot'
# List the nodes of all robots (each in its own namespace).
ros2 topic echo /robot1/battery_state --once
# Read one robot's battery.
ros2 action send_goal /robot2/navigate_to_pose nav2_msgs/action/NavigateToPose "{pose: {header: {frame_id: map}, pose: {position: {x: 5.0, y: 2.0}, orientation: {w: 1.0}}}}"
# Send a goal to robot2 only.
ros2 service call /fleet/assign_task fleet_msgs/srv/AssignTask "{task_id: 'T1', pickup: 'shelf_3', dropoff: 'dock_1'}"
# Ask your fleet manager to assign a task (custom service).

What the example is doing

  1. 1.Lines without sudo only inspect or change files you own; sudo authorizes a system-wide change.
  2. 2.Read command output before moving to the next line. Stop if names, versions, disks, or paths differ from the lesson.
  3. 3.Comments beginning with # explain safety checks and are not executed by the shell.

Watch it run · Mobile robot

See what this code does

The terminal types this lesson's practice solution and runs it. The scene shows the kind of robot behaviour that code drives. It plays by itself and loops.

goalMOBILE ROBOT

Demo for Fleet management. Expected result: Only the nodes of robot2 respond

Practice code

Now type it yourself

Open a terminal, run the starter line by line (or save it as practice.sh and run bash practice.sh), and replace every TODO with your own command.

# TODO: list only the nodes whose name starts with /robot2

Expected output

Only the nodes of robot2 respond
Stuck? Show the full solution (try it yourself first)
ros2 node list | grep '^/robot2'

Expected result

How you know it worked

  • Each command completes without an unexplained error.
  • Your notes contain the command, the important output, and what it proves.

Practical exercise

Apply the lesson

Run two namespaced simulated robots, send each a goal with the CLI, then write a small manager node that assigns tasks to the nearest idle robot and logs every assignment.

Before you continue

  • You recorded the starting state
  • Every command and output is understood
  • The change can be repeated from your notes

If something goes wrong

A command says permission denied.

Check ownership and permissions first. Do not add sudo unless the command changes a documented system location.

A command or package is not found.

Check spelling, Ubuntu version, enabled repositories, and whether the previous installation command succeeded.