PTPController

class PTPController(var controller: MecanumController, var localizer: Localizer)

Stands for Point-To-Point Controller. Is used to move the robot around the playing field autonomously using waypoints. Internally, this class uses a PD controller to control distance to the goal, and a PID controller to control rotation.

There is a built in anti-stall system that detects if the robot is stalling and if it is, stops moving and signals to proceed to the next point. If the robot doesn't stall, it will keep traveling until it gets within a user defined distance to the target. The robot is considered stalled if the PD / PID power is low AND the bot is not moving both positionally and rotationally.

Parameters

controller

The mecanum that the PTP Controller will control

localizer

The localizer that the PTP controller will use to determine its position. This uses the Localizer interface meaning that a custom localizer can be used here.

Constructors

Link copied to clipboard
constructor(controller: MecanumController, localizer: Localizer)

Types

Link copied to clipboard

Properties

Link copied to clipboard

Parameters for anti-stall. For anti stall to trigger ALL conditions must be met.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

True if the robots translational power is less than movePowerAntistallThreshold

Link copied to clipboard

True if the robots translational speed is less than moveSpeedAntistallThreshold

Link copied to clipboard

Power being applied by the controller

Link copied to clipboard

PID Controller for bot rotation.

Link copied to clipboard
Link copied to clipboard

True if the robots rotational power is less than rotatePowerAntistallThreshold

Link copied to clipboard

True if the robots rotational speed is less than rotateSpeedAntistallThreshold

Link copied to clipboard

PD controller for distance. Even though this takes a PID controller, the I component must not be set.

Functions

Link copied to clipboard

Go towards a waypoint until it is reached. Used by PointTask.

Link copied to clipboard
fun holdPosition(point: Pose, maxSpeed: Double, holdRotation: Boolean)