Systems in Homeostasis

Throughout the world, systems containing many parts work together to achieve homeostasis; Our robot is no different.

BasicSystem

Basic systems include, a single Estimator, a single Feedback controller, and a single Feedforward Controller.

BasicSystem(Estimator estimator, FeedbackController feedbackController,
                FeedforwardController feedforwardController);

PositionVelocitySystem

This is a slightly more complex system that attempts to control both position and velocity at the same time. This uses two feedback controllers, two estimators, and a single feedforward.

public PositionVelocitySystem(Estimator positionEstimator,
                              Estimator velocityEstimator,
                              FeedforwardController feedforward,
                               FeedbackController positionFeedback,
                               FeedbackController velocityFeedback);

Example systems

Basic Motor Control

PIDCoefficients coefficients = new PIDCoefficients(0.3,0.04,0.01);
DoubleSupplier motorPosition = new DoubleSupplier() {
	@Override
	public double getAsDouble() {
		return exampleMotor.getPosition();
	}
};
BasicPID controller = new BasicPID(coefficients);
NoFeedforward feedforward = new NoFeedforward();
RawValue noFilter = new RawValue(motorPosition);
BasicSystem system = new BasicSystem(noFilter,controller,feedforward);

while (true) {
	double command = system.update(referencePosition);
}

The above example demonstrates the basic syntax for systems.

Full State with PID

Effectively Full State feedback and Full State Estimation using two PID's and two Kalman Filters.

Feedforward Only

Sometimes we might not have a sensor available to us and as a result feedforward is our only option!

Last updated

Was this helpful?