iit-DLSLab / Quadruped-PyMPC

A model predictive controller for quadruped robots based on the single rigid body model and written in python. Gradient-based (acados) or Sampling-based (jax).
132 stars 11 forks source link

Add a Gym/Gymnasium environment for all quadruped systems. #3

Closed Danfoa closed 2 weeks ago

Danfoa commented 3 weeks ago

This PR introduces a Gymnasium environmet to expose the simulation and control problem of quadrupeds with a standard API.

This environment should be flexible enough to enable user to define

  1. Which robot, terrain, disturbance distribution, and domain randomization to use.
  2. Which type of base velocity commands (linear and angular velocity) should the robot try to track.
  3. Compare different control policies in terms of energy efficiency and robustness
  4. Generate dataset of observations of state and actions for imitation learning purposes.
giulioturrisi commented 3 weeks ago

Hi Daniel, nice work!

I noticed that the plot of the swing are missing from the original file, can you insert them back in the render funct? Plus, for speed purpose, i will suggest to maintain the possibility to render and plot with a lower freq (for example, in the presence of heightmaps draw everything at 2ms could slow things a little bit). Maybe an additional flag?

Danfoa commented 3 weeks ago

Hi @giulioturrisi

Added the plotting of the feet trajectories in the simulation script, I believe we should keep all "non-generic" functions outside of the QuadrupedEnv class, to keep it clean.

I modify the plotting funciton and introduced some utility rendering functions for visualizing some geometric primitives for debugging.

I think the feet trajectory function can be further improved but I leave this to you guys.