From: Marc K. <mki...@ga...> - 2011-03-08 22:54:31
|
Hi, I've asked this question before, but didn't get a response and thought I would try again. I'm trying to get forces at a contact joint. My original solution was to add a fixed joint and get feedback from it, however this is not accurate enough when I have multiple bodies colliding. However, when I try to use setFeedback on one of my contact joints, the following error results: ODE INTERNAL ERROR 2: Bad argument(s) in dJointSetFeedback() Aborted I've done some checking and getting forces from contact joints in c++ seems to work. Any idea why this doesn't work in PyODE? Thanks for any help or direction. Sincerely, Marc Killpack On Sun, Jan 16, 2011 at 4:45 AM, Ethan Glasser-Camp <gl...@cs...>wrote: > Hi! Sorry about the delay -- it's hard for me to find free time these days. > I'm not really familiar with vpython so I may be vastly misinterpreting the > function of your program. > > > On 01/11/2011 03:17 PM, Marc Killpack wrote: > >> I've been trying to make a simple robot simulator which includes >> collisions. I'm getting weird >> behavior though and wondered if I'm just making a dumb mistake. I want >> some objects that are >> fixed in the environment. From other examples and from archived questions >> on the list it seems like >> the best way to do this is using geometry objects that are not associated >> with a body. The only >> collision that works so far is if I collide with the floor plane that is >> defined as a fixed geometry. >> I've attached my file that uses vpython for visualization and I had the >> following questions if anyone >> is willing: >> >> 1)If I set a tall square in place, different sizes will result in >> collisions while smaller sizes do not, why? >> (Try changing width and length of square to 0.1 in line 56 of .py file to >> reproduce this) >> > > It looks like body1, your robot arm, is not being rotated. If I understand > correctly, this means that the capsule is extending along the Z-axis, > whereas you are drawing it as extending along the X-axis. That is to say, > your joint is not swinging the capsule like the arm of a turnstile, but more > like the head of a hammer. I think the box obstacle is sufficiently wide > that the capsule hits it anyhow, but if it is only 0.1, it fits "inside" the > the radius of the hammer swing. To fix this, I put: > > body1.setRotation([0, 0, 1, 0, 1, 0, -1, 0, 0]) > > Just after your body1.setPosition() call, before adding the geom. (A 90 > degree rotation around the Y axis, to exchange the X and Z axes, to make > your visualization line up with the simulation.) Now a collision always > happens. > > > Also, if I change the bounciness in the collision callback function (line >> 28), it seems to have no effect >> on the collision, why? >> > > I'm guessing the motor on the joint is sufficiently powerful to keep > pressing the body against the obstacle. Try changing MaxForce to 0 after the > first time step (at the end of the while loop), so that the body has an > initial velocity. You'll definitely see a bounce, and it will definitely be > different for different bouncinesses. > > > 2)I can place a geometry object that is a capped cylinder in the >> environment but how do I orient it? I tried >> setting the rotation, but still couldn't get a collision to occur. Change >> "OBSTACLE = 2" on line 9 to see this. >> > > This looks right to me, and once I added the rotation of the body (as per > point 1), this caused collisions. > > > 3)If I want forces from the collision, it seems that I have to have the >> obstacle be associated with a body >> as well, is that true? If so, what kind of hinge or connection should I >> use? I tried a fixed joint to the >> environment but that also did weird things. >> > I don't think this is true. Can you explain further? > > Ethan > > |