Skip to content

Project #3: Mathematics for mobile Robotics

Muhammad Luqman edited this page Jul 25, 2023 · 5 revisions

Issue Link #3

Project Overview

This ROS2 project demonstrates the application of mathematics in mobile robotics by controlling a TurtleBot3 robot in a Gazebo environment. The project includes nodes for calculating acceleration, moving the robot in a circular path, and making the robot move to a specific goal in the x-y plane.

Installing Dependencies

  • sudo apt install ros-humble-gazebo-ros-pkgs
  • sudo apt-get install ros-humble-turtlebot3-gazebo

Running the Project

  • Clone the repository into your ROS2 workspace (if not done already) using:
    git clone -b running_projects https://github.com/Robotisim/mobile_robotics_ROS2.git
    
  • Build your workspace and source it by running the following command (assuming you are in the workspace root directory):
    colcon build && source install/setup.bash
    
  • Export turtlebot3 model
    export TURTLEBOT3_MODEL=waffle_pi
    
  • Run complete project
    ros2 launch drive_tb3 p3_a_maths.launch.py
    

Nodes

This project includes a node for driving the TurtleBot3 robots.

  • p3_a_acceleration : This node calculates the acceleration of the TurtleBot3 robot based on the change in linear velocity and publishes geometry_msgs::msg::Twist messages to the cmd_vel topic. The linear velocity can be specified by the linear_velocity parameter, which defaults to 2.0.

  • p3_b_angular_velocity : This node calculates the angular velocity required for the TurtleBot3 robot to move in a circular path of a specified radius, given a specific linear velocity. It publishes geometry_msgs::msg::Twist messages to the cmd_vel topic. The linear velocity and radius can be specified by the linear_velocity and radius parameters, respectively.

  • p3_d_xy_goal : This node controls the TurtleBot3 robot to move to a specific goal in the x-y plane. It calculates the errors in position and orientation, and uses a proportional controller to calculate the required linear and angular velocities. It publishes geometry_msgs::msg::Twist messages to the /cmd_vel topic.

Launch Files

  • p3_a_maths.launch.py : This launch file starts a Gazebo simulation, runs the rqt_reconfigure node for dynamic reconfiguration of parameters, and starts the p3_d_xy_goal node. The goal x and y coordinates and the proportional gain for the controller can be specified in the rqt_reconfigure GUI.

Learning Outcomes

  • How to calculate acceleration in a ROS2 node.
  • How to calculate angular velocity for circular motion in a ROS2 node.
  • How to control a robot to move to a specific goal using a proportional controller in a ROS2 node.