silvery107 / rl-mpc-locomotion

Deep RL for MPC control of Quadruped Robot Locomotion
https://docs.google.com/presentation/d/18bznpYrkCPnhCisySPDz18hvL3Ytere7JiJEbdLvpgU/edit?usp=sharing
MIT License
347 stars 41 forks source link

Question about the physical parameter of robot #17

Closed lk-greenbird closed 2 months ago

lk-greenbird commented 2 months ago

Thank you for your great work! I am very interseted in it. I want to add unitree Go2 to RobotType, then I check the <rl-mpc-locomotion/MPC_Controller/common/Quadruped.py> where defines some physical properties of the robots, like A1,Go1. I would like to know how some parameters are determined so that I can adjust them according to Go2. Take Go1 as an example

if robotype is RobotType.GO1:
        self._abadLinkLength = 0.08
        self._hipLinkLength = 0.213
        self._kneeLinkLength = 0.213
        self._kneeLinkY_offset = 0.0
        self._abadLocation = np.array([0.1881, 0.04675, 0], dtype=DTYPE).reshape((3,1))
        self._bodyName = "trunk"
        self._bodyMass = 5.204 * 2
        self._bodyInertia = np.array([0.0168128557, 0, 0, 
                                      0, 0.063009565, 0, 
                                      0, 0, 0.0716547275]) * 5
        self._bodyHeight = 0.26
        self._friction_coeffs = np.ones(4, dtype=DTYPE) * 0.4
        # (roll_pitch_yaw, position, angular_velocity, velocity, gravity_place_holder)
        self._mpc_weights = np.array([1.0, 1.5, 0.0,
                                     0.0, 0.0, 50,
                                     0.0, 0.0, 0.1,
                                     1.0, 1.0, 0.1,
                                     0.0], dtype=DTYPE) * 10

What do the following parameters mean? self._abadLinkLength self._abadLocation How are this related to the URDF file in assets folder, or can it be determined from the URDF? why does the self._bodyMass Multiply by 2? Does the self._mpc_weights is just an initial value?

silvery107 commented 2 months ago

Hi,

  1. Since I am following the link naming conventions from MIT Cheetah-Software, from top to bottom, abad link, hip link and knee link correspond to hip link, thigh link and calf link under Unitree's link naming. _abadLinkLength is the length between hip and thigh joints, which determines the offset of foothold in y-axis for each foot.
  2. _bodyMass represent the lumped body mass used in single rigid body dynamics model, and 5.2 is the reading of the trunk mass from URDF, so times it by 2 to approximate the total body mass.
  3. _mpc_weights will only be changed if you are running in "policy" mode of the controller.

Thanks