Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mpcTracking

Background

MPC(Model predictive control) is widely used in robotics. this work uses MPC for path tracking of a two-wheeled differential cart in a simulation environment, and it is made to adapt to any path.

this work is based on turtle3(which support simulation sources) and osqp-eigen, you may get more infomation in their website. Btw if you are new for MPC, you should learn it quickly in Model Predictive Control(but please note the difference between models), after that you may understand how it works. There is other site teach you how to cast MPC to QP with osqp-eigen.

Install

for you to be able to use this work correctly, please note the following points:

  • it only work on ubuntu20.04, with ros-noetic-fulldesktop.
  • ensure download all submoudles correctly
  • ensure your osqp-eigen lib is installed properly
  • check all the path(noetic path,lib path and so on)

It is easy to configuration environment, you can find comprehensive and correct installation guide in their Github Page or stackflow.

Usage

How to use it?

task1 is a simple work to test your env is right. It is implemented to allow the cart model to travel to a set position, which is, of course, entered by the keyboard,with a simple pid controller. Just run it to test.

    $ export TURTLEBOT3_MODEL=burger
    $ roslaunch task1_pkg turtle3_test.launch

About task2, there is currently no launch file to start all nodes automatically for some reason, you may need to do this manually, follow these steps:

  1. go to the main folder

     $ cd path/to/work
    
  2. maybe you should re-build it

     $ catkin_make
    
  3. import the model name, and start up Gazebo,you could try other model like waffle,but it means you should modify the code to support different robot model.

     $ export TURTLEBOT3_MODEL=burger
     $ roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch
    
  4. start up Rviz

     $ rviz -d ./src/task2_pkg/rviz/mpctracking.rviz
    
  5. start mpc control node, and you may get some INFO in screen, and model will move.

     $rosrun task2_pkg control
    

How to redevelop it?

For simple redesign, you only need pay attention to creatPath() in control_node.cpp, setWeightMatrices() and setInequalityConstraints() in mpc.cpp. it is very easy to resetting the path and adjusting the parameters of the controller.

Maintain

Yilgrimage

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages