ROB103 · Programming Robots with Python
About Course
Write Python controllers that make simulated robots behave: read sensors, drive motors, structure behaviors as state machines, apply proportional control and log data for analysis, all in Webots.
Who it is for
Learners who know the parts of a robot and want to program robot behavior with Python.
Prerequisites
ROB102; basic Python (variables, loops, functions) is helpful but the essentials are reviewed.
What you will be able to do
- Structure a Webots Python controller with initialization, a timed control loop and clean shutdown.
- Implement reactive behaviors and a finite-state machine for a mobile robot.
- Apply a proportional controller to follow a wall or a line smoothly.
- Log robot data to CSV and analyze it with plots to tune behavior.
Lessons
- Lesson 1 · Python controllers and the control loop
- Lesson 2 · Behaviors and state machines
- Lesson 3 · Feedback control, logging and tuning
- Lesson 4 · Lab and assignment
Lab: A wall-following delivery robot with a state machine
You program an e-puck in Webots to leave a docking area, find a wall, follow it at a set distance with a proportional controller and stop at a marked delivery zone. The controller is organized as a state machine, logs every step to CSV and is tuned by analyzing the plotted error.
Free tools: Webots (free) with its Python controller API; VS Code (free) optional; Google Colab or local matplotlib for plots
Assessed assignment
Submit your controller code, the CSV logs and a plot comparing the three Kp values. Include a state diagram that shows every state and transition condition. Explain how you chose Kp and what happened when it was too low and too high. Describe one failure case you observed (for example a corner or a gap in the wall) and how you changed the state machine to handle it.
| Criterion | Weight | What excellent work looks like |
|---|---|---|
| Working behavior | 30% | The robot leaves the dock, follows the wall and stops at the delivery zone reliably over several runs. |
| State machine design | 25% | States and transitions are clearly defined, documented in a diagram and implemented cleanly. |
| Control tuning and analysis | 25% | Plots compare gains, the chosen Kp is justified and over- and under-tuning effects are explained. |
| Code quality | 20% | Code uses functions, named constants, comments and consistent logging. |
Portfolio piece
A reusable, well-structured Python robot controller with a state diagram and tuning analysis.
Next step
Continue with ROB104 · Kinematics and Motion Basics · 6 hours · $42.00
Course Content
ROB103 · Programming Robots with Python (6 h)
-
Lesson 1 · Python controllers and the control loop
-
Lesson 2 · Behaviors and state machines
-
Lesson 3 · Feedback control, logging and tuning
-
Lesson 4 · Lab and assignment
-
ROB103 Assessment · Programming Robots with Python
