[ODE] making the floor rigid
dvir schirman
dvir.boost at gmail.com
Thu Jun 29 00:39:56 MST 2006
On 6/28/06, Jason Perkins <starkos at gmail.com> wrote:
>
> On 6/28/06, dvir schirman <dvir.boost at gmail.com> wrote:
> > How can I make my floor rigid, so the robot doesn't penetrate it?
>
> How have you implemented the floor? How have you implemented the
> robot? Are you sure that your collision shapes are properly aligned
> with your visual meshes?
>
> Jason
Hi, here is my implementation of the world, the robot and the floor.
The robot is made out of three boxes atached with an hinge.
world = dWorldCreate();
dWorldSetGravity (world, 0, 0, -9.8);
dWorldSetERP (world, 0.8);
dWorldSetContactSurfaceLayer (world, 0.0001);
dWorldSetCFM(world, 0.00001);
space = dSimpleSpaceCreate (0);
sim_surface.mode = dContactApprox1;
sim_surface.mu = ROBOT2_SIM_MU;
contact_joint_group = dJointGroupCreate (0);
hinge_joint_group = dJointGroupCreate (0);
friction_joint_group = dJointGroupCreate (0);
dMass mass;
state_num=0;
flag_box2=0;
flag_box3=0;
ground.contact_num =0;
ground.body = 0;
ground.geom = dCreatePlane (space, 0, 0, 1 , 0);
box1.body = dBodyCreate (world);
box2.body = dBodyCreate (world);
box3.body = dBodyCreate (world);
dBodySetPosition(box1.body, BODY1_LX/2, 0, BODY1_LZ/2+H);
dBodySetPosition(box2.body, BODY2_LX/2+BODY1_LX+GAP, 0, BODY2_LZ/2+H);
dBodySetPosition(box3.body, BODY3_LX/2+BODY1_LX+BODY3_LX+2*GAP, 0,
BODY3_LZ/2+H);
dMassSetBoxTotal (&mass, BODY1_MASS,BODY1_LX , BODY1_LY, BODY1_LZ);
dBodySetMass (box1.body, &mass);
dMassSetBoxTotal (&mass, BODY2_MASS,BODY2_LX , BODY2_LY, BODY2_LZ);
dBodySetMass (box2.body, &mass);
dMassSetBoxTotal (&mass, BODY3_MASS,BODY3_LX , BODY3_LY, BODY3_LZ);
dBodySetMass (box3.body, &mass);
box1.geom = dCreateBox(space,BODY1_LX , BODY1_LY, BODY1_LZ);
box2.geom = dCreateBox(space,BODY2_LX , BODY2_LY, BODY2_LZ);
box3.geom = dCreateBox(space,BODY3_LX , BODY3_LY, BODY3_LZ);
dGeomSetBody (box1.geom, box1.body);
dGeomSetBody (box2.geom, box2.body);
dGeomSetBody (box3.geom, box3.body);
box1.contact_num = 0;
box2.contact_num = 0;
box3.contact_num = 0;
hinge1= dJointCreateHinge (world, hinge_joint_group);
hinge2= dJointCreateHinge (world, hinge_joint_group);
dJointAttach (hinge1, box1.body, box2.body);
dJointAttach (hinge2, box2.body, box3.body);
dJointSetHingeAnchor (hinge1, BODY1_LX + GAP/2, 0, BODY1_LZ/2);
dJointSetHingeAxis (hinge1, 0, 1, 0);
dJointSetHingeAnchor (hinge2, BODY1_LX + BODY2_LX + 3*GAP/2, 0, BODY2_LZ/2);
dJointSetHingeAxis (hinge2, 0, 1, 0);
sim_surface.mode = dContactApprox1;// | dContactSoftERP | dContactSoftCFM;
sim_surface.mu = ROBOT2_SIM_MU;
for(int i=0;i<MY_ODE_MAX_CONTACT_NUM;i++)
{
box1.contacts[i].surface = sim_surface;
box2.contacts[i].surface = sim_surface;
box3.contacts[i].surface = sim_surface;
}
--------------------------------------------------------
Here is the part of the header with my declarations:
dJointGroupID contact_joint_group; // group for contact joints
dJointGroupID hinge_joint_group; // group for robot hinge joints
dJointGroupID friction_joint_group; // group for robot friction joints
dWorldID world;
dSpaceID space;
dSurfaceParameters sim_surface; //default surfaces for simulation
-----------------------------------------------------------------------------
Thanks for your help.
Dvir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20060629/d5d2897a/attachment.htm
More information about the ODE
mailing list