unitreerobotics / unitree_guide

BSD 3-Clause "New" or "Revised" License
251 stars 62 forks source link

B1 simulation controller fine tuning #69

Closed FedericoRollo closed 5 months ago

FedericoRollo commented 8 months ago

Hi, I'm trying to fine-tune the junior_ctrl controller you provide with this package to work with the B1 robot simulation. I started by creating the following class in unitreeRobot.cpp:


B1Robot::B1Robot(){
    _Legs[0] = new B1Leg(0, Vec3( 0.355, -0.07, 0));
    _Legs[1] = new B1Leg(1, Vec3( 0.355,  0.07, 0));
    _Legs[2] = new B1Leg(2, Vec3(-0.355, -0.07, 0));
    _Legs[3] = new B1Leg(3, Vec3(-0.355,  0.07, 0));

    _feetPosNormalStand <<  0.3550,  0.3550, -0.3550, -0.3550,
                           -0.2300,  0.2300, -0.2300,  0.2300,
                           -0.5750, -0.5750, -0.5750, -0.5750;

    _robVelLimitX << -0.4, 0.4;
    _robVelLimitY << -0.3, 0.3;
    _robVelLimitYaw << -0.5, 0.5;

    _mass = 12.0;
    _pcb << 0.0, 0.0, 0.0;
    _Ib = Vec3(0.0792, 0.2085, 0.2265).asDiagonal();
}

I roughly estimated B1 legs dimensions, positions and feet position when the robot is standing. If you have more precise information from CAD please let me know so I can refine the data. Moreover, I would need the data below (extracted from the Go1Robot class in unitreeRobot.cpp)

    _mass = 12.0;
    _pcb << 0.0, 0.0, 0.0;
    _Ib = Vec3(0.0792, 0.2085, 0.2265).asDiagonal();

I'm not sure, but maybe tuning this data for the controller could work. If you think I'm wrong let me know so I can avoid wasting time. Thank you!