Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Turtle Square Controller

A ROS2 action server that moves a turtlesim turtle in a perfect square pattern using precise proportional control.

Overview

This project implements a ROS2 action server that controls a turtlesim turtle to draw precise squares.

Installation & Build

  1. Clone/Navigate to workspace:

    cd ~/projet
  2. Build the packages:

    colcon build
  3. Source the workspace:

    source install/setup.bash

Running the System

Terminal 1: Start Turtlesim

ros2 run turtlesim turtlesim_node

Terminal 2: Start the Action Server

source ~/projet/install/setup.bash
ros2 run turtle_square_controller draw_square_action_server

Terminal 3: Send Action Goals

Basic usage:

ros2 action send_goal /draw_square turtle_square_interfaces/action/DrawSquare "{side_length: 2.0, speed: 1.0}"

With feedback:

ros2 action send_goal --feedback /draw_square turtle_square_interfaces/action/DrawSquare "{side_length: 2.0, speed: 1.0}"

Different sizes and speeds:

# Small fast square
ros2 action send_goal /draw_square turtle_square_interfaces/action/DrawSquare "{side_length: 1.0, speed: 2.0}"

# Large slow square
ros2 action send_goal /draw_square turtle_square_interfaces/action/DrawSquare "{side_length: 3.0, speed: 0.5}"

# Medium square
ros2 action send_goal /draw_square turtle_square_interfaces/action/DrawSquare "{side_length: 2.5, speed: 1.5}"

Interface Specification

Implementation Details

The controller:

  1. Subscribes to /turtle1/pose to monitor the turtle's position
  2. Publishes to /turtle1/cmd_vel to control velocity
  3. Uses MultiThreadedExecutor to process pose updates while executing movements
  4. Applies proportional control for both:
    • Forward movement: linear.x = min(Kp × distance_error, max_speed)
    • Rotation: angular.z = min(Kp × angle_error, max_speed)

Research Reference

This implementation is inspired by:

"Overshoot Avoiding Control for Rigid Robots" by Figen Özen

https://www.researchgate.net/publication/380674353_Overshoot_Avoiding_Control_for_Rigid_Robots/link/667fde34714e0b0315338c26/download?_tp=eyJjb250ZXh0Ijp7ImZpcnN0UGFnZSI6InB1YmxpY2F0aW9uIiwicGFnZSI6InB1YmxpY2F0aW9uIn19

The paper introduces OACA (Overshoot Avoiding Control Algorithm), which combines:

  • Proportional-Derivative (PD) control
  • Constant Error Acceleration
  • Overshoot prevention through proportional speed reduction

Our implementation simplifies this to pure proportional control (P-control) which is sufficient for turtlesim's 2D environment and eliminates overshoot entirely.

Authors

  • OUBRAHAM Maya
  • SADI Mohamed Mouaad
  • SAMIR Yassine
  • SEKOUANE Amel

License

Apache-2.0

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages