Practice
Write it, compile it, prove it.
Every exercise below opens a workbench: guided steps, starter code, the exact output your program must produce, and automatic checks. Your C++ is compiled with a real GCC toolchain, not simulated. ROS 2 exercises add a terminal transcript so you can see what the same work looks like on Ubuntu.
C++ Beginner
Language core: types, control flow, containers, classes and tests.
- 01
Toolchain & first build
Compile and run your first program, and print one line exactly.
Open workbench - 02
Types, values, conversions
Convert degrees to radians and show what an explicit narrowing cast does.
Open workbench - 03
Control flow & functions
Write a clamp function and apply it to a list of joint targets.
Open workbench - 04
Vectors & strings
Store joint names in a std::vector and print them with a one-based index.
Open workbench - 05
Structs & classes
Build a Joint class with private data and a const query method.
Open workbench - 06
References & pointers
Change a value through a reference and guard a pointer before using it.
Open workbench - 07
Standard algorithms
Sort torque samples, sum them and find the peak with the standard library.
Open workbench - 08
Debugging & first tests
Write a tiny test harness that proves a range check behaves correctly.
Open workbench
C++ Intermediate
Ownership, moves, templates, threads and build boundaries.
- 01
Object lifetime & RAII
Enable and disable a motor from a constructor and destructor so it can never leak.
Open workbench - 02
Smart pointers
Own a device with std::unique_ptr and release it deliberately.
Open workbench - 03
Copy, move, rule of five
Show the difference between copying and moving a buffer.
Open workbench - 04
Templates & concepts
Write one interpolator that serves scalars and 2D points.
Open workbench - 05
Error handling strategies
Return an optional instead of throwing for an expected parsing failure.
Open workbench - 06
Threads & synchronisation
Increment one counter from two threads without losing updates.
Open workbench - 07
Performance & memory layout
Reserve capacity up front so a hot loop stops reallocating.
Open workbench - 08
Build systems at scale
Separate an interface from its implementation using a namespace boundary.
Open workbench
C++ Advanced
Determinism, arenas, lock-free paths and compile-time safety.
- 01
Real-time constraints
Run a fixed-step loop and count deadline misses instead of drifting.
Open workbench - 02
Custom allocators & pools
Hand out memory from a fixed arena with no heap traffic.
Open workbench - 03
Lock-free data structures
Complete a single-producer single-consumer ring buffer.
Open workbench - 04
Compile-time unit safety
Make a wrong unit a compile error and keep the maths constexpr.
Open workbench - 05
Architecture & interfaces
Drive two controller implementations through one abstract interface.
Open workbench - 06
Sanitizers & bounds discipline
Fix an off-by-one loop that a sanitizer would flag as a buffer overrun.
Open workbench - 07
Latency instrumentation
Bucket loop latencies into a histogram and report deadline misses.
Open workbench - 08
Capstone: motion pipeline
Wire planner, interpolator and driver into one deterministic pipeline.
Open workbench
ROS 2 Labs
One exercise per lab, with a simulated ROS 2 terminal beside it.
- 01
Verify a ROS 2 Lyrical install
Write the environment check that tells a learner whether their shell is really sourced.
Open workbench - 02
Prove the overlay wins
Decide whether ~/robot_ws is ahead of /opt/ros/lyrical on the search path.
Open workbench - 03
First node class
Write the node constructor that announces itself the way rclcpp does.
Open workbench - 04
Publisher and subscriber
Connect a timer-driven publisher to a subscriber callback.
Open workbench - 05
Action feedback and result
Produce decreasing feedback and a final result for a motion goal.
Open workbench - 06
Validate a parameter on set
Accept a loaded parameter only when it is inside the declared safe range.
Open workbench - 07
Compose a transform chain
Add two link offsets for the special case where both transforms have identity rotation.
Open workbench - 08
Controller lifecycle
Walk a controller through the states controller_manager requires before motion.
Open workbench