← Back to search

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

The Construct Robotics Institute 42:00

420 views · 18 likes Watch on YouTube ↗

Every mobile robot needs a reliable foundation of motion control before it can tackle complex tasks. In a real warehouse environment, a robot must be able to navigate predictably — moving straight, turning precisely, and stopping safely when obstacles appear.

This project commands a real robot to trace a perfect square by combining timed straight-line motion with timed 90° turns, publishing velocity commands on the correct topic using twist messages driven by a 20 Hz wall-timer. At the same time, the node continuously monitors the LiDAR feed on the scan topic to detect obstacles in the forward window, pausing the robot whenever anything comes within 0.25 m — giving your robot its first taste of reactive, safety-aware motion.

You will learn:

✅ Publishing velocity commands to a robot using a timed control loop in C++
✅ Implementing a finite state machine by wall-clock timing.
✅ Subscribing to a LiDAR topic and processing scan data to extract range readings from a specific angular window
✅ Integrating obstacle detection into a motion sequence to pause and resume navigation safely

📁 *ROS project link: https://app.theconstruct.ai/l/7210418c/
🤖️ *Robot Used: BotBot: 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/
* Advanced Modern C++ for Robotics: https://app.theconstruct.ai/courses/advanced-modern-c-for-robotics-94/


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

[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.