# [ODE] Fwd: Re: Bike Balancing!

Eike Decker eike at cube3d.de
Wed Nov 7 06:25:17 MST 2007

```And once again I did not watch the adress :P
Sorry James!

----- Weitergeleitete Nachricht von Eike Decker <eike at cube3d.de> -----
Datum: Wed, 7 Nov 2007 14:23:38 +0100
Von: Eike Decker <eike at cube3d.de>
Antwort an: Eike Decker <eike at cube3d.de>
Betreff: Re: [ODE] Bike Balancing!
An: James Steele <james.steele at greentube.com>

I tried that that out by adding a ball / hingejoint with some mass to the bike,
but the bike tended to swing when standing or going into turning, or, when the
pendulum was damped, it didn't react quickly enough to changes of the moment of
inertia. I couldn't find a way to react correctly on that.

Eike

PS: And because "answer to" did not adress the mailing list, here is something
I've written before, just sending it to James Steele.

-->

I recently tried to write a bike racer, some results are available as youtube
videos:

I am using sphere geoms for the wheels, which causes some troubles when the
bike
makes a sharp turn. A better tire model using rays or something like that could
improve the simulation.

Simple balancing at slow speed is very easy: if you have a RIGHT vector of you
bike and a vector which points up (negate the gravity vector), you can
calculate the dot product and use the result for setting the steering angle of
the front wheel. If you are moving slowly, this will perfectly balance the
bike, as it corrects any imbalance.

Turning at slow speed: if you turn, you can manipulate the result of the
dotproduct - if you add a steervalue, the bike will lose its balance, but will
try to stay at a certain angle which causes it to turn.

The trouble began when I tried to speed up the bike or tried to go uphill. I
needed to calculate an upvector which is not defined in the world axis, but
depended on the speed of the bike (if you go into a looping and turn upside
down, "up" is "down" and reverse. The same for skewed bends - if you move in
the bends, down is no longer the same as the gravity vector).

I have made some efforts to solve this problem, but my bike tends to make
accidents when making sharp turns at high speed (which is also caused by the
fairly low resolution of the timer of the simulation).

Right now, I am calculating the UP vector by taking using the gravity and speed
vector, add it to a local position of the bike's body (at a point which would
not move much if I skew left or right) of the previous step and compare it with
the real position of the same local position in the current step. It is still a
bit unstable on rough ground, but I guess that a real bike driver would suffer
the same problems. My current approach is using only minimal external forces
when at very low speed or when in air. Next to this I am only using the dhinge2
joints connecting the wheels with the motorbike's body.

Eike Decker

<--

> I was thinking of something like that, but then I'd have to work out
> there to put the "weight" of the pendulum at any given time, and I have
> no idea where to start with those calculations. And also...I'm not sure
> which sort of joint I'd use for this, as an amotor is more than likely
> to cause some of the issues I experiened before.
>
> I can forsee some problem arising from this though, the first being the
> bike motion osccilationg back and forth between the desired lean angle
> and the posssibility that the bike may fall over, which is not really
> what I want.
>
>
>
> Ross L. Hatton wrote:
> > Would using an inverted pendulum to simulate the rider (and swinging
> > it back and forth to apply balancing forces) work for you?
> >
> > James Steele wrote:
> >> I'm back to writing motor-bike physics again and scratching my head
> >> over the best way to get the bike to balance. So I'm wondering if any
> >> of you fine people on the ode lists have an idea on how to approach
> >> this?
> >>
> >> I've used an amotor joint previously to balance the bike, but this
> >> caused some weird issues with the tire model I had written. Also, the
> >> motor of course only rotated the body around its COM causing the
> >> wheels to slide back and forth lateraly. when what i want is the bike
> >> to pivot at the contact points of the wheels.
> >>
> >> So can anybody reccomend another method of artificially balancing a
> >> bike in ODE?  Is there some sort of joint that I've previously
> >> overlooked that will to the job?  I have a feeling that none of the
> >> joints are suited to this task, and will have to apply a "push" force
> >> above the COM but I'm, scratching my head with this concept also.
> >> So are there any suggestions? Any books/articles I should perhaps
> >> take a look at?
> >>
> >>
> >>
> >
> >
>
>
> --
>
> James Steele
>
> 3D / Physics Programmer
>
>
>
> james.steele at greentube.com
>
>
>
> Greentube Internet Entertainment Solutions AG
>
> Mariahilfer Straße 47/1/102
>
> A-1060 Wien
>
> FN 197003k, HG Wien
>
>
>
> Tel: +43 1 494 50 56
>
> Fax: +43 1 494 50 56 - 14
>
> http://www.greentube.com/
>
>
>
> ------------------------------------
> Internet Email Confidentiality Footer
> ------------------------------------
> Privileged/confidential information may be contained in this message. If
> you are not the addressee indicated in this message (or responsible for
> delivery of the message to this person), you may not copy or deliver
> this message to anyone. In such a case, you should destroy this message
> and kindly notify the sender by replying. Please make it known
> immediately  f you or your employer does not consent to the medium of
> e-mail for messages of this kind. Opinions, conclusions and other
> information in this message that do not relate to the official business
> of my firm shall be understood as neither given nor endorsed by it.
>
> _______________________________________________
> ODE mailing list
> ODE at ode.org
> http://ode.org/mailman/listinfo/ode
>

----- Ende der weitergeleiteten Nachricht -----

```