gazebo-yarp-plugins icon indicating copy to clipboard operation
gazebo-yarp-plugins copied to clipboard

Resetting iCub in Gazebo from C++

Open serena-ivaldi opened this issue 8 years ago • 8 comments

Hi all

we are trying to make the iCub in Gazebo learn by reinforcement learning some WB behaviors that frequently fail and cause the robot to fall/crash in Gazebo I was looking for the correct procedure to send the reset() to the world in Gazebo and to the controlBoards of the iCub but I cannot find the information.

Could you help us?

We are calling that from C++.

If we manually reset Gazebo (with CTRL+R) the world is reset, the iCub ports are still there but we basically loose the connection with the iCub motor controllers and we cannot move it anymore.

Thanks!

@lothas

serena-ivaldi avatar Jul 12 '17 11:07 serena-ivaldi

Hi @serena-ivaldi , which version of Gazebo are you using? As documented in http://robotology.gitlab.io/docs/gazebo-yarp-plugins/master/troubleshooting.html , we had problems in the past with the reset world of Gazebo < 7.2 . And recently @diegoferigo experienced problems with the latest Gazebo 7 (I guess Gazebo 7.8), and he had to update to Gazebo 8 to get the reset world to work.

traversaro avatar Jul 12 '17 12:07 traversaro

Adding more details, the only issue still present with Gazebo 8 is the following:

[ERROR]An hardware fault occurred on joint  2  torque too big!

But on this version, removing iCub and adding it again does work, Gazebo 7 always crashed (cc @nunoguedelha).

For what concern the C++ side, let's wait someone with more experience (than me at least) in dealing with its code.

diegoferigo avatar Jul 12 '17 13:07 diegoferigo

The hardware fault error is when a joint has a torque value bigger than 2000 Nm . https://github.com/robotology/gazebo-yarp-plugins/blob/93644b645efc56ce124e65b80f64b92dcc1a7cdb/plugins/controlboard/src/ControlBoardDriver.cpp#L69 .

traversaro avatar Jul 12 '17 14:07 traversaro

We are running Gazebo 7.7. Right now we are solving the issue by creating and destroying all the ports between two resets, but this is not optimal.

lothas avatar Jul 13 '17 15:07 lothas

What you mean "creating and destroying all the ports" ?

traversaro avatar Jul 13 '17 16:07 traversaro

Opening and connecting the ports, starting the threads etc. Then doing the opposite.

lothas avatar Jul 13 '17 16:07 lothas

Mhh, are you using the YARP_CLOCK enviromental variable and the libgazebo_yarp_clock.so plugin?

traversaro avatar Jul 13 '17 16:07 traversaro

No. What would I use that for? I've attached the code below. icub_yarp_gazebo.txt

So we call connectGazebo(), run an episode, then disconnectGazebo() and reset Gazebo (CTRL+r). Rinse and repeat.

lothas avatar Jul 13 '17 16:07 lothas