Skip to content

Acceleration Limiting #32

@GarrettBurroughs

Description

@GarrettBurroughs

Add an acceleration limiting step for inputs.
The acceleration limit should take in two differential objects that are able to keep track of the linear acceleration and rotational acceleration

There will be a total of 3 acceleration limiters

  • Rotational
  • Linear
  • Both

An example of the differential objects is as follows

// Get from accelerometer
Differential linearAcceleration = new Differential( () -> velocity);
// Get from Gyro
Differential angularAcceleration = new Differential(() -> angularVelocity);

Although it may be possible to completely bypass the step of creating differential objects to handle the calculation, due to build in functionality of the Accelerometer and Gyroscope APIs

The next challenge in this problem is converting acceleration to power in the motors.
This means that the best way to limit acceleration may be to apply a PID controller to keep the motors moving at a constant acceleration as defined from an Input

This could also be done more simply with a step like

public DTInput getOutput(DTInput input){
    Angle angularOut;
    Vector linearOut;
    if(linearAcceleration > targetAcceleration){
           linearOut = input.getTranslation().scale(1 - (scalar)(targetAcceleration - linearAcceleration));
    }

    if(linearAcceleration > targetAcceleration){
           angularOut = input.getRotation().scale(1 - (scalar)(targetAcceleration - angularAcceleration));
    }

   return new DTInput(linearOut, angularOut);
}

Or something along those lines. I will implement and test various implementations for this. And update on this thread

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions