Have my iCub perfectly on the ground and motionless


#1

Hello,

I really need, for my experiment, to start with a robot that is perfectly motionless. As far as I could set, the iCub’s feet start just above the ground, and the robot lands and all its articulations move a bit for a while. My brain takes ages to simulate, so if I want to wait until the robot finishes wobbling, this corresponds to dozens of minutes.

Is there a way to have my robot perfectly on the ground, and really stiff?

Many thanks if someone can help me!

Best,
Alban


#2

Hello Alban,

You can adjust the initial position of your robot by changing the coordinates of the robotPose field in you experiment configuration file (either an .exc or an .xml file, depending on whether you use the latest Experiments package or not).
For the iCub, you could try to change the predefined coordinates here

<\environmentModel src=“empty_world/empty_world.sdf”>
<\robotPose x=“0.0” y=“0.0” z=“0.8” ux=“0.0” uy=“0.0” uz=“1.57” theta=“0.70710689672598181”/>
<\environmentModel>

by the “stabilized coordinates” (x = 0.0, y = 0.0, z = 0.62253).
Best regards,
Luc


#3

Another alternative might be to set the robot static (in the sdf)?


#4

Thanks! I think I need both, because even if the robot is perfectly on the ground, his body will move a bit because it feels gravity, I guess.

Alban


#5

I have a further question: if I set my robot to be static, is it then possible to “move” its eyes by setting a new position for the eyes (Topic(‘robot/eye_version/pos’)) ?

I tried and I am not sure if I’m doing it wrong or if that’s just not possible.

Alban


#6

A static object can be moved, no problem. Now, if the eyes have kinematic constrinat, they might move only in the available degrees of freedom. Should be possible… did you try by directly sending positions over the rostopic?


#7

Sorry I just saw this thread, no it won’t be possible to move anything in a static robot. As a workaround, you can disable gravity for the model so it won’t drop at the start but is still kinematically ok, run this:

sed -i '/<link/a<gravity>0</gravity>' $HBP/Models/icub_model/model.sdf

and your iCub should be fine. It’ll turn gravity off for every link in the iCub model.

The better way to do this would be to disable gravity in the world, but the NRP currently doesn’t respect physics tags in world files (I filed a bug for that). Let me know if that works.


#8

Ok, many thanks to both of you!

I will try that soon.

Alban


#9

I should have also noted, make sure to remove the static tag from the robot and just run the sed command above. I just tested with the empty icub world, the robot does not drop but the eye commands still work. Good luck!


#10

Thanks! I thought it was sufficient to put g to 0 inside the world model.sdf.

Now I am confronted to the next problem (sorry): when the simulation starts, the robot’s inner tension releases and its body move a bit to its equilibrium position. I could just wait for the robot to stabilize, but in my experiment, the brain takes ages to simulate (millions of neurons).

So here would be my final question: is it possible to run the robot for some time, wait that the positions of his body parts are stable, and then “download” the inner state of the robot to use it for all the next experiments? Or something like this, so that the robot does not move a bit to stabilize? I tried to put all body parts inertia to a huge value, but the robot went mad…

Thank you again!
Alban


#11

Hi Alban,

The initial desired joint positions of the iCub seem to be actually set in an initialization plugin:

$HBP/GazeboRosPackages/src/icub_initialization/src/icub_initialization.cpp

That’s the reason that it goes to that initial pose with its arms up form the neutral position, since you now have gravity disabled and don’t really care about the robot balancing, you don’t really need that pose.

There are two things you can try, edit the plugin file above and comment out this block:

      /*if (("l_shoulder_pitch" == it->second->GetName()) || ("r_shoulder_pitch" == it->second->GetName()))
        this->jointControl->SetPositionTarget(it->first, -0.52);
      else if (("l_shoulder_roll" == it->second->GetName()) || ("r_shoulder_roll" == it->second->GetName()))
        this->jointControl->SetPositionTarget(it->first, 0.52);
      else if (("l_elbow" == it->second->GetName()) || ("r_elbow" == it->second->GetName()))
        this->jointControl->SetPositionTarget(it->first, 0.785);
      else if (("l_wrist_yaw" == it->second->GetName()) || ("r_wrist_yaw" == it->second->GetName()))
        this->jointControl->SetPositionTarget(it->first, 0.698);
      else*/

that will ensure the iCub doesn’t make any large movements to that intiial arms up pose. You’ll need to run:

catkin_make

in GazeboRosPackages after editing that file to rebuild the plugin. You can also set custom targets, I tested that and the movement is really minimal. Let me know if that is good enough and I can file a bug to make the plugin more flexible so you can specify those pose values in the SDF.

If that is still too much movement (in my testing the robot shoulder joints move very slightly but that doesn’t seem to have any impact on the head/camera view), we may be able to mess around with the SDF some more to change the intertia/stiffness of just the neck or shoulder joints to prevent that kind of tiny movement. You could also mess around with the PID controller parameters in the plugin, but that’s much more work.

Kenny


#12

Ok that works perfectly!