Giter Site home page Giter Site logo

turtlebot3_cpp's Introduction

TUTLEBOT3 using simple MPC without constrains

This header file contains a class called turtlebot3_MPC that implements a simple Model Predictive Controller (MPC) for the TurtleBot3 robot. The MPC is used to control the robot's velocity and orientation to follow a given trajectory. The class controller also includes a Proportional-Integral-Derivative (PID) component for compare the robot's motion.

Dependencies

  • eigen3: a C++ template library for linear algebra.
  • rclcpp: the ROS 2 C++ client library.
  • std_msgs: a ROS 2 package for standard message definitions.
  • geometry_msgs: a ROS 2 package for geometry-related message definitions.
  • nav_msgs: a ROS 2 package for navigation-related message definitions.
  • sensor_msgs: a ROS 2 package for sensor-related message definitions.

Installation

  1. Clone the repository to your ROS2 workspace:
    cd ~/your_ros2_ws/src`
    git clone https://github.com/JuanCarlos-TiqueRangel/turtlebot3_cpp.git
    
  2. Build the package:
    cd ~/your_ros2_ws
    colcon build --packages-select turtlebot3_cpp
    

Member Functions

The turtlebot3_MPC class has the following member functions:

double simple_MPC(double w, double yaw, double ref)

  • A simple model predictive control (MPC) function that controls the robot's movement.
  • Takes three arguments:
    • w - Desired angular velocity of the robot.
    • yaw - Current orientation of the robot in radians.
    • ref - Desired orientation of the robot in radians.
  • Returns the control action uk_mpc. This control tecnique comes from the MPC strategy from Predictive Control With Constraints: MacIejowski book. Also there is a related paper of a real implementation in a skid-steering robot here.

double simple_PID(double error)

  • A simple proportional-integral-derivative (PID) function that controls the robot's movement.
  • Takes one argument:
    • error - Error in the orientation of the robot.
  • Returns the control action uk_pid.

Future Work

constraints and MIMO controller will be add.

Notes

  • This file assumes that the robot is using ROS2 as the middleware.
  • This file has been tested with the TurtleBot3 robot platform.

License

This code is released under the MIT License. Feel free to modify and use it in your own projects.

turtlebot3_cpp's People

Contributors

juancarlos-tiquerangel avatar

Stargazers

离弦 avatar Yaozhong Kang avatar  avatar Niccolo Dejito avatar Nektarios avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.