OdeHelper.initODE2(0); space = OdeHelper.createSimpleSpace(); joints = OdeHelper.createJointGroup(); ground = OdeHelper.createPlane(space, 0, 0, 1, 0); world = OdeHelper.createWorld(); world.setGravity(0, 0, -.5); kbody = OdeHelper.createBody(world); kbody.setKinematic(); final double kx = 1, ky = 0, kz = .5; kbody.setPosition(kx, ky, kz); kbox = OdeHelper.createBox(space, 3, 3, .5); kbox.setBody(kbody); kpole = OdeHelper.createCylinder(space, .125, 1.5); kpole.setBody(kbody); kpole.setOffsetPosition(0, 0, 0.8); matraca = OdeHelper.createBody(world); matraca.setPosition(kx+0, ky+1, kz+1); matraca_geom = OdeHelper.createBox(space, 0.5, 2, 0.75); matraca_geom.setBody(matraca); DMass mass = OdeHelper.createMass(); mass.setBox(1, 0.5, 2, 0.75); matraca.setMass(mass); hinge = OdeHelper.createHingeJoint(world); hinge.attach(kbody, matraca);
public static DCapsule dCreateCapsule (DSpace space, double radius, double length) { return OdeHelper.createCapsule(space, radius, length); } //ODE_API
private void demo(String[] args) { OdeHelper.initODE2(0); contactgroup = OdeHelper.createJointGroup(); world = OdeHelper.createWorld(); world.setGravity (0,0,-0.5); world.setCFM (1e-5); space = OdeHelper.createSimpleSpace(null); OdeHelper.createPlane(space,0,0,1,0); body[i] = OdeHelper.createBody(world);//.create (world); double k = i*SIDE; body[i].setPosition (k,k,k+0.4); DMass m = OdeHelper.createMass(); m.setBox (1,SIDE,SIDE,SIDE); m.adjust (MASS); body[i].setData (i); box[i]= OdeHelper.createBox(space, SIDE,SIDE,SIDE); box[i].setBody (body[i]); joint[i] = OdeHelper.createBallJoint(world); //.create (world); joint[i].attach (body[i],body[i+1]); double k = (i+0.5)*SIDE; OdeHelper.closeODE();
Box()// : // body(world), // geom(space, 0.2, 0.2, 0.2) { body = OdeHelper.createBody(world); geom = OdeHelper.createBox(space, 0.2, 0.2, 0.2); DMass mass = OdeHelper.createMass(); mass.setBox(10, 0.2, 0.2, 0.2); body.setMass(mass); geom.setData(this); geom.setBody(body); } void draw() //const
private void demo(String[] args) { // create world OdeHelper.initODE2( 0 ); world = OdeHelper.createWorld(); space = OdeHelper.createSimpleSpace( null ); contactgroup = OdeHelper.createJointGroup(); world.setGravity( 0,0,-0.5 ); world.setCFM( 1e-5 ); OdeHelper.createPlane( space,0,0,1,0 ); for (int i = 0; i < NUM; i++) obj[i] = new MyObject(); // run simulation dsSimulationLoop( args,352,288,this ); contactgroup.destroy(); space.destroy(); world.destroy(); OdeHelper.closeODE(); }
private void demo(String[] args) { int i,j; DMass m = OdeHelper.createMass(); // create world OdeHelper.initODE2(0); world = OdeHelper.createWorld(); space = OdeHelper.createHashSpace (null); contactgroup = OdeHelper.createJointGroup (); world.setGravity (0,0,-GRAVITY); ground = OdeHelper.createPlane (space,0,0,1,0); // bodies for (i=0; i<N1; i++) { for (j=0; j<N2; j++) { body[i][j] = OdeHelper.createBody (world); m.setBox (1,LENGTH,LENGTH,HEIGHT); m.adjust (MASS*(j+1)); body[i][j].setMass (m); body[i][j].setPosition (i*2*LENGTH,j*2*LENGTH,HEIGHT*0.5); box[i][j] = OdeHelper.createBox (space,LENGTH,LENGTH,HEIGHT); box[i][j].setBody (body[i][j]); } } // run simulation dsSimulationLoop (args,352,288,this); contactgroup.destroy(); space.destroy(); world.destroy(); OdeHelper.closeODE(); }
DMass m = OdeHelper.createMass(); obj[i].body = OdeHelper.createBody( world ); for ( k=0; k<3; k++ ) sides[k] = dRandReal()*0.5+0.1; obj[i].geom[0] = OdeHelper.createBox( space,sides[0],sides[1],sides[2] ); obj[i].geom[0] = OdeHelper.createCapsule( space,sides[0],sides[1] ); obj[i].geom[0] = OdeHelper.createCylinder (space,sides[0],sides[1]); obj[i].geom[0] = OdeHelper.createSphere( space,sides[0] ); obj[i].geom[0] = OdeHelper.createConvex( space, convexBunnyPlanes, convexBunnyPlaneCount, DTriMeshData new_tmdata = OdeHelper.createTriMeshData(); DTriMesh triMesh = OdeHelper.createTriMesh( null, new_tmdata, null, null, null );
int k; double[] sides = new double[3]; DMass m = OdeHelper.createMass(); boolean setBody; obj[i] = new MyObject(); obj[i].body = OdeHelper.createBody (world); for (k=0; k<3; k++) sides[k] = dRandReal()*0.5+0.1; obj[i].geom[0] = OdeHelper.createBox (space,sides[0],sides[1],sides[2]); obj[i].geom[0] = OdeHelper.createCapsule (space,sides[0],sides[1]); obj[i].geom[0] = OdeHelper.createCylinder (space,sides[0],sides[1]); obj[i].geom[0] = OdeHelper.createSphere (space,sides[0]);
private void demo(String[] args) { OdeHelper.initODE2(0); boolean fixed = true; world = OdeHelper.createWorld(); world.setERP (0.8); space = OdeHelper.createSimpleSpace (null); contactgroup = OdeHelper.createJointGroup(); geom[GROUND] = OdeHelper.createPlane (space, 0,0,1,0); geom[GROUND].setCategoryBits (catBits[GROUND]); geom[GROUND].setCollideBits (catBits[ALL]); DMass m = OdeHelper.createMass(); DMatrix3 R = new DMatrix3(); geom[OBS] = OdeHelper.createBox (space, OBS_SIDES[0], OBS_SIDES[1], OBS_SIDES[2]); geom[OBS].setCategoryBits (catBits[OBS]); geom[OBS].setCollideBits (catBits[ALL]); body[BODY2] = OdeHelper.createBody(world);//.create (world); geom[BODY2] = OdeHelper.createBox (space, BODY2_SIDES[0], BODY2_SIDES[1], BODY2_SIDES[2]); geom[BODY2].setBody (body[BODY2]); geom[BODY2].setOffsetRotation(R); body[BODY1] = OdeHelper.createBody(world);//.create (world); geom[BODY1] = OdeHelper.createCapsule (space, RADIUS, BODY1_LENGTH); geom[BODY1].setBody (body[BODY1]);
OdeHelper.initODE2(0); world = OdeHelper.createWorld(); world.setERP (0.8); space = OdeHelper.createSimpleSpace (null); contactgroup = OdeHelper.createJointGroup (); geomGROUND = OdeHelper.createPlane (space, 0,0,1,0); geomGROUND.setCategoryBits (catBits[GROUND]); geomGROUND.setCollideBits (catBits[ALL]); DMass m = OdeHelper.createMass(); bodyW = OdeHelper.createBody (world); geomW = OdeHelper.createBox (space, boxDim.get(X), boxDim.get(Y), boxDim.get(Z)); geomW.setBody (bodyW); geomW.setCategoryBits (catBits[W]); bodyD = OdeHelper.createBody(world); geomD = OdeHelper.createBox (space, boxDim.get(X), boxDim.get(Y), boxDim.get(Z)); geomD.setBody (bodyD); geomD.setCategoryBits (catBits[D]); geomEXT = OdeHelper.createBox (null, extDim.get(X), extDim.get(Y), extDim.get(Z)); geomEXT.setCategoryBits (catBits[EXT]); geomEXT.setCollideBits (
OdeHelper.initODE2(0); world = OdeHelper.createWorld(); world.setGravity(0,0,-0.5f); world.setCFM(1e-5f); space = OdeHelper.createSimpleSpace(null); contactgroup = OdeHelper.createJointGroup(); DPlane floor = OdeHelper.createPlane(space, 0,0,1,0); top1 = OdeHelper.createBody(world); top2 = OdeHelper.createBody(world); DMass m = OdeHelper.createMass(); m.setCylinderTotal(1, 3, topradius, toplength); top1.setMass(m); g1 = OdeHelper.createCylinder(space, topradius, toplength); g1.setBody(top1); g2 = OdeHelper.createCylinder(space, topradius, toplength); g2.setBody(top2); pin1 = OdeHelper.createCapsule(space, pinradius, pinlength); pin1.setBody(top1); pin2 = OdeHelper.createCapsule(space, pinradius, pinlength); pin2.setBody(top2); OdeHelper.closeODE();
private void demo(String[] args) { DMass m = OdeHelper.createMass(); OdeHelper.initODE2(0); world = OdeHelper.createWorld(); space = OdeHelper.createHashSpace (null); contactgroup = OdeHelper.createJointGroup (); world.setGravity (0,0,-9.8); world.setQuickStepNumIterations (20); segbodies[i] = OdeHelper.createBody (world); segbodies[i].setPosition(i - SEGMCNT/2.0, 0, 5); m.setBox (1, SEGMDIM[0], SEGMDIM[1], SEGMDIM[2]); segbodies[i].setMass (m); seggeoms[i] = OdeHelper.createBox (null, SEGMDIM[0], SEGMDIM[1], SEGMDIM[2]); seggeoms[i].setBody (segbodies[i]); space.add (seggeoms[i]); jfeedbacks[i] = OdeHelper.createJointFeedback(); hinges[i] = OdeHelper.createHingeJoint (world,null); hinges[i].attach (segbodies[i],segbodies[i+1]); hinges[i].setAnchor (i + 0.5 - SEGMCNT/2.0, 0, 5); stackbodies[i] = OdeHelper.createBody(world); m.setBox (2.0, 2, 2, 0.6); stackbodies[i].setMass(m); stackgeoms[i] = OdeHelper.createBox(null, 2, 2, 0.6); stackgeoms[i].setBody(stackbodies[i]); stackbodies[i].setPosition(0,0,8+2*i);
OdeHelper.initODE2(0); world = OdeHelper.createWorld(); space = OdeHelper.createHashSpace(null); contactgroup = OdeHelper.createJointGroup (); world.setGravity (0, 0, -0.5); OdeHelper.createPlane (space,0,0,1,0); m = OdeHelper.createMass(); for (i=0; i<NUM; i++) { body[i] = OdeHelper.createBody(world); k = i*SIDE; body[i].setPosition(k,k,k+0.4); m.adjust (MASS); body[i].setMass (m); sphere[i] = OdeHelper.createSphere (space,RADIUS); sphere[i].setBody(body[i]); joint[i] = OdeHelper.createBallJoint(world,null); joint[i].attach(body[i],body[i+1]); k = (i+0.5)*SIDE; space.destroy(); world.destroy(); OdeHelper.closeODE();
private void demo(String[] args) { int i; DMass m = OdeHelper.createMass(); OdeHelper.initODE2(0); world = OdeHelper.createWorld(); space = OdeHelper.createHashSpace(null); contactgroup = OdeHelper.createJointGroup(); world.setGravity (0,0,-0.5); ground = OdeHelper.createPlane(space,0,0,1,0); body[0] = OdeHelper.createBody(world); body[0].setPosition(0, 0, STARTZ); m.setBox(1, LENGTH, WIDTH, HEIGHT); m.adjust(CMASS); body[0].setMass(m); box[0] = OdeHelper.createBox (null,LENGTH,WIDTH,HEIGHT); box[0].setBody(body[0]); body[i] = OdeHelper.createBody(world); DQuaternion q = new DQuaternion(); OdeMath.dQFromAxisAndAngle (q,1,0,0,Math.PI*0.5); m.adjust(WMASS); body[i].setMass(m); sphere[i-1] = OdeHelper.createSphere (null,RADIUS); sphere[i-1].setBody(body[i]); joint[i] = OdeHelper.createHinge2Joint (world,null); joint[i].attach(body[0],body[i+1]);
private void demo(String[] args) DMass m = OdeHelper.createMass(); DMatrix3 R = new DMatrix3(); OdeHelper.initODE2(0); world = OdeHelper.createWorld(); space = OdeHelper.createHashSpace(null); contactgroup = OdeHelper.createJointGroup(); world.setGravity (0,0,-9.8); world.setQuickStepNumIterations (64); DTriMeshData Data = OdeHelper.createTriMeshData(); world_mesh = OdeHelper.createTriMesh(space, Data, null, null, null); world_mesh.enableTC(DSphere.class, false); world_mesh.enableTC(DBox.class, false); sphbody = OdeHelper.createBody(world); m.setSphere (1,RADIUS); sphbody.setMass (m); sphgeom = OdeHelper.createSphere(null, RADIUS); sphgeom.setBody (sphbody); reset_ball(); space.destroy (); world.destroy (); OdeHelper.closeODE();
private void demo(String [] args) { DMass m = OdeHelper.createMass(); DMatrix3 R = new DMatrix3(); OdeHelper.initODE2(0); world = OdeHelper.createWorld (); space = OdeHelper.createHashSpace (null); contactgroup = OdeHelper.createJointGroup (); world.setGravity (0,0,-9.8); world.setQuickStepNumIterations (12); int numi = world_indices.length; System.out.println("numv=" + numv + ", numi=" + numi); DTriMeshData data = OdeHelper.createTriMeshData(); world_mesh = OdeHelper.createTriMesh(space, data, null, null, null); world_mesh.setPosition(0, 0, 0.5); dRFromAxisAndAngle (R, 0,1,0, 0.0); boxbody = OdeHelper.createBody (world); m.setBox (1, BOXSZ, BOXSZ, BOXSZ); m.adjust (1); boxbody.setMass (m); boxgeom = OdeHelper.createBox (null, BOXSZ, BOXSZ, BOXSZ); boxgeom.setBody (boxbody); space.add (boxgeom); cylbody = OdeHelper.createBody (world); m.setSphere (1,RADIUS); m.adjust (WMASS);
private void demo(String[] args) { System.out.println("ODE configuration: " + OdeHelper.getConfiguration()); OdeHelper.initODE2(0); world = OdeHelper.createWorld (); space = OdeHelper.createHashSpace (null); contactgroup = OdeHelper.createJointGroup (); world.setGravity (0,0,-0.05); world.setCFM (1e-5); OdeHelper.createPlane( space, 0, 0, 1, 0 ); DHeightfieldData height = OdeHelper.createHeightfieldData(); gheight = OdeHelper.createHeightfield( space, height, true ); OdeHelper.closeODE();
OdeHelper.initODE(); dyn_world = OdeHelper.createWorld(); dyn_world.setERP (err_reduct); dyn_world.setCFM (cf_mixing); dyn_world.setGravity (0, 0.0, -1.0); coll_space_id = OdeHelper.createSimpleSpace (null); dyn_bodies[b] = OdeHelper.createBody(dyn_world); dyn_bodies[b].setPosition (x, y, z/2); DMass m = OdeHelper.createMass(); m.setBox (1, bodies_sides[b].get0(),bodies_sides[b].get1(),bodies_sides[b].get2()); m.adjust (0.1 * bodies_sides[b].get0() * bodies_sides[b].get1()); dyn_bodies[b].setMass (m); plane2d_joint_ids[b] = OdeHelper.createPlane2DJoint (dyn_world, null); plane2d_joint_ids[b].attach (dyn_bodies[b], null); OdeHelper.createPlane (coll_space_id, 1, 0, 0, 0); OdeHelper.createPlane (coll_space_id, -1, 0, 0, -STAGE_SIZE); OdeHelper.createPlane (coll_space_id, 0, 1, 0, 0); OdeHelper.createPlane (coll_space_id, 0, -1, 0, -STAGE_SIZE); coll_box_id = OdeHelper.createBox (coll_space_id, bodies_sides[b].get0(), bodies_sides[b].get1(), bodies_sides[b].get2()); coll_box_id.setBody (dyn_bodies[b]);
world = OdeHelper.createWorld(); space = OdeHelper.createSapSpace( null, DSapSpace.AXES.XYZ ); m = OdeHelper.createMass(); contactgroup = OdeHelper.createJointGroup(); world.setGravity (0,0,-1.5); world.setCFM (1e-5); OdeHelper.createPlane (space,0,0,1,0); wall_bodies[wb] = OdeHelper.createBody (world); wall_bodies[wb].setPosition (-20,y,z); m.setBox (1,WBOXSIZE,WBOXSIZE,WBOXSIZE); m.adjust (WALLMASS); wall_bodies[wb].setMass (m); wall_boxes[wb] = OdeHelper.createBox (space,WBOXSIZE,WBOXSIZE,WBOXSIZE); wall_boxes[wb].setBody (wall_bodies[wb]); b = OdeHelper.createBody (world); b.setPosition (x*RADIUS*2,y*RADIUS*2,z*RADIUS*2); m.setSphere (1,RADIUS); m.adjust (BALLMASS); b.setMass (m); sphere[spheres] = OdeHelper.createSphere (space,RADIUS); sphere[spheres++].setBody (b); b = OdeHelper.createBody (world);
OdeHelper.initODE2(0); contactgroup = OdeHelper.createJointGroup(); world = OdeHelper.createWorld(); space = OdeHelper.createSimpleSpace (null); DMass m = OdeHelper.createMass(); m.setBox (1,SIDE,SIDE,SIDE); m.adjust (MASS); body[0] = OdeHelper.createBody (world); body[0].setMass (m); body[0].setPosition (0,0,1); geom[0] = OdeHelper.createBox(space,SIDE,SIDE,SIDE); body[1] = OdeHelper.createBody (world); body[1].setMass (m); body[1].setPosition (0,0,2); geom[1] = OdeHelper.createBox(space,SIDE,SIDE,SIDE); lmotor[0] = OdeHelper.createLMotorJoint (world,null); lmotor[0].attach (body[0],body[1]); lmotor[1] = OdeHelper.createLMotorJoint (world,null); lmotor[1].attach (body[0],null); amotor[0] = OdeHelper.createAMotorJoint (world,null); amotor[0].attach (body[0],body[1]); amotor[1] = OdeHelper.createAMotorJoint (world,null); amotor[1].attach (body[0], null); space.destroy (); world.destroy (); OdeHelper.closeODE();