Giter VIP home page Giter VIP logo

eagle-mpc's Introduction

⚠️ Disclaimer ⚠️

This is a work-in-progress library. As such, it only contains basic features. For any doubt, bug, problem or suggestion feel free to open an issue.

By now it has only been tested with Ubuntu 20.04 and Python 3.8.

Eagle MPC

1. Introduction

This library contains tools to solve optimal control problems (OCPs) that deal with unmanned aerial manipulators (UAMs). It is strongly dependant on Crocoddyl, whose API is used to build the OCPs.

It has two principal pieces:

  • Trajectory generator: It can be used to generate different maneuvers using any type of UAM. The OCP is easily specified by means of a YAML file (see the example section)

  • Nonlinear model predictive controllers: It contains several nMPC controllers. They differ on the way the OCP inside the controller is built and how it is updated at every nMPC step.

It also contains an implementation of the Squash-box FDDP solver presented in this paper.

This is a C++ library. However, it can also be used within a Python environment since almost all classes have their corresponding Python bindings.

2. Installation - Dependencies

2.1 Crocoddyl dependencies

Crocoddyl has several dependencies. We need to install the following ones:

2.1.1 Pinocchio

Follow the installation instructions. Install from robotpkg recommended.

2.1.2 Gepetto viewer:

Follow the installation instructions. Install from robotpkg recommended.

2.1.3 example-robot-data

Use the forked version of the original repository. The devel branch of the forked version contains additional UAM models with different platform and robotic arm combination:

Platforms:

  • Planar small hexacopter (370mm)
  • Planar medium-sized hexacopter (680mm)
  • Fully actuated hexacopter (Tilthex)

Robotic Arms:

  • 2 DoFs
  • 3 DoFs
  • 5 DoFs (with spherical wrist)

Quick installation instructions:

cd <choose-your-path>
git clone https://github.com/PepMS/example-robot-data
cd example-robot-data
git submodule update --init
git checkout devel
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j6
sudo make install

2.2 Crocoddyl

Crocoddyl stands for Contact Robot Optimal Control by Differential Dynamic Library. It is a library to create and solve optimal control problems for robotics.

⚠️ Crocoddyl needs to be built from source. ⬇️⬇️Reason⬇️⬇️

EagleMPC has Crocoddyl as its main dependency (most of the classes contain Crocoddyl objects). Unfortunately, we cannot use the release packages given by the Crocoddyl team and we need to build it from source. This is due to the implementation of the Squash-box FDDP solver in the EagleMPC library. It inherits from the base class crocoddyl::SolverFDDP that has been slightly modified to consider different stopping criteria.

The Crocoddyl version you need to build is in this branch.

Overview of the different branches in the forked Crocoddyl repository:

  • master : Even with its master parent branch
  • devel : Even with its devel parent branch
  • sbfddp: Even with the devel branch adding the modifications of the stopping criteria.

Quick installation instructions:

cd <choose-your-path>
git clone https://github.com/PepMS/crocoddyl.git
cd crocoddyl
git submodule update --init
git checkout sbfddp
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j6
sudo make install

Add the installation folder to your environment variables:

export PATH=/usr/local/bin:$PATH
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PYTHONPATH=/usr/local/lib/python3/dist-packages:$PYTHONPATH

⚠️ If you want to reproduce the experiments of the paper Full-body torque-level Nonlinear Model Predictive Control, checkout the Crocoddyl repository to this tag.

2.3 YAML-Cpp

YAML files are used to ease the creation of optimal control problems, to help in the definition of new multicopter platforms or to define the tunning parameters for the MPC controllers.

You can install this dependency by doing:

sudo apt-get install libyaml-cpp-dev

3. Installation - Eagle MPC

Clone this repo and build:

git clone https://github.com/PepMS/eagle-mpc.git
cd eagle-mpc
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j6

Install this library. By default it will be installed at usr/local/. If you want to install it somewhere else, the CMAKE_INSTALL_PREFIX from the CMakeLists.txtshould be modified accordingly. Then, to install do

sudo make install

⚠️ Problem with the system locale ⚠️ The Yaml parser uses the std::stod function to convert a string to a double. This function is locale dependant. Be sure to have set a locale that uses . as a decimal separator. To make sure of it you can run:

export LC_NUMERIC="en_US.UTF-8"

4. Running examples

As this library contains Python bindings to its C++ code, we can run a python-based example.

python3 path/to/multicopter_mpc/examples/python/trajectory_generation.py

eagle-mpc's People

Contributors

pepms 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

eagle-mpc's Issues

Mission YAML: use time instead of number of nodes

If different dt are considered accross experiments, the definition of the mission in the YAML file has to change. To avoid this, we should use the time interval between waypoints instead of nodes. Nodes should be calculated when filling the mission in the problem.

Run tests without the need to install

Right now, if new objects and methods are added to the API along with the corresponding unittest, you need to install the library to so the test can be ran.

Move to std::shared_ptr

Due to its close dependency on Crocoddyl, the library started using boost smart pointers.

Since the minimum required C++ version for Eagle-MPC is C++11, these could be moved to std and only use the boost library when strictly necessary.

Option to specify trajectory solving parameters in the YAML file

The idea behind a trajectory is that it only contains the information related to the trajectory itself but has nothing to do with how this is solved. The information of the trajectory is specified in the YAML file.

This is why when creating the problem we have to pass the parameters related to solving the problem (time step, integrator method, and boolean indicating whether the solver we want to use is squashed based).

There might be cases where we might only want to work via YAML files. Thus, it might be useful to have the possibility to specify the solving parameters in the YAML file too.

Solution proposed:

  • If the YAML file DOES contain the solving parameters, fill a struct inside Trajectory with these parameters. Then overload the createProblem() method with no arguments. This method will take the solving parameters from the struct.
  • If the YAML file DOES NOT contain the solving parameters, throw an error if the createProblem() method is called, since the solving parameters structure will be empty.

There seems to be a file named ‘path.h’ missing in branch "v0.0.1fbtlnpmc_uam"

I was fascinated by your excellent work on UAM control ('Full-Body Torque-Level Nonlinear Model Predictive Control for Aerial Manipulation') and wanted to reproduce your open-source code.

According to the instructions you provided here, I have installed all the dependencies and then encountered a fatal error during the ROS compilation process, which suggested that a key file named "path.h" was missing from the specified folder.

The compilation process is shown in the following figure.

image

Looking forward to your reply, thank you very much!

Implement first approach of mpc_main

This is the problem that we should solve for the first approach of the mpc_main class working with both controllers (low_level_controller and trajectory geneerator):

  • Trajectory generator: solve an ocp for a given mission when constructing the mpc_main class
  • The state trajectory output by the trajectory generator will be fed in the low_level_controller
  • Mission in the traj. generator has to end with a hover state, since when the low_level_controller runs out of reference state, hover states will be added at the end.

Compile flag to choose the level of LOG messages

The current LOG messages inside the code are too wordy that are useless when running the code.

There should be different log levels.

Also, if logging has to be done properly, we should consider using external tools such as Boost logger or spdlog.

Remove callbackVerbose() from being the default option

The callbackVerbose() is not useful when use it, e.g., in the MPC case since it forbids you to see other terminal messages. Instead, some safety checks should be added to warn about possible bas solutions (e.g. bad stopping value, max iterationts reached, etc.)

Remodel the MPC Main and the controllers

Instead of having the mpc main with a trajectoryGenerator and the controller, this issue aim is to add the trajectory generator as a part of the controller. Therefore, the MPCMain will only have one controller.

LowLevelMPC implementation

Instead of stating a state reference trajectory for every node, follow the same philosophy as with the trajectory generator.

PiceWise controller hovering

Now, the hovering is not handled well in the picwise controller. When hovering, all nodes should have terminal weights

Python bindings

Python bindings:

  • WayPoint
  • McBaseParams
  • Mission
  • TrajecotryGeneration

Remove std::size_t where is not needed

Variables of std::size_t are used as a substitute for uint. It should only be used where it specifies a dimension and use, e.g. uint64_t instead for all other uses.

Internal gains

Ability to use internal gains with any mpc controller. This should be probably handled by MpcMain

Change in the YAML files path

Currently, you need to set absolute paths in the YAML files. This is a bad approach since every time the repo is downloaded, the user must set the absolute paths of all the existing YAML files.

Proposed approach:

  • Set a default path for YAML files (installed via include)
  • In the YAML file:
    • A single name indicates this file is located in the default location
    • Otherwise, it will be considered as an abosulte path

move yaml parser

Yaml parser folder should be added as a submodule. Therefore, a separate repo should be created for yaml_parser.

Parameters taken from YAML in ocp_based controllers

Right now all gains associated to the optimal control problem of any controller based on the ocp-base class are hardcoded. Thus, after any change we need to recompile, and it takes too long due to template based Crocoddyl lib.

This parameters should be read from a yaml file.

YAML files separated by robot

Right now we have the following YAML folder structure:

YAML folder:

  • mpc (mpc controller tunnings for eahc kind of robot)
    • robot1_mpc1.yaml
    • robot1_mpc2.yaml
    • robot2_mpc1.yaml
  • multicopter (platform parameters)
    • robot1.yaml
    • robot2.yaml
  • trajectories
    - robot1_trajectory1.yaml
    - robot1_trajectory2.yaml
    - robot2_trajectory1.yaml

Since all yaml file names contain the robot name, we could simplify this by doing:

YAML folder:

  • robot 1:
    • mpc
      • mpc1.yaml
      • mpc2.yaml
    • platform
      • platform.yaml
    • trajectories
      • trajectory1.yaml
      • trajectory2.yaml
  • robot 2:
    • mpc
      • mpc1.yaml
    • platform
      • platform.yaml
    • trajectories
      • trajectory1.yaml

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.