Skip to content

From-scratch implementation of RBD and control algorithms for robot manipulators and legged robots

License

Notifications You must be signed in to change notification settings

ermolenkodev/legged_control_cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

legged_control_cpp

ci CodeQL

About legged_control_cpp

The project is a ground-up implementation of Rigid Body Dynamics and high-level control algorithms for robotics manipulators and legged robots. The primary goal is to develop all these algorithms from scratch (possibly excluding the QP solver), and to do so without utilizing any external robotics libraries, such as Pinocchio, Drake, etc.

Task space control demo

iiwa14.mp4

Planned features

  • Model of kinematic tree
  • Basic URDF parsing
  • Basic Mjxml parsing
  • Simple visualization
  • Rigid Body Dynamics
    • Recursive Newton-Euler Algorithm
    • Composite Rigid Body Algorithm
    • Jacobian computation
    • Classic acceleration computation
  • Manipulator Control
    • Joint Space Control
      • Simple PD Control
      • PD Control with Gravity Compensation
      • Feedforward Control
      • Inverse Dynamics Control
    • Task Space Control
      • Integration with Mujoco
      • Simple PD Control in Task Space
      • Inverse dynamics in Task Space
      • Null-space control
    • Contact consistent dynamics
  • Legged Robot Control
    • Simulation of legged robot
    • ...

Usage

The Rigid Body Dynamics implementation is encapsulated in the legged_control_lib library. This library is linked to various executable examples located in the samples directory.

Note: And executables should be run from the project's root directory. By default executables are located in the corresponding build directory. (e.g. build/src/samples/urdf_sample/urdf_sample)

Samples

URDF parsing sample

urdf_sample: A simple example demonstrating how to parse a URDF file.

Joint Space contol sample

joint_space_control: This is an implementation of joint space control tailored for a UR-5 manipulator. It generates an output file named joint_space_control.log in the project's root directory. This file contains the simulated joint trajectory and can be visualized using the rviz trajectory visualizer

Task Space control sample

task_space_control: This is an implementation of task space control for a IIWA14 manipulator. In this example, Mujoco sim is used for simulation, while legged_control_lib is employed for dynamics computation and control. The Mujoco model of the IIWA14 manipulator has been adapted by me from the mjctrl repository, with some modifications applied. Additionally, a custom mjxml parser is used to translate the Mujoco model into the internal model class of legged_control_lib.

Visualization

The joint_space_control sample uses rviz trajectory visualizer for visualization. The visualizer is a ROS package that plays back a trajectory of a robot in rviz. For installation instructions, please refer to the projects' repository.

To replay the trajectory, run the following command:

 ros2 launch rviz_trajectory_player rviz_trajectory_player.launch.py robot_file:=<absolute_path_to_urdf|xacro_file> trajectory_file:=<absolute_path_to_trajectory_file>

Demonstration of Sinusoidal Trajectory Tracking with a Joint Space controller

Demo of joint controller sinusoidal trajectory tracking

More Details

This project structure was derived from the cpp_starter_project. As a result, you may encounter instances of the template project's name in the CMake files or within the documentation. Please also be aware that while instructions for Windows and macOS setup are provided, they may not be fully complete or thoroughly tested. This project has been primarily tested on Ubuntu. However, it's anticipated to function on Windows and macOS systems, provided that the necessary dependencies have been properly installed.

Note about the License

This project closely follows the API and notation used in spatial v2, and as a result, it is considered a derivative work of this library and is licensed with GPL v3.

Reference Materials

About

From-scratch implementation of RBD and control algorithms for robot manipulators and legged robots

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published