← Back to search

For robotics teachers: ROS2 Basic Motion — Square Path in C++ | Open Class #13

The Construct Robotics Institute 42:00

204 views · 8 likes Watch on YouTube ↗

Every mobile robot needs a reliable foundation of motion control — moving straight, turning precisely, and pausing safely when obstacles appear.

This robotics project shows you how to write a ROS 2 C++ node that drives a robot (FastBot Pro from BotBox robotics Lab Kit)through a perfect square by repeating a two-phase forward-then-turn cycle four times, publishing velocity commands on the robot's command topic via a timed control loop. The node also monitors the LiDAR feed, watching the forward window for obstacles and pausing the robot whenever something gets too close — shutting down cleanly after the fourth turn.

You will learn:

✅ Publishing velocity commands to a robot through a timed control loop in C++
✅ Implementing a forward/turning finite state machine driven by wall-clock timing
✅ Subscribing to a LiDAR topic and extracting range readings from the forward window of a 360° scan
✅ Integrating obstacle detection to pause and resume motion safely, then shutting the node down once the square is complete


📁 *ROS project link: https://app.theconstruct.ai/l/720b9e2d/
🤖️ *Robot & Warehouse Environment Used: BotBot Robot Lab https://www.theconstruct.ai/botbox-warehouse-lab/

Related courses:
* C++ for Robotics (Free): https://app.theconstruct.ai/courses/c-for-robotics-59/
* ROS2 Basics in 5 Days (C++): https://app.theconstruct.ai/courses/ros2-basics-in-5-days-c-325/
* ROS2 Navigation: https://app.theconstruct.ai/courses/ros2-navigation-humble-148/


============================

[For Robotics Teachers Open Class], a weekly series of videos by The Construct Robotics Institute, aims to make robotics education easier by helping teachers teach a wide range of robotics topics through hands-on practice.

Each session provides a ROS-based project (referred to as ROSJECTs 🦾 📁) for all attendees, including notebooks, code, and robot simulations. Led by ROS expert Desire, you'll see how robotics teaching and hands-on practice come together in real time.

*Missed a session? Find recordings & ROSJECTs on https://app.theconstruct.ai/open-classes/*

We're excited to share this series with you! If you have questions or want to explore new topics, drop us a comment below.

Cheers.

*The Construct Robotics Institute | Where Your Robotics Career Happens*

============================

👨‍🏫 Class Creator: Desire (ROS Tutor @The Construct Robotics Institute )
👩‍💻 Class cover designer: Sonia/Ruojun Wang (Marketing @The Construct Robotics Institute )

--
#ai #Robotics #ros #robot #ros2

Playback is via YouTube's official embedded player. Data from YouTube; Exumo is not affiliated with YouTube.