Skip to content

TankModifier needs to produce negative velocity for inside wheel on tight curves #36

@DrewTheRat

Description

@DrewTheRat

For tight curves in a trajectory, the Tank Modifier needs to sometimes produce negative velocity, etc. on the wheels on the inside of the curve. This would be for any curve where the radius is less than the wheelbase.

Right now the the distance value being calculated is correct except for the sign. I think the issue is in Pathfinder-Core/src/modifiers/tank.c lines 20-22 and 36-39:

double distance = sqrt(
    (left.x - last.x) * (left.x - last.x)
    + (left.y - last.y) * (left.y - last.y)
);

That calculation always yields a positive distance, even if the current point is behind the last point. I can tell there needs to be a check for that scenario, but I cannot quite figure it out.

Also, here is a trajectory that exhibits this issue:

Fit Method  : HERMITE_CUBIC
Time Step   : 0.02
Max Velocity: 4.0
Max Accel.  : 3.0
Max Jerk    : 60

Wheelbase   : 3.4

Trajectory (X,Y,Angle)
3.00,  23.21, 0.00
17.00, 23.21, 0.00
20.65, 20.50, 90.00
17.42, 18.15, -180.00

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions