ShuoYangRobotics / A1-QP-MPC-Controller

An open source implementation of MIT Cheetah 3 controllers
GNU Affero General Public License v3.0
616 stars 130 forks source link

关于仿真和实物调试的问题 #6

Open Peterxjerk opened 2 years ago

Peterxjerk commented 2 years ago

你好,我们首先按照README的方法在gazebo中运行。当执行完rosrun unitree_controller unitree_servo和rosrun unitree_controller unitree_move_kinetic这两条命令之后机器人四条腿处于支撑状态并回到原点位置,再运行控制器roslaunch a1_cpp a1_ctrl.launch type:=gazebo solver_type:=mpc,机器人站立状态就会变得不稳定。我们通过XBOX手柄按A键,让机器人从站立变为行走模式,再按下A键之后,机器人变为站立模式,这个时候机器人的腿会出现抖动的情况。README里提到不同的电脑可能会有不同的性能,我们使用的电脑的配置的CPU是r7-4800h,显卡是2060的,会有可能是电脑性能不够的原因吗?我们的仿真中机器人处于行走模式的时候,和演示的视频效果是差不多的,但就是在启动阶段以及从行走模式切换回站立模式的时候会出现不稳定状态。演示视频中只有机器人启动之后的演示效果,不知道启动阶段是否也会存在这样的问题呢?

我们也尝试将这套代码移植到宇树的Go1上,根据之前提的issue的说法,我们在安装的时候使用的是宇树最新的unitree_legged_sdk,将config文件中新增了一个hardware_go1_mpc.yaml,将机器人的质量、身体的转动惯量设置为Go1的参数,也将HardwareA1ROS.cpp中A1的腿的偏置、电机的偏置以及腿长等参数修改成了Go1的参数,并修改a1_ctrl.launch文件。我们在调试的时候,让机器人开机并站立起来后,按遥控器的L2+B让机器人进入阻尼模进并趴下,然后在docker中运行控制器,通过网线直接连接机器人。机器人会突然动一下然后无法站立并且直接进入保护模式,我们将传给电机的力矩信息输出来发现会达到35N·m。但如果我们在机器人开机并站立之后直接运行控制器,机器人就会像仿真中一样出现抖动的状态,我们觉得这可能是由于电机高频电流造成的振荡,所以尝试着将hardware_go1_mpc.yaml中的a1_kd_foot_x,a1_kd_foot_y,a1_kd_foot_z调小,但是却没有起作用。我想问一下,README中的standby模式是指阻尼模式吗?我不太确定我们运行的方法是否是正确的。还有就是除了我们修改的部分,还有什么是需要调整的吗?

希望得到你的回复。

ShuoYangRobotics commented 2 years ago

(sorry this computer I am using has no pinyin input methods)

  1. I observed the same problem. The simulation of the main branch is not fine tuned. I will check parameters and tune it better.
  2. This perhaps is due to the problem mentioned here in the code . Please make sure on your robot, your mpc_dt is set to the time of your thread1's loop interval. And make sure use_sim_time is set to 0. I think my use_sim_time may be wrong here, I will double check. For now, on hardware you can try comment out line 465-467.
ShuoYangRobotics commented 2 years ago

Let me know how it works.

ShuoYangRobotics commented 2 years ago
  1. I fixed this bug. the use_sim_time is not correctly loaded and checked so the hardware code uses the wrong control dt. Now the performance on hardware should be good.
edward9503 commented 2 years ago

Hi @ShuoYangRobotics ,

I've observed the same problem when I used mpc in Gazebo. When the robot is standing, we can observe some shaking of the body and legs. This won't happen in the qp version. So for me the qp looks stabler than the mpc when walking on even ground. I was wondering if this is fixed yet? Many thanks.

ShuoYangRobotics commented 2 years ago

I will tune the MPC gazebo gain a little bit. MPC should always performs better than QP when fine tuned.

crankler commented 2 years ago

Let me know how it works.

We will test this fixed pkg in this week, thank you for your help.

zhangOSK commented 2 years ago

I will tune the MPC gazebo gain a little bit. MPC should always performs better than QP when fine tuned.

Hi, in the latest version, the mpc is not working well. I observe that after running "rosrun unitree_controller unitree_servo" in the stance mode. It happens frequently that the mpc leads to a strange behavior and the robot falls down. On the contrary, the QP one works well in simulation. Btw, I am using the original A1 model.

zhangOSK commented 2 years ago

I found the old version which was committed on April 24 works fine for simulation. MPC in later versions cause shaking legs in stance mode in gazebo while qp's performance is acceptable.

cmr1999 commented 10 months ago

请问你部署到Go1机器人上成功了吗,方便分享一下经验吗