How to change min_depth parameter in model plugin?

asked 2019-11-26 10:32:45 -0600

kumpakri gravatar image

updated 2019-12-02 05:08:35 -0600

I'm trying to set different than default max_depth parameter for wheels of the robot. I managed to change the sdf code of the contact tag and when i use the Load function, the values do change in the gazebo GUI, but the robot does not behave as if min_depth changed. When I position the wheels 1 cm below the ground , the wheels are pushed above the ground regardless. The 'max_vel' parameter does get uploaded correctly and the robot does not jump after being pushed out of the ground, however.

sdf::ElementPtr surface_sdf = this->link_ptr->GetCollision(_index)->GetSDF()->GetElement("surface");
sdf::ElementPtr min_depth_sdf = surface_sdf->GetElement("contact")->GetElement("ode")->AddElement("min_depth");
sdf::ElementPtr max_vel_sdf = surface_sdf->GetElement("contact")->GetElement("ode")->AddElement("max_vel");
min_depth_sdf->Set(0.02);
max_vel_sdf->Set(0.0);
this->link_ptr->GetCollision(_index)->GetSurface()->Load(surface_sdf);

image description


EDIT 1

From my experiments I also came to conclusion, that the max_vel parameter can be set from plugin only in case the QuickStep stepping method is being used. When running the simulation with the WorldStep stepping method, setting the 'max_vel' parameter from the plugin also does not have any effect.

Can anybody provide any explanation to this issue?

edit retag flag offensive close merge delete