Page 1 of 1

[SOLVED] [pybullet] Resetting multibody messes up simulation

Posted: Sat Feb 11, 2017 11:25 pm
by benelot
Hello,

I produced a simple snake multibody (a chain of 5 links) and I am working ok a reinforcement learning setup to make it move. Therefore I need to reset the multibody, but when I use the standard resetBasePositionAndOrientation, this greatly messes up my multibody. It usually gets instable and flies around. Is this insufficient to reset the whole body?Do I need to reset anything else? I will have to work on the stability later as I intend to increase the chain length to around 20 parts.

Re: [pybullet] Resetting multibody messes up simulation

Posted: Sun Feb 12, 2017 12:19 pm
by benelot
Problem solved. It is that I rotated the inertial of the urdf body.

If your base has an orientation != Quaternion(0,0,0,1) when placed into the world such as this one:

Code: Select all

	<link name="link_8">
		<collision>
		  <geometry>
		    <cylinder length="0.2" radius="0.025"/>
		  </geometry>
		  <origin rpy="0 1.57075 0" xyz="-0.1 0 0"/>
		</collision>
		<visual>
		  <geometry>
		    <cylinder length="0.2" radius="0.025"/>
		  </geometry>
		  <origin rpy="0 1.57075 0" xyz="-0.1 0 0"/>
		</visual>
		<inertial>
		  <origin rpy="0 1.57075 0" xyz="-0.1 0 0"/> <<<<==== HERE I rotated the intertial
		  <mass value="0.2"/>
		  <inertia ixx="0.00006" ixy="0" ixz="0" iyy="0.00006" iyz="0" izz="0.00006"/>
		</inertial>
	  </link>
resetting the multibody to some position and a Quaternion(0,0,0,1) causes it to be oriented wrongly. It can be solved by storing the initial orientation via getBasePositionAndOrientation(...) and resetting to that, or by not rotating the inertial.