GithubHelp home page GithubHelp logo

macstepien / furuta_pendulum Goto Github PK

View Code? Open in Web Editor NEW
34.0 5.0 6.0 103.59 MB

LQR, MPC and DRL approaches to control the Furuta pendulum.

License: GNU General Public License v3.0

Dockerfile 0.03% CMake 0.14% Jupyter Notebook 96.35% Python 0.61% C++ 2.87% C 0.01%
control inverted-pendulum robotics ros

furuta_pendulum's Introduction

Furuta Pendulum

LQR, MPC and RL approaches to control the Furuta Pendulum.

Packages in this repository can be divided into two subgroups:

  1. Different approaches to solving the control problem:
  • furuta_pendulum_de - uses manually derived Differential Equations (hence the name) with manually calculated linearization, which is then used for calculating gains for the LQR controller with swing-up
  • furuta_pendulum_drake - in this package the same LQR with a swing-up approach is used, but this time manually derived equations are replaced. Instead Drake library is used to load the URDF of the pendulum, and solely based on it, linearization is calculated, which is once again used to calculate K gain.
  • furuta_pendulum_control_toolbox - [this package is deprecated (currently ignored during build), for the MPC OCS2 package should be used] in this approach different library is used - Control Toolbox. It also automatically derives a simulation of the pendulum based on this model (which is in the form of code generated based on the URDF model). There are two approaches used here, one is the same, as in previous ones - LQR with swing-up, but this time Control Toolbox is used to get K. Another approach uses MPC to get an optimal solution.
  • furuta_pendulum_rl - in this package Reinforcement Learning approach is used. The pendulum is modeled in the Mujoco, which then is used to create a Gym environment. After training the agent, the actor's network is exported to the final controller, which is implemented in C++.
  • furuta_pendulum_ocs2 - Optimal Control for Switched Systems integration that provides MPC.
  • furuta_pendulum_ocs2_ros - ROS 2 integration for the OCS2 controller.
  1. General utility packages:
  • furuta_pendulum_bringup - general launch files, which combine controllers from different packages, with different simulation environments.
  • furuta_pendulum_description - URDF of the pendulum and config file with physical properties
  • furuta_pendulum_gazebo - simulation config in Gazebo, which uses ros2_control with torque control
  • furuta_pendulum_hardware - ROS 2 control configuration for ODrive used in the physical pendulum
  • furuta_pendulum_model - data and scripts used for system identification

Building

Some of the source dependencies are specified in the *.repos files, you can use them by calling vcs import src < src/furuta_pendulum/furuta_pendulum.repos in the src directory (depending on your build you should additionally import simulation or hardware dependencies). Some packages require installing additional dependencies if they can't be installed easily with rosdep. I usually add them to the devcontainer, but I didn't have time to automate all of them, so you may have to do it manually, for details refer to the README file of each package.

colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --symlink-install

Usage

To run the pendulum simulation use one of the launch files from furuta_pendulum_bringup, launch files have the naming convention:

simulator_type_with_controller_type.launch.py

Available simulator_types:

  • gazebo
  • de_simulation
  • hardware

Available controllers:

  • drake_controller
  • ocs2_controller
  • rl_controller

Note

drake_controller uses LQR with energy-based swing-up approach, and parameters are optimized for hardware, thus simulations don't work correctly. ocs2_controller on the other hand doesn't work on hardware, and isn't always reliable in simulations.

furuta_pendulum's People

Contributors

macstepien avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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