Drive Square Shape
Objective
Create your own implementation that makes the Foxy robot drive in a square shape.

cd ~/foxy_ws && source install/setup.bash
ros2 launch foxy_bringup start.launch.py sim/world_name:=emptyTask
Program the robot to:
Drive along four straight sides.
Make four 90-degree turns.
Complete a square measuring 1 metre × 1 metre.
Stop after completing the square.
Finish approximately at its starting position and orientation.
You are responsible for designing, implementing, and testing your own solution. Experiment with your approach, observe the robot's movement, and refine your implementation until it meets the requirements.
Useful Hint
Inspect the System Overview, especially the Control and Movement section. The topics listed there may help you control the robot and evaluate its movement.
Use the following topic to control the robot:
/[namespace]/diff_drive_base_controller/cmd_vel_unstampedThis topic uses the geometry_msgs/msg/Twist message type. Replace [namespace] with the namespace assigned to your robot, for example:
/foxy/diff_drive_base_controller/cmd_vel_unstampedDecide for yourself how to generate the required square trajectory and how to use the available topics to verify your result.
Accuracy Requirement
Each side should have a target length of 1.00 metre, with a maximum permitted error is ±10 cm for every side.
No side may exceed this tolerance in the worst case.
Success Criteria
The task is complete when:
- The robot follows a recognizable square path.
- All four sides are within the permitted 0.90–1.10 m range.
- The robot performs four turns of approximately 90 degrees.
- The robot completes the path without manual movement or correction.
- The robot stops safely after completing the square.
- The robot finishes close to its starting pose.
Challenge
Develop the solution independently. Test it in a safe environment, evaluate the result, and improve it until the robot completes the square reliably.