ShuoYangRobotics / A1-QP-MPC-Controller

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

Unexpected behavior on hardware #7

Closed DaveDe closed 2 years ago

DaveDe commented 2 years ago

Thanks for releasing this code!

I have successfully compiled (without docker) on the A1, and ran a separate script which sent a command of all 0's, to enter "standby" mode as mentioned in the readme.

After running: roslaunch a1_cpp a1_ctrl.launch type:=hardware solver_type:=mpc

the robot jumps slightly in the air, and then is completely unresponsive. It's unclear to me why this behavior is occurring, and if anyone else has experienced this or has advice in debugging the issue, it would be appreciated!

ShuoYangRobotics commented 2 years ago

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.

Let me know how it works

ShuoYangRobotics commented 2 years ago

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.