# [ODE] Bike Balancing!

Jon Watte (ODE) hplus-ode at mindcontrol.org
Sat Nov 10 02:57:00 MST 2007

```Actually, you probably want to get the rotational velocity around the
local front axis, and add a counter-torque, rather than a counter-force.
Getting the rotational velocity around various axes is fairly simple;
there are tons of accessors that transform the values into various
reference frames (including the body reference frame).

An alternative is to get the point velocity for some point (say, rider's
head), and add a counter-velocity based on the dot product between that
velocity and the ground-aligned side/right vector.

Cheers,

/ h+

James Steele wrote:
> This is for a game :)
>
> The problem with having the COG below the wheels is that, it then
> revereses the pitch of the body under acceleration and braking.  This is
> not really what I want, as this will also have a horrible effect on the
> weight distribution on the wheels.
>
> I'm pretty sure I can balance the bike with a "push force" at a certain
> point, and possibly use Eike's idea for low-speed balancing.  Then after
> a certain point, switch to the "fast balance" mode
>
> All I need to do is to be able to get the momentum at a certain point on
> one of the axis of the COG and produce a force in the opposite direction
> with some dampening term to minimize jittering/osscilations.
>
> Jon Watte wrote:
>
>> James Steele wrote:
>>
>>> Hmmm....that's a good article, and I guess as you say; for low
>>> speeds, counter-steering would work ok to balance the bike.  But as
>>> this is a motor bike and typical reaches speeds of 210-250kpm, I
>>> think a different approach may be needed. Counter-steering at those
>>> speeds could lead to massive under-steer and loss of traction which
>>> is not so great :)
>>>
>>>
>> If this is for research, ODE is not a good library to use, because
>> bikes have gyroscopic forces that are not modeled in ODE.
>>
>> If this is for a game, then I would suggest putting the center of
>> gravity close to or UNDER the road surface; in effect creating a
>> motorcycle that rights itself, similar to those tipping clown dolls
>> with a heavy weight at the bottom of a round base. Also, when the COG
>> is under the road surface, the bike will lean "naturally" as you turn
>> corners.
>>
>> Cheers,
>>
>>          / h+
>>
>>
>>
>>
>
>
>
```