[ODE] Driving boxes on the arc or curve.

Seweryn Habdank-Wojewódzki habdank at megapolis.pl
Fri Oct 13 12:48:34 MST 2006


Hi

> I guess I'll take a stab at answering this, although I'm not an expert at 
> ODE.  That may not matter since it sounds like you're asking more "how do I 
> make physics work?" instead of "how do I make ODE work?"

No. Really not. More ODE than phisics :-).

In the works of M. Treibert (Phisical Reviev E vol. 62 nr. 2. August 2000, pp. 
1805-1824), there is a model which is simulating driver behavior. On his web 
site there is java code for that model and I want to redesign it and prepare 
in C++ based on ODE.

In the model:

dv/dt = a ( 1- v/v_max +s*(v,D)/s ), 

s is distance, and s* is expected distance, which is calculated as taken from 
Taylor series the first part, and used it to making short time prediction.

So If I have a dv/dt I can have a force. Simply multiplying by mass, is not 
it?

> It sounds like you want cars to follow a Bezier curve and to accelerate 
> based on their distance from the car in front of them.  You've simplified 
> the  problem tremendously by treating the car as a box and not doing any
> detailed  car physics.

Yes I need it. Because at the begining the model assumes that there is no 
collisions between the cars. So at present I want to do that, but by using 
ODE I will not close the door for the opportunity to include crashes in the 
future.

So to the code I need only box geoms with mass.

> If you want your cars to simply be floating boxes, you can just turn off
> gravity, by setting it to (0,0,0)

Yes I did it. 

> , which I believe it defaults to.  You could  
> also reset the position of the car every frame to its current x and y, but 
> the constant z to get it to hover off the ground.
> But this won't be necessary unless you have forces acting on the z axis.

Of course.
 
> You want your cars to have some known mass, so you can use ODE's density 
> functions, or simply assign a mass value directly, say 2000 lbs per car.

Mass and sizes - so mass and boxgeom - probably.

> Your acceleration force should be based on the car's known mass and the
>  distance to the car in front of it.  I believe ODE has a ray collision
>  object

But how far it can work. Presently I though, that I will base on the 
information about position and sizes from the predecessor, which is known 
because I have list of "cars", presently just points in the dWorld space. My 
task in next few days will be to add mas and proper geom for each.
Next I want to change my control form velocity control to the force control.

>that can be used to trace from the current car directly in front of it to 
>find how far the next car is away from it.  From that you'll need to 
>calculate whether you want to speed up, stay the same speed, or slow down and 
>then determine your acceleration from that.  If your cars hover off the 
>ground, there will be no friction, so you wouldn't want to always apply a 
>force from the wheels like in a real car.

Yes. At the beginning I need to do such a simplification.

>Instead you probably want to apply  
>some constant force in the case that you want the car to speed up, stop 
>applying the force when it's going fast enough, and apply a force in the 
>opposite direction when you need to slow down.  How fast you want your cars 
>to speed up or slow down is something you'll likely want to tweak so it looks 
>good, as long as it doesn't need to represent real world values.  But if did, 
>you'd have to start taking into account the variety of cars on the road and 
>differences in acceleration and mass between say a Dodge Viper and a school 
>bus.

Yes this is next thing. I have some real speed up characteristics form some 
cars which are present on the roads. I have XML file which contains 
parameters and I want to make internal list of cars, and random genratoer or 
user will decide what car is floating in the stream.

> If you want your cars to turn along a spline of some sort it's certainly 
>easiest to just set their orientation according to the values given by the 
>spline.  In other words you don't have to use torque, just set the 
>orientation of the car to what you want as you go along the spline.

Ok. So you suggest to take a differential of the splain and create singular 
vector from it. This will be a direction of the splain, and in the car set a 
force with direction from spline, abu absolute value with sign taken from M. 
Treiber formula.

This is a situation when the driver is driving on the e.g. not straight 
highway, but given by the Bezier curve.

To explain one more detail, I will parameterize Bezier curve not originally on 
the [0,1] real interval, but before I will include transformation of the 
length of the road to the [0,1] interval, to be consistent with real 
construction.

>Once a  
>car has impacted with another car or has entered any sort of out-of-control 
>scenario, you would need to stop manipulating its orientation directly and 
>let it be controlled by collision response or AI behavior.  So you'd want to 
>keep track of whether the car had hit something or not and use that to 
>determine if it should continue along its spline or not.

If I understand your proposition. You suggest to include feedback from the 
position of the car and the force, to simulate that driver is driving on the 
spline(Bezier), but I do not want to do that, because it will a situation, 
like driving with drunken driver :-). M Treibert model simulate more less 
good driver. But his work is done only for straight line.

> Of course you could also find some real equation for determining the torque 
>to apply to turn an object of known mass a known angle.  Keep in mind there's
>no friction unless you add it in yourself or have wheels touching the ground.  
>So if you add torque to turn you will have to add counter-torque to stop 
>turning.  But I imagine that's more complicated than your traffic model needs 
>to be.

Yes, and I do not want to do that.
 
> Good luck getting 8000-16000 vehicles working smoothly without a super 
> computer.

Hmm... Thanks. But on my linux machine, I have 8000 moving points in my 
dWorld, and it really works without real computational power consumtion. 
But at present I am controlling velocity of the car every step, what is not 
good - FAQ says. 

Do you thing that adding mass and geom will reduce efficiency as much?

> I find having around 50 colliders in a world uses around 10% of my
> CPU time.  You'll see much better speeds if you don't care for them to crash 
>and simply want them to drive around.

The model assumes and try to keep cars with out crash :-).

> Anyway that's my simple answer, but there are a fair number of experienced
> car simulators in the mailing list so someone may be able to provide better 
>advice for you or actual equations.

Thanks a lot for your reply. It is really good, because your remarks are very 
important for me.

Regards.

-- 

|\/\/|   Seweryn Habdank-Wojewódzki
`\/\/'




More information about the ODE mailing list