Exercises ========= These short hands-on tasks map to the 3-day schedule and include verification commands so students can confirm progress quickly. Exercise 1 — Hello ROS (Day 0) - Goal: run talker/listener and become comfortable with the `ros2` CLI - Steps: 1. Open a terminal and source the ROS distro and (if present) your workspace: ```bash # replace with `humble` or `jazzy` as appropriate source /opt/ros//setup.bash # if you've built a workspace in this shell, also source it: source install/setup.bash ``` 2. Run a demo publisher: `ros2 run demo_nodes_py talker` 3. In another terminal (also sourced): `ros2 run demo_nodes_py listener` - Verify: you will see messages printed by the listener and can use `ros2 topic list` / `ros2 topic echo` to inspect active topics. Exercise 2 — URDF building & visualization (Day 1) - Goal: build the robot description (URDF/XACRO), publish `robot_description`, and visualize the model in RViz - Steps: 1. Ensure workspace is built and sourced: ```bash colcon build --packages-select pendulum_description source /opt/ros//setup.bash source install/setup.bash ``` 2. Generate a URDF from the XACRO (optional check): ```bash # run from workspace root; update path if needed xacro src/pendulum_description/description/robot.urdf.xacro -o /tmp/pendulum.urdf ``` 3. Launch the URDF visualization (this publishes `robot_description`): ```bash ros2 launch pendulum_description urdf.launch.py use_rviz:=true ``` 4. Inspect topics and transforms: ```bash ros2 topic list ros2 topic echo /joint_states ros2 run rqt_graph rqt_graph ``` - Verify: RViz shows the pendulum model, `tf` frames exist, and the `joint_state_publisher_gui` (if launched) moves joints interactively. Exercise 3 — Simulator exploration (Day 2) - Goal: launch the pendulum world and inspect topics bridged from Gazebo - Steps: 1. Launch Gazebo with the pendulum world: ```bash ros2 launch pendulum_sim gazebo.launch.py ``` 2. Use the bridge config to find exact topic names and inspect: ```bash ros2 topic list ros2 topic echo /joint_states ``` - Verify: joint state messages stream and Gazebo shows the pendulum. Future / Day 3 (planned) - Once `pendulum_control` is present: implement and run a simple PID controller node, expose PID gains as parameters, and iterate tuning. Stretch tasks - Add an encoder noise model in the simulator and log results with `ros2 bag` - Implement a ROS2 action that performs a controlled swing-up routine