Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
LLM Agents for ROS 2 Robots: Local Models, MCP, Safety
New
1 students

LLM Agents for ROS 2 Robots: Local Models, MCP, Safety

Connect a local LLM to a ROS 2 robot through MCP, then measure, constrain and test it.
Last updated 11/2026
English
English

What you'll learn

  • Expose ROS 2 topics, services and actions to a local LLM as MCP tools (mcp 2.x).
  • Design tools the model gets right: skills over raw velocity, units, actionable errors.
  • Score every run from the robot's true pose and path, with Wilson intervals, never from the model's reply.
  • Drive Nav2 in a headless simulation through MCP, with cancel and timeouts.
  • Enforce safety in the server: geofence, two-sided speed limits, human approval, audit log, kill switch.
  • Measure prompt injection through robot data, and defend with typed fields, provenance and action guards.

Course content

8 sections • 36 lectures • 1h 58m total length
  • 1.1 How to follow this course4:00
  • 1.2 Setup and verify: PASS means it really answers3:20
  • 1.3 MCP on the wire: the real JSON-RPC lines3:22
  • 1.4 Your first MCP server: get_pose and drive3:06
  • 1.5 The environment trap: Connection closed3:06
  • 1.6 The mcp 2.x rename: FastMCP is now MCPServer3:08

Requirements

  • Python, and basic ROS 2: nodes, topics, services, actions.
  • Ubuntu 24.04 with ROS 2 Jazzy, and Ollama. Every check script runs without a GPU or the model; an NVIDIA GPU makes re-recording model trials faster.
  • About 6 GB of free disk (measured in lecture 1.1: models, course files, ROS 2, Gazebo and Nav2).

Description

This course contains the use of artificial intelligence. The narration is a synthetic voice; every number on screen comes from a lab you can run.

36 lectures, about 2.0 hours. Each lecture has a folder with the working code, a broken copy with one classic mistake, and a check script that passes only when the fix works and the mistake is caught.

What was measured, with a small local model (qwen2.5:3b) on one laptop GPU. Your numbers may differ by a few trials:

- Tool design: raw velocity tools reached the target 0 of 20 times; a go_to skill tool, 15 of 20 (95% interval 0.53 to 0.89). Lecture 3.2.
- Safety: a keep-out rule written only in the prompt was broken in 13 of 20 trials; the server-side fence, 0 of 20, at a measured cost: it also stopped 7 of 7 targets whose straight path crossed the zone. Lecture 6.1.
- Capstone: a 3-waypoint patrol completed 19 of 20 times, scored from the robot's true path. Lecture 8.1.
- Choosing a model: a smaller model completed 0 of 20 missions while saying DONE every time. Lecture 8.2.

What this course does not cover: real robots (everything runs in turtlesim and a simulated TurtleBot), frontier or cloud models, vision language action models, fine-tuning, manipulation with MoveIt, multi-robot fleets.

Who this course is for:

  • Robotics engineers who want LLM agents on their robots, measured instead of demoed.
  • AI engineers who want to connect agents to real control loops safely.
  • Not for complete beginners to Python or ROS 2, and not a course about training models.