You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(13) |
Apr
|
May
(1) |
Jun
(34) |
Jul
(23) |
Aug
(16) |
Sep
|
Oct
(11) |
Nov
(13) |
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(2) |
Feb
(3) |
Mar
(13) |
Apr
(1) |
May
(5) |
Jun
(11) |
Jul
(5) |
Aug
(10) |
Sep
(16) |
Oct
(8) |
Nov
(4) |
Dec
(5) |
2006 |
Jan
(18) |
Feb
(5) |
Mar
(6) |
Apr
(12) |
May
(3) |
Jun
(1) |
Jul
(4) |
Aug
(16) |
Sep
(1) |
Oct
(5) |
Nov
(35) |
Dec
(7) |
2007 |
Jan
(17) |
Feb
(14) |
Mar
(7) |
Apr
(9) |
May
(16) |
Jun
(31) |
Jul
(13) |
Aug
(23) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(1) |
2008 |
Jan
(8) |
Feb
(1) |
Mar
(3) |
Apr
(2) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2009 |
Jan
|
Feb
(5) |
Mar
|
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(5) |
Sep
(1) |
Oct
|
Nov
(3) |
Dec
|
2010 |
Jan
(6) |
Feb
(6) |
Mar
(10) |
Apr
(5) |
May
(11) |
Jun
|
Jul
|
Aug
(2) |
Sep
(8) |
Oct
(2) |
Nov
(3) |
Dec
(5) |
2011 |
Jan
(7) |
Feb
|
Mar
(1) |
Apr
(3) |
May
(10) |
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: Maciej K. <mka...@gm...> - 2006-05-31 20:26:02
|
Does anyone have any experience with using ODE/pyODE for finding the *closest* point of intersection between a particular geom and theh rest of the geoms? Basically I'm thinking of using a single-triangle TriMesh as a cone-shaped (but 2D, hence triangular/pie-shaped) "sensor" anchored at my subject, and want this sensor to give me the range to the closest obstacle. I've experimented with the collision detection routines in pyODE, and it looks like I might get it to work, but the issue is that I get back collision contact points, which usually don't necessarily correspond to the *closest* point, and for certain shallow collisions, when there is only a single contact generated, I get slightly weird/erroneous position of that single contact. I guess I'm wondering if there is a way to modify/choose an alternate contact point generating method. Any ideas? If anyone is interested or it would help the discussion, I can post my little test program illustrating the issue (pyODE + PyOpenGL + glut). |
From: Matthias B. <ba...@ir...> - 2006-05-30 14:25:06
|
Chris Bainbridge wrote: > Mass.setBoxTotal seems to be missing from the wrappers, the patch is > trivial: > [...] Thanks, it's applied and checked in. I also added the other set*Total() methods (for cylinder, ccylinder and sphere). - Matthias - |
From: Chris B. <chr...@gm...> - 2006-05-28 10:21:48
|
Mass.setBoxTotal seems to be missing from the wrappers, the patch is trivia= l: diff -ur PyODE-1.1.0.orig/src/declarations.pyx PyODE-1.1.0/src/declarations= .pyx --- PyODE-1.1.0.orig/src/declarations.pyx 2005-05-05 18:41:33.000000000 +0100 +++ PyODE-1.1.0/src/declarations.pyx 2006-05-27 19:38:23.000000000 +0100 @@ -302,6 +302,8 @@ dReal radius, dReal length) void dMassSetBox (dMass *, dReal density, dReal lx, dReal ly, dReal lz) + void dMassSetBoxTotal (dMass *, dReal total_mass, + dReal lx, dReal ly, dReal lz) void dMassAdjust (dMass *, dReal newmass) void dMassTranslate (dMass *, dReal x, dReal y, dReal z) void dMassRotate (dMass *, dMatrix3 R) diff -ur PyODE-1.1.0.orig/src/mass.pyx PyODE-1.1.0/src/mass.pyx --- PyODE-1.1.0.orig/src/mass.pyx 2004-11-15 20:16:03.000000000 +0000 +++ PyODE-1.1.0/src/mass.pyx 2006-05-27 19:37:46.000000000 +0100 @@ -152,6 +152,25 @@ """ dMassSetBox(&self._mass, density, lx, ly, lz) + def setBoxTotal(self, total_mass, lx, ly, lz): + """setBoxTotal(total_mass, lx, ly, lz) + + Set the mass parameters to represent a box of the given + dimensions and density, with the center of mass at (0,0,0) + relative to the body. The side lengths of the box along the x, + y and z axes are lx, ly and lz. + + @param total_mass: The total mass of the box + @param lx: The length along the x axis + @param ly: The length along the y axis + @param lz: The length along the z axis + @type total_mass: float + @type lx: float + @type ly: float + @type lz: float + """ + dMassSetBoxTotal(&self._mass, total_mass, lx, ly, lz) + def adjust(self, newmass): """adjust(newmass) |
From: Matthias B. <ba...@ir...> - 2006-04-13 14:05:12
|
David Simon wrote: > I see from reading the list archives that a number of > people are adding a simple patch to their PyODE trees > to access the collide2 function. Is there any > particular reason this isn't a part of the main PyODE > distribution? Other than that I have been too busy adding it yet? No. I've just committed the change, so collide2() is available now. (note that SF still has problems with their cvs service and anonymous cvs is currently disabled, so you might have to wait some more days until you see that change). > Secondly, is there a way of removing a Body from a > World, ala C++ ODE's dBodyDestroy function? Well, the problem is that dBodyDestroy does not only remove the body from a world but it also destroys the body object. The function is called in the destructor of the Body object so it might get called when you delete all references to your body. As far as I know there is no ODE function that only removes the body from the world without destroying the body object. - Matthias - |
From: Chris B. <chr...@gm...> - 2006-04-10 16:50:30
|
On 10/04/06, Chris Bainbridge <chr...@gm...> wrote: > On 10/04/06, Hart's Antler <bha...@ya...> wrote: > > python bails hard when i do j.setAxis( (0,0,1) ) with a SliderJoint? U= sing pyode 1.1 and > > python2.4 on win32. can anyone confirm the code below crashes? Incidentally, the crash is in dJointSetSliderAxis () from /usr/lib/python2.4/site-packages/ode.so The ode source for this function: extern "C" void dJointSetSliderAxis (dxJointSlider *joint, dReal x, dReal y, dReal z) { int i; dUASSERT(joint,"bad joint argument"); dUASSERT(joint->vtable =3D=3D &__dslider_vtable,"joint is not a slider"); setAxes (joint,x,y,z,joint->axis1,0); // compute initial relative rotation body1 -> body2, or env -> body1 // also compute center of body1 w.r.t body 2 if (joint->node[1].body) { <cut> } else { // set joint->qrel to the transpose of the first body's q joint->qrel[0] =3D joint->node[0].body->q[0]; so if the bodies aren't set, either of those body references are going to cause a lookup of a random or null address, depending on how the pointer is initialised. You might like to report the bug to the ODE project. There should at least be an assert checking that the bodies are set. |
From: Frank B. <fb...@fo...> - 2006-04-10 16:48:54
|
Hallo, Hart's Antler hat gesagt: // Hart's Antler wrote: > python bails hard when i do j.setAxis( (0,0,1) ) with a SliderJoint? Using pyode 1.1 and > python2.4 on win32. can anyone confirm the code below crashes? > > from ode import * > w = World() > j = SliderJoint(w) > j.setAxis( (0,0,1) ) > # should crash now This code crashes on Linux, too, we just call it segfault ;) Python 2.3.5, pyode-CVS from about Feb 19, and libode from Debian, 1:0.5-3 Ciao -- Frank Barknecht _ ______footils.org_ __goto10.org__ |
From: Chris B. <chr...@gm...> - 2006-04-10 16:41:52
|
On 10/04/06, Hart's Antler <bha...@ya...> wrote: > python bails hard when i do j.setAxis( (0,0,1) ) with a SliderJoint? Usi= ng pyode 1.1 and > python2.4 on win32. can anyone confirm the code below crashes? > > from ode import * > w =3D World() > j =3D SliderJoint(w) > j.setAxis( (0,0,1) ) > # should crash now yup, crashes under Linux too. The following doesn't crash. from ode import * w =3D World() b0 =3D Body(w) b1 =3D Body(w) j =3D SliderJoint(w) j.attach(b0, b1) j.setAxis( (0,0,1) ) |
From: Hart's A. <bha...@ya...> - 2006-04-10 16:30:43
|
python bails hard when i do j.setAxis( (0,0,1) ) with a SliderJoint? Using pyode 1.1 and python2.4 on win32. can anyone confirm the code below crashes? from ode import * w = World() j = SliderJoint(w) j.setAxis( (0,0,1) ) # should crash now __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Robert R. <tif...@ho...> - 2006-04-07 13:30:15
|
It works! That would make you a genius (at least in my book!) Thank you for the help! >From: Hart's Antler <bha...@ya...> >To: Robert Reed <tif...@ho...>, >pyo...@li... >Subject: Re: [Pyode-user] embarrased that I can't figure this one out >Date: Thu, 6 Apr 2006 20:43:39 -0700 (PDT) > >hi again robert, > >you had your ERP (error reduction param) very high, so i tuned that lower >and that caused the >error of slipping below the floor to increase from -20 to -90, so the >problem was your mass was >too high, so i lowered that to 10 and now it works how i think you want. > >import ode,time > >def near_callback(args, geom1, geom2): > contacts = ode.collide(geom1, geom2) > world, contactgroup = args > for c in contacts: > #c.setBounce(0.2) > #c.setMu(5000) > j = ode.ContactJoint(world, contactgroup, c) > j.attach(geom1.getBody(), geom2.getBody()) > >contactgroup = ode.JointGroup() >world = ode.World() >world.setGravity( (0, 0, -9.81) ) >world.setERP(0.1) >world.setCFM(1E-5) > >space = ode.Space() > >floor = ode.GeomPlane(space, (0,0,1), 0) > >body = ode.Body(world) >M = ode.Mass() >M.setBox(10, 10, 10, 10) >body.setMass(M) >geom = ode.GeomBox(space, (10, 10, 10)) >geom.setBody(body) >body.setPosition((50, 50, 50)) > >fps = 80.0 >dt = 1.0/fps > >while True: > pos = body.getPosition() > print 'z = ', pos > space.collide((world, contactgroup), near_callback) > world.step(dt) > contactgroup.empty() > time.sleep(0.01) > > > >__________________________________________________ >Do You Yahoo!? >Tired of spam? Yahoo! Mail has the best spam protection around >http://mail.yahoo.com |
From: Hart's A. <bha...@ya...> - 2006-04-07 03:43:46
|
hi again robert, you had your ERP (error reduction param) very high, so i tuned that lower and that caused the error of slipping below the floor to increase from -20 to -90, so the problem was your mass was too high, so i lowered that to 10 and now it works how i think you want. import ode,time def near_callback(args, geom1, geom2): contacts = ode.collide(geom1, geom2) world, contactgroup = args for c in contacts: #c.setBounce(0.2) #c.setMu(5000) j = ode.ContactJoint(world, contactgroup, c) j.attach(geom1.getBody(), geom2.getBody()) contactgroup = ode.JointGroup() world = ode.World() world.setGravity( (0, 0, -9.81) ) world.setERP(0.1) world.setCFM(1E-5) space = ode.Space() floor = ode.GeomPlane(space, (0,0,1), 0) body = ode.Body(world) M = ode.Mass() M.setBox(10, 10, 10, 10) body.setMass(M) geom = ode.GeomBox(space, (10, 10, 10)) geom.setBody(body) body.setPosition((50, 50, 50)) fps = 80.0 dt = 1.0/fps while True: pos = body.getPosition() print 'z = ', pos space.collide((world, contactgroup), near_callback) world.step(dt) contactgroup.empty() time.sleep(0.01) __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Robert R. <tif...@ho...> - 2006-04-07 01:15:41
|
Thank you for looking at my code snippet! Unfortunately, none of the changes you suggested seemed to help. (including the change of mass) Does it work for you? If it does, that might show I have something wrong underneath. >From: Hart's Antler <bha...@ya...> >To: Robert Reed <tif...@ho...>, >pyo...@li... >Subject: Re: [Pyode-user] embarrased that I can't figure this one out >Date: Thu, 6 Apr 2006 13:32:55 -0700 (PDT) > >hi robert, > >try this: > >world.setERP(0.2) >world.setCFM(0.05) > >and every frame do: >v = vec3( body.getLinearVel() ) >body.addForce( -v*0.1 ) ># this add air friction > >your mass looks pretty high also, i usally keep in ranges of 0-100 > >good luck, >-brett > >--- Robert Reed <tif...@ho...> wrote: > > > Help! > > ok, I tried to boil down the pyode tutorial 3 to a very simple 38 line > > program just to test it. There are only two bodies - a plane and a box. > > The print function at the bottom is the only output. In theory, the >box > > should fall and stop. > > > > Interestingly, the callback seems to be called at the correct time (when >z > > is just less than 5) but the box falls too far (say -20) and then >bounces > > too high (back to near 46). It's like the plane is made of very soft > > rubber. Tutorial 3 does not display this behavior - the blocks fall and > > stop. > > > > I have been playing with this code far too long - adjusting various > > parameters (bounce, etc) with no luck. I must be missing something > > obvious... > > > > Any help would be greatly appreciated. Thanks! > > > > Here is the code: > > > > import ode > > > > def near_callback(args, geom1, geom2): > > contacts = ode.collide(geom1, geom2) > > world, contactgroup = args > > for c in contacts: > > c.setBounce(0.2) > > c.setMu(5000) > > j = ode.ContactJoint(world, contactgroup, c) > > j.attach(geom1.getBody(), geom2.getBody()) > > > > contactgroup = ode.JointGroup() > > world = ode.World() > > world.setGravity( (0, 0, -9.81) ) > > world.setERP(0.8) > > world.setCFM(1E-5) > > > > space = ode.Space() > > > > floor = ode.GeomPlane(space, (0,0,1), 0) > > > > body = ode.Body(world) > > M = ode.Mass() > > M.setBox(10000, 10, 10, 10) > > body.setMass(M) > > geom = ode.GeomBox(space, (10, 10, 10)) > > geom.setBody(body) > > body.setPosition((50, 50, 50)) > > > > fps = 80.0 > > dt = 1.0/fps > > > > while True: > > pos = body.getPosition() > > print 'z = ', pos > > space.collide((world, contactgroup), near_callback) > > world.step(dt) > > contactgroup.empty( > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by xPML, a groundbreaking scripting >language > > that extends applications into web and mobile media. Attend the live >webcast > > and join the prime developer group breaking into this new coding >territory! > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > > _______________________________________________ > > Pyode-user mailing list > > Pyo...@li... > > https://lists.sourceforge.net/lists/listinfo/pyode-user > > > > >__________________________________________________ >Do You Yahoo!? >Tired of spam? Yahoo! Mail has the best spam protection around >http://mail.yahoo.com |
From: Hart's A. <bha...@ya...> - 2006-04-06 20:33:48
|
hi everybody, just wondering if there were any pyode users in the philippines? -brett __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Hart's A. <bha...@ya...> - 2006-04-06 20:33:06
|
hi robert, try this: world.setERP(0.2) world.setCFM(0.05) and every frame do: v = vec3( body.getLinearVel() ) body.addForce( -v*0.1 ) # this add air friction your mass looks pretty high also, i usally keep in ranges of 0-100 good luck, -brett --- Robert Reed <tif...@ho...> wrote: > Help! > ok, I tried to boil down the pyode tutorial 3 to a very simple 38 line > program just to test it. There are only two bodies - a plane and a box. > The print function at the bottom is the only output. In theory, the box > should fall and stop. > > Interestingly, the callback seems to be called at the correct time (when z > is just less than 5) but the box falls too far (say -20) and then bounces > too high (back to near 46). It's like the plane is made of very soft > rubber. Tutorial 3 does not display this behavior - the blocks fall and > stop. > > I have been playing with this code far too long - adjusting various > parameters (bounce, etc) with no luck. I must be missing something > obvious... > > Any help would be greatly appreciated. Thanks! > > Here is the code: > > import ode > > def near_callback(args, geom1, geom2): > contacts = ode.collide(geom1, geom2) > world, contactgroup = args > for c in contacts: > c.setBounce(0.2) > c.setMu(5000) > j = ode.ContactJoint(world, contactgroup, c) > j.attach(geom1.getBody(), geom2.getBody()) > > contactgroup = ode.JointGroup() > world = ode.World() > world.setGravity( (0, 0, -9.81) ) > world.setERP(0.8) > world.setCFM(1E-5) > > space = ode.Space() > > floor = ode.GeomPlane(space, (0,0,1), 0) > > body = ode.Body(world) > M = ode.Mass() > M.setBox(10000, 10, 10, 10) > body.setMass(M) > geom = ode.GeomBox(space, (10, 10, 10)) > geom.setBody(body) > body.setPosition((50, 50, 50)) > > fps = 80.0 > dt = 1.0/fps > > while True: > pos = body.getPosition() > print 'z = ', pos > space.collide((world, contactgroup), near_callback) > world.step(dt) > contactgroup.empty( > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Pyode-user mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyode-user > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Robert R. <tif...@ho...> - 2006-04-06 20:16:35
|
Help! ok, I tried to boil down the pyode tutorial 3 to a very simple 38 line program just to test it. There are only two bodies - a plane and a box. The print function at the bottom is the only output. In theory, the box should fall and stop. Interestingly, the callback seems to be called at the correct time (when z is just less than 5) but the box falls too far (say -20) and then bounces too high (back to near 46). It's like the plane is made of very soft rubber. Tutorial 3 does not display this behavior - the blocks fall and stop. I have been playing with this code far too long - adjusting various parameters (bounce, etc) with no luck. I must be missing something obvious... Any help would be greatly appreciated. Thanks! Here is the code: import ode def near_callback(args, geom1, geom2): contacts = ode.collide(geom1, geom2) world, contactgroup = args for c in contacts: c.setBounce(0.2) c.setMu(5000) j = ode.ContactJoint(world, contactgroup, c) j.attach(geom1.getBody(), geom2.getBody()) contactgroup = ode.JointGroup() world = ode.World() world.setGravity( (0, 0, -9.81) ) world.setERP(0.8) world.setCFM(1E-5) space = ode.Space() floor = ode.GeomPlane(space, (0,0,1), 0) body = ode.Body(world) M = ode.Mass() M.setBox(10000, 10, 10, 10) body.setMass(M) geom = ode.GeomBox(space, (10, 10, 10)) geom.setBody(body) body.setPosition((50, 50, 50)) fps = 80.0 dt = 1.0/fps while True: pos = body.getPosition() print 'z = ', pos space.collide((world, contactgroup), near_callback) world.step(dt) contactgroup.empty( |
From: Miles J. <mil...@ho...> - 2006-04-02 09:10:49
|
This seems to work: # pyODE example 3: Collision detection # Originally by Matthias Baas. # Update by Miles Jacobs to make collision detection work with VPython. # With thanks to http://python.matrix.jp/projects/pyogre/ode_test2.py. import sys, os, random, time from math import * from visual import * import ode # geometric utility functions def scalp (vec, scal): vec[0] *= scal vec[1] *= scal vec[2] *= scal def length (vec): return sqrt (vec[0]**2 + vec[1]**2 + vec[2]**2) # create_box def create_box(world, space, density, lx, ly, lz): """Create a box body and its corresponding geom.""" # Create body body = ode.Body(world) M = ode.Mass() M.setBox(density, lx, ly, lz) body.setMass(M) # Set parameters for drawing the body body.shape = "box" body.boxsize = (lx, ly, lz) # Create a box geom for collision detection geom = ode.GeomBox(space, lengths=body.boxsize) geom.setBody(body) return body # drop_object def drop_object(): """Drop an object into the scene.""" global bodies, counter, objcount body = create_box(world, space, 1000, 1.0,1.0,1.0) body.setPosition((random.gauss(0,0.1),10.0,random.gauss(0,0.1))) theta = random.uniform(0,2*pi) ct = cos (theta) st = sin (theta) body.setRotation([ct, 0., -st, 0., 1., 0., st, 0., ct]) icecube = box(pos=body.getPosition(), axis=(ct,0.,st), length=1.0, height=1.0, width=1.0, color=(random.gauss(0,1),random.gauss(0,1),random.gauss(0,1))) bodies.append(body) cubes.append(icecube) counter=0 objcount+=1 # explosion def explosion(): """Simulate an explosion. Every object is pushed away from the origin. The force is dependent on the objects distance from the origin. """ global bodies for b in bodies: l=b.getPosition () d = length (l) a = max(0, 800000*(1.0-0.2*d*d)) l = [l[0] / 4, l[1], l[2] /4] scalp (l, a / length (l)) b.addForce(l) # pull def pull(): """Pull the objects back to the origin. Every object will be pulled back to the origin. Every couple of frames there'll be a thrust upwards so that the objects won't stick to the ground all the time. """ global bodies, counter for b in bodies: l=list (b.getPosition ()) scalp (l, -100000 / length (l)) b.addForce(l) if counter%60==0: b.addForce((0,100000,0)) # Collision callback def near_callback(args, geom1, geom2): """Callback function for the collide() method. This function checks if the given geoms do collide and creates contact joints if they do. """ # Check if the objects do collide contacts = ode.collide(geom1, geom2) # Create contact joints world,contactgroup = args for c in contacts: c.setBounce(0.2) c.setMu(5000) j = ode.ContactJoint(world, contactgroup, c) j.attach(geom1.getBody(), geom2.getBody()) ###################################################################### # Create a world object world = ode.World() world.setGravity( (0,-9.81,0) ) world.setERP(0.8) world.setCFM(1E-5) # Create a space object space = ode.Space() # Create a plane geom which prevent the objects from falling forever floor = ode.GeomPlane(space, (0,1,0), 0) ground=box(pos=(0,-0.1,0), width=20, height=0.1, length=20, color=color.white) # A list with ODE bodies and Visual objects to see the bodies bodies = [] cubes = [] # A joint group for the contact joints that are generated whenever # two bodies collide contactgroup = ode.JointGroup() # Some variables used inside the simulation loop fps = 25 dt = 1.0/fps running = True state = 0 counter = 0 objcount = 0 scene.autoscale=0 scene.forward=(-5,-5,-5) while(1): global counter, state counter += 1 if state==0: if counter==20: drop_object() if objcount==10: state=1 counter=0 # State 1: Explosion and pulling back the objects elif state==1: if counter==100: explosion() if counter>300: pull() if counter==500: counter=20 for b in range(len(bodies)): x,y,z = bodies[b].getPosition() R = bodies[b].getRotation() cubes[b].pos=(x,y,z) cubes[b].axis=R[0], R[3], R[6] cubes[b].up=R[1], R[4], R[7] print state, counter # Simulate n = 2 for i in range(n): # Detect collisions and create contact joints space.collide((world,contactgroup), near_callback) # Simulation step world.step(dt/n) # Remove all contact joints contactgroup.empty() rate(10) _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ |
From: Miles J. <mil...@ho...> - 2006-03-24 21:18:10
|
I have tried to modify tutorial 3 to work with VPython. The blocks seem to collide OK, but some of them come to rest on their edges. I probably misunderstand the nature of the rotation matrix, or the "up" method in VPython. Would appreciate any help. Here is the code (running on Windows): # pyODE example 3: Collision detection # Originally by Matthias Baas. # Attempt by Miles Jacobs to make collision detection work with VPython. import sys, os, random, time from math import * from visual import * import ode from Scientific.Geometry import * from Scientific.Geometry.TensorModule import * from Scientific.Geometry.Transformation import * # geometric utility functions def scalp (vec, scal): vec[0] *= scal vec[1] *= scal vec[2] *= scal def length (vec): return sqrt (vec[0]**2 + vec[1]**2 + vec[2]**2) # create_box def create_box(world, space, density, lx, ly, lz): """Create a box body and its corresponding geom.""" # Create body body = ode.Body(world) M = ode.Mass() M.setBox(density, lx, ly, lz) body.setMass(M) # Set parameters for drawing the body body.shape = "box" body.boxsize = (lx, ly, lz) # Create a box geom for collision detection geom = ode.GeomBox(space, lengths=body.boxsize) geom.setBody(body) return body # drop_object def drop_object(): """Drop an object into the scene.""" global bodies, counter, objcount body = create_box(world, space, 1000, 1.0,1.0,1.0) body.setPosition((random.gauss(0,0.1),10.0,random.gauss(0,0.1))) theta = random.uniform(0,2*pi) ct = cos (theta) st = sin (theta) body.setRotation([ct, 0., -st, 0., 1., 0., st, 0., ct]) matpot=Tensor([[ct, 0., -st],[0., 1., 0.],[st, 0., ct]]) matkettle=Rotation(matpot) bodyaxis, bodyangle = matkettle.axisAndAngle() icecube = box(pos=body.getPosition(), axis=bodyaxis, length=1.0, height=1.0, width=1.0, color=(random.gauss(0,1),random.gauss(0,1),random.gauss(0,1))) bodies.append(body) cubes.append(icecube) counter=0 objcount+=1 # explosion def explosion(): """Simulate an explosion. Every object is pushed away from the origin. The force is dependent on the objects distance from the origin. """ global bodies for b in bodies: l=b.getPosition () d = length (l) a = max(0, 800000*(1.0-0.2*d*d)) l = [l[0] / 4, l[1], l[2] /4] scalp (l, a / length (l)) b.addForce(l) # pull def pull(): """Pull the objects back to the origin. Every object will be pulled back to the origin. Every couple of frames there'll be a thrust upwards so that the objects won't stick to the ground all the time. """ global bodies, counter for b in bodies: l=list (b.getPosition ()) scalp (l, -100000 / length (l)) b.addForce(l) if counter%60==0: b.addForce((0,100000,0)) # Collision callback def near_callback(args, geom1, geom2): """Callback function for the collide() method. This function checks if the given geoms do collide and creates contact joints if they do. """ # Check if the objects do collide contacts = ode.collide(geom1, geom2) # Create contact joints world,contactgroup = args for c in contacts: c.setBounce(0.2) c.setMu(5000) j = ode.ContactJoint(world, contactgroup, c) j.attach(geom1.getBody(), geom2.getBody()) ###################################################################### # Create a world object world = ode.World() world.setGravity( (0,-9.81,0) ) world.setERP(0.8) world.setCFM(1E-5) # Create a space object space = ode.Space() # Create a plane geom which prevent the objects from falling forever floor = ode.GeomPlane(space, (0,1,0), 0) ground=box(pos=(0,-0.1,0), width=20, height=0.1, length=20, color=color.white) # A list with ODE bodies and Visual objects to see the bodies bodies = [] cubes = [] # A joint group for the contact joints that are generated whenever # two bodies collide contactgroup = ode.JointGroup() # Some variables used inside the simulation loop fps = 25 dt = 1.0/fps running = True state = 0 counter = 0 objcount = 0 scene.autoscale=0 scene.forward=(-5,-5,-5) while(1): global counter, state counter += 1 if state==0: if counter==20: drop_object() if objcount==10: state=1 counter=0 # State 1: Explosion and pulling back the objects elif state==1: if counter==100: explosion() if counter>300: pull() if counter==500: counter=20 for b in range(len(bodies)): x,y,z = bodies[b].getPosition() R = bodies[b].getRotation() pot=Tensor([[R[0],R[3],R[6]],[R[1],R[4],R[7]],[R[2],R[5],R[8]]]) kettle=Rotation(pot) bodyaxis, bodyangle = kettle.axisAndAngle() cubes[b].pos=(x,y,z) cubes[b].axis=bodyaxis cubes[b].angle=bodyangle print state, counter # Simulate n = 2 for i in range(n): # Detect collisions and create contact joints space.collide((world,contactgroup), near_callback) # Simulation step world.step(dt/n) # Remove all contact joints contactgroup.empty() rate(10) Miles. _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ |
From: David S. <chl...@ya...> - 2006-03-21 07:33:26
|
A couple questions: I see from reading the list archives that a number of people are adding a simple patch to their PyODE trees to access the collide2 function. Is there any particular reason this isn't a part of the main PyODE distribution? I'll put it into patch format if neccessary, but I too need this function, and it would be more aesthetically pleasing if it were part of the main PyODE distribution rather than some special one I have to package with my app. Secondly, is there a way of removing a Body from a World, ala C++ ODE's dBodyDestroy function? __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Chris B. <chr...@gm...> - 2006-03-17 00:04:20
|
On 16/03/06, Lionel barret De Nazaris <lio...@fr...> wrote: > Hello all, > I face a strange problem using pyODE. Hi, I haven't run your code (couldn't see an ebuild for SiGL in Gentoo), but you ERP looks very high (1.0), 0.2 is the default I think, and the ODE manual says 0.2-0.8 is an acceptable range. You might want to try playing with a global CFM value as well (I'm using 10**-3, I think the default is 0 though). ODE doesn't like hard constraints or over correcting errors. |
From: Lionel b. De N. <lio...@fr...> - 2006-03-16 19:49:04
|
Hello all, I face a strange problem using pyODE. [ I am quite new with this engine, but I think I have done my homework and read the doc carefully. So I hope i won't add Noise in the mailing list.] Mainly, the objects are inter penetrating. I have read the faq (especially this section http://www.ode.org/ode-latest-userguide.html#sec_12_3_0 ) but I am quite surprised of the low quality of the result I get (i.e the deepness of interpenetration). I have few object, all of them are axis aligned boxes. Collision Detection and response should be quite simple, at least much simpler than with complex meshes. You can look the script at this address : http://pastebin.com/605773 I have set up a group of cubes with a initial linear velocity and let the glide and bounce inside a room (simulated by a list of GeomPlane). This simulation is supposed to be 2D, so I constrained the cubes with a very low ceiling (slightly higher than they are) and I reset their Z coord (position; speed, rotation) to their original value. I had to do this because, if not, the cubes would go upward or downward after a collision (???). Frankly, I am quite puzzled by the whole thing. So if a generous soul wants to help, any input is welcome. -- Lionel Barret De Nazaris ================================================= Gamr7.com > http://www.gamr7.com |
From: Chris B. <chr...@gm...> - 2006-03-09 14:42:52
|
On 09/03/06, Robert Reed <tif...@ho...> wrote: > Does anyone know how to do a plain cylinder geom (not a capped cylinder > geom)? The cylinder geom exists in in the C API but appears to be missi= ng > in PyODE. (of course, I could be missing something.) > > I find this strange because there is an ode.Mass.setCylinder AND and an > ode.Mass.setCCylinder but no equivalent plain cylinder geom (i.e. no > 'ode.GeomCylinder' while there is a 'ode.GeomCCylinder'). The cylinder geom is non-standard (it's in the contrib directory of ODE). There were apparently some disagreements about whether it was implemented properly so it hasn't made it into the main package yet, but someone mentioned that ode-0.6 might well have it. There is also no pyode wrapper yet, although it shouldn't be too difficult to modify the ccylinder one. |
From: Robert R. <tif...@ho...> - 2006-03-09 12:53:58
|
Does anyone know how to do a plain cylinder geom (not a capped cylinder geom)? The cylinder geom exists in in the C API but appears to be missing in PyODE. (of course, I could be missing something.) I find this strange because there is an ode.Mass.setCylinder AND and an ode.Mass.setCCylinder but no equivalent plain cylinder geom (i.e. no 'ode.GeomCylinder' while there is a 'ode.GeomCCylinder'). Thanks! Grant |
From: Chris B. <chr...@gm...> - 2006-02-27 10:50:21
|
On 27/02/06, Fred Burton <fl...@ys...> wrote: > > > According to the ode manual you should be using > > GeomRay.set(px,py,pz,dx,dy,dz) to set the position and direction. > > > > Hmm... > > ray.set takes two parameters > > (or some such) > > I've tried ray.set((px,py,pz,dx,dy,dz)) ... Use the source, Luke: (in geoms.pyx) cdef class GeomRay(GeomObject): ... def set(self, p, u): dGeomRaySet(self.gid, p[0],p[1],p[2], u[0],u[1],u[2]) ie. set() takes a pair of tuples (or lists), and calls dGeomRaySet with the contents. |
From: Chris B. <chr...@gm...> - 2006-02-26 10:41:31
|
On 26/02/06, Fred Burton <fl...@ys...> wrote: > File "ccluster.py", line 511, in trace_root > ray.setPosition(pstart) > File "geomobject.pyx", line 135, in ode.GeomObject.setPosition > ValueError: Cannot set a position on non-placeable geoms. > > ? > > What _should_ I be doing? According to the ode manual you should be using GeomRay.set(px,py,pz,dx,dy,dz) to set the position and direction. |
From: Fred B. <fl...@ys...> - 2006-02-26 03:21:37
|
I was going to replace my own ray tracing code, to use GeomRay and collide, but I'm not sure how to get the GeomRay positioned and oriented. I wrote some simple code to create a matrix to orient the ray, but then when I go to position it: File "ccluster.py", line 511, in trace_root ray.setPosition(pstart) File "geomobject.pyx", line 135, in ode.GeomObject.setPosition ValueError: Cannot set a position on non-placeable geoms. ? What _should_ I be doing? |
From:
<mar...@gm...> - 2006-02-22 08:26:26
|
Add this code in ode.pyx near the end and recompile pyode: def collide2(geom1, geom2, arg, callback): cdef void* data cdef object tup cdef long id1 cdef long id2 id1 = geom1._id() id2 = geom2._id() tup = (callback, arg) data = <void*>tup dSpaceCollide2(<dGeomID>id1, <dGeomID>id2, data, collide_callback) And you will have collide2 funcion :) It will work like ordinary collide function just with this special space checking. I did this for me, because I too needed collide2 function between two spaces. -- Mārtiņš Možeiko -------- Original Message -------- > I just wanted to check: > At the moment, in PyODE, there is no (quick for spaces with many > objects) way to do check for collisions between objects in two different > spaces (like the collide2 function available in the C API of ODE) right? > > I was going to put static world things in one space, and dynamic things > in another space and do collide2 between them, putting them in one space > seems to waste so much time doing collision between static things that > it is faster to just use nested for loops to check the various pairings... > > (static, moving) > (stopped, moving) > (moving, moving) > > (where stopped are those that have body.enabled set to false) > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > _______________________________________________ > Pyode-user mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyode-user > |