ByteArena / backends

Byte Arena - Digital playground for Autonomous agents
https://get.bytearena.com
1 stars 0 forks source link

Implement max steering constraint #234

Open netgusto opened 6 years ago

netgusto commented 6 years ago

As explained here: https://github.com/ByteArena/cli/issues/15#issuecomment-346939630

Pseudocode of current implementation (incorrect):

In pseudocode:

var curvelocity Vec2 = GetCurrentVelocity()
var newvelocity Vec2 = GetDesiredVelocity()

var maxSteeringForce Vec2 = GetMaxSteeringForce()

var curmag float64 = curvelocity.Mag()
var diff float64 = newvelocity.Mag() - curmag

if math.Abs(diff) > maxSteeringForce {
    if diff > 0 {
        newvelocity = newvelocity.SetMag(curmag + maxSteeringForce)
    } else {
        newvelocity = newvelocity.SetMag(curmag - maxSteeringForce)
    }
}

The current implementation is incorrect as it does not take into account the changes of direction between the two velocities.

xtuc commented 6 years ago

Do we plan to support some kind of drag force? Even if null atm

Let's talk about that stuff tomorrow