wiki:HmiPhysics

HmiPhysics

Quickstart

TODO

HmiPhysicalHumanoid

Example:

<PhysicalHumanoid xmlns:col="http://www.collada.org/2005/11/COLLADASchema">
   <PhysicalRootSegment startJoint="HumanoidRoot" endJoint="l_hip r_hip l_shoulder r_shoulder skullbase" mass="41.543926" position="1.1168412E-6 1.2506841 0.017299622" I="2.4438405 9.874611E-4 -1.2528268E-4 9.874611E-4 0.5218161 -0.14273751 -1.2528268E-4 -0.14273751 2.3856416">
      <CollisionModel>
      <col:shape>
               <col:box>
                     <col:half_extents>0.159157 0.1367995 0.1083425
                     </col:half_extents>
               </col:box>
               <col:translate>
                  -1.1168412E-6 -0.26656365 -0.008797124
               </col:translate>
      </col:shape>
      <col:shape>
      ...
      </col:shape>
      </CollisionModel>
 </PhysicalRootSegment>
 <PhysicalSegment startJoint="l_hip" endJoint="l_knee" mass="8.822567" position="0.091620825 0.7683674 0.0058982586" I="0.53947634 0.0047381283 -5.1481114E-4 0.0047381283 0.02644808 0.013028727 -5.1481114E-4 0.013028727 0.53612715" type="universal" axis1="1.0 0.0 0.0" axis2="0.0 0.0 1.0" loStop1="-2.024582" hiStop1="0.0" loStop2="-0.54105204" hiStop2="0.5235988" loStop3="-0.54105204" hiStop3="0.9250245">
      <CollisionModel>
      ...
      </CollisionModel>
 </PhysicalSegment>
</PhysicalHumanoid>

Collisionmodel describes the collision shape of each segment of the body in  Collada. endjoint is the space seperated list of joints that end the segment. Mass is mass in kg. Position is the position of the CoM of the segment in world coordinates. I is the inertia tensor (row-order). type (ball, universal, hinge, fixed) indicates the DoF of the joint. axis1 is the rotation axis of the first dof, loStop1, hiStop1 the rotation limits of the first dof (in radians).

XML definition

TODO

Coordinate systems

PhysicalJoint

joint.addTorque(x,y,z) applies a torque of x on the local x axis), y on the local y axis, etc. The torque is applied to the joint that rotates the underlying physical segment. The opposite torque is applied to the physical segment above. So if you add a torque of (10,0,0) on the knee joint, this is transfered to a torque of (10,0,0) on the knee segment and a torque of (-10,0,0) on the hip segment.

joint.getAngle(i) returns the angle around the ith axis of the joint (with i=0 is x, i=1 is y, etc.).

PhysicalSegment

segment.box.getRotation()/getTranslation() return the rotation/translation of a segment in world coordinates. box.getInertiaTensor() provides the inertiatensor on the center of mass of the segment in world coordinates when it has identity rotation.

PhysicalHumanoid

ph.getCOM()/getCOMDiff return the Center of Mass / its velocity in world coordinates.