qiayuanl/legged_control

How to change the loop frequency of legged_controller

jn6201 opened this issue · 1 comments

jn6201 commented

it seems like the update frequency is fixed to 1000 Hz, since the ros topic "_mpc_observation" is always published at 1000 Hz in the update() function of LeggedController. I tried to reset the publish rate of the customized ros_controller to 500 HZ by adding "publish_rate:500" in the controllers.yaml which can work on joint_state_controller. But cant really change the rate of legged_controller. May anyone tell me what's wrong, or how to confirm the main control loop frequency?

jn6201 commented

I figured out the rate setting problem, maybe we can set the whole control loop's period by adding in the gazebo plugin label in robot's urdf file
<gazebo> <plugin filename="libgazebo_ros_control.so" name="gazebo_ros_control"> <robotNamespace>/</robotNamespace> <robotParam>legged_robot_description</robotParam> <robotSimType>legged_gazebo/LeggedHWSim</robotSimType> <controlPeriod>0.001</controlPeriod> </plugin> </gazebo>
When I set it to 0.002, the publish rate turned into 500 Hz, but facing a new problem: the controller seems to be unstable, the robot couldn't hold it's position. Is it because the frequency is not enough or somewhere in the code set the frequency must be 1000 Hz?