skywoodsz / qm_control

Quadruped manipulator controller using model predictive control and whole body control based on OCS2
202 stars 34 forks source link

Slow motion issues caused by HierarchicalWbc #5

Closed ChenZheng29 closed 11 months ago

ChenZheng29 commented 1 year ago

Hello, this is a great project. Thank you for your open source project! During the process of running your project, I encountered a problem. Have you ever encountered a situation where the RealTIMeRector of Gazebo is very small, manifested as the robot moving in slow motion, as shown in the following figure: 2023-09-21 14-49-01屏幕截图 Later, compared to legged_ Robot, it was found that it was caused by HierarchicalWbc, while WeightedWbc did not. When using HierarchicalWbc, the calculation time is shown in the following figure: 2023-09-21 14-49-51屏幕截图 This parameter was tested without changing any of your code. CPU is i7-1165. When using WeightedWbc, the wbc calculation time is: 2023-09-21 15-16-29屏幕截图 I look forward to your reply very much.

skywoodsz commented 1 year ago

Hello, this is a great project. Thank you for your open source project! During the process of running your project, I encountered a problem. Have you ever encountered a situation where the RealTIMeRector of Gazebo is very small, manifested as the robot moving in slow motion, as shown in the following figure: 2023-09-21 14-49-01屏幕截图 Later, compared to legged_ Robot, it was found that it was caused by HierarchicalWbc, while WeightedWbc did not. When using HierarchicalWbc, the calculation time is shown in the following figure: 2023-09-21 14-49-51屏幕截图 This parameter was tested without changing any of your code. CPU is i7-1165. When using WeightedWbc, the wbc calculation time is: 2023-09-21 15-16-29屏幕截图 I look forward to your reply very much.

Thanks for your follow! There is not the WeightedWbc in my project. Did you build the project with RELEASE? You can try catkin config -DCMAKE_BUILD_TYPE=RelWithDebInfo.

ChenZheng29 commented 1 year ago

Thank you for your reply! Yes, I have already done this step, but it is not the problem caused by this step. Because I have no problem using WeightedWbc, while HierarchicalWbc only appears. If I didn't do this step, I have also tried, and it will always be in a slow state. As for WeightedWbc, I ran it in legged_robot of 'qiayuanliao' and there was no problem. However, in his code, changing WeightedWbc to HierarchicalWbc would also cause the problem of slowing down. I also found in your other repository that you have made improvements to wbc, including testing the runtime of wbc under two algorithms. May I ask if you changed WeightedWbc to HierarchicalWbc during wbc instantiation without doing anything else? Just like this: from: 2023-09-21 19-23-39屏幕截图 to: 2023-09-21 19-24-07屏幕截图

skywoodsz commented 1 year ago

Thank you for your reply! Yes, I have already done this step, but it is not the problem caused by this step. Because I have no problem using WeightedWbc, while HierarchicalWbc only appears. If I didn't do this step, I have also tried, and it will always be in a slow state. As for WeightedWbc, I ran it in legged_robot of 'qiayuanliao' and there was no problem. However, in his code, changing WeightedWbc to HierarchicalWbc would also cause the problem of slowing down. I also found in your other repository that you have made improvements to wbc, including testing the runtime of wbc under two algorithms. May I ask if you changed WeightedWbc to HierarchicalWbc during wbc instantiation without doing anything else? Just like this: from: 2023-09-21 19-23-39屏幕截图 to: 2023-09-21 19-24-07屏幕截图

  1. Have you tried running MPC Only? HierarchicalWbc is also used in MPC Only with diffirent tasks. I guess the problem may be caused by the number of solutions to qpOASES being too large. You can try changing int nWsr = 100; to int nWsr = 20; in https://github.com/skywoodsz/qm_control/blob/bd8e249abc8ac759346abfbaeedf4d2a52e48d29/qm_wbc/src/HoQp.cpp#L141

  2. No, it is dangerous to change the controller while the robot is running.

ChenZheng29 commented 1 year ago

Changing nWsr from 100 to 20 also has no effect, using MPC Only will also cause slow motion. Do you think there are any benefits of Hierarchical Wbc compared to Weighted Wbc? If it's similar, I'll just use WeightedWbc hahaha In addition, I would like to ask why you still use wbc in your MPC Only? Isn't it enough to directly calculate the foot reaction force as joint torque?

skywoodsz commented 1 year ago

Changing nWsr from 100 to 20 also has no effect, using MPC Only will also cause slow motion. Do you think there are any benefits of Hierarchical Wbc compared to Weighted Wbc? If it's similar, I'll just use WeightedWbc hahaha In addition, I would like to ask why you still use wbc in your MPC Only? Isn't it enough to directly calculate the foot reaction force as joint torque?

  1. Well, HierarchicalWbc can achieve priority control, and there is no need to find weight parameters. But, if you have nice weight parameters, there is little difference between the HierarchicalWbc and WeightedWbc.
  2. In the early stage of the project, I did not use WBC in MPC Only, so I took the name. However, because WBC uses a more realistic dynamic model and higher control frequency, it can make the robot more stable, especially in the hardware robot.
skywoodsz commented 1 year ago

Changing nWsr from 100 to 20 also has no effect, using MPC Only will also cause slow motion. Do you think there are any benefits of Hierarchical Wbc compared to Weighted Wbc? If it's similar, I'll just use WeightedWbc hahaha In addition, I would like to ask why you still use wbc in your MPC Only? Isn't it enough to directly calculate the foot reaction force as joint torque?

In addition, I did not add torque limits in the MPC formulation but added them in the WBC. There may be wrong when the robot is applied to a large force without WBC.

ChenZheng29 commented 1 year ago

Okay, I have a general understanding. Thank you very much for your reply!!!