okapi::DefaultOdomChassisController class

Base classes

class OdomChassisController

Constructors, destructors, conversion operators

DefaultOdomChassisController(const TimeUtil& itimeUtil, std::shared_ptr<Odometry> iodometry, std::shared_ptr<ChassisController> icontroller, const StateMode& imode = StateMode::FRAME_TRANSFORMATION, QLength imoveThreshold = 0_mm, QAngle iturnThreshold = 0_deg, std::shared_ptr<Logger> ilogger = Logger::getDefaultLogger())
Odometry based chassis controller that moves using a separately constructed chassis controller.
DefaultOdomChassisController(const DefaultOdomChassisController&) deleted
DefaultOdomChassisController(DefaultOdomChassisController&& other) deleted

Public functions

auto operator=(const DefaultOdomChassisController& other) -> DefaultOdomChassisController& deleted
auto operator=(DefaultOdomChassisController&& other) -> DefaultOdomChassisController& deleted
void driveToPoint(const Point& ipoint, bool ibackwards = false, const QLength& ioffset = 0_mm) override
Drives the robot straight to a point in the odom frame.
void turnToPoint(const Point& ipoint) override
Turns the robot to face a point in the odom frame.
auto getChassisController() -> std::shared_ptr<ChassisController>
auto chassisController() -> ChassisController&
void turnToAngle(const QAngle& iangle) override
This delegates to the input ChassisController.
void moveDistance(QLength itarget) override
This delegates to the input ChassisController.
void moveRaw(double itarget) override
This delegates to the input ChassisController.
void moveDistanceAsync(QLength itarget) override
This delegates to the input ChassisController.
void moveRawAsync(double itarget) override
This delegates to the input ChassisController.
void turnAngle(QAngle idegTarget) override
Turns chassis to desired angle (turns in the direction of smallest angle) (ex.
void turnRaw(double idegTarget) override
This delegates to the input ChassisController.
void turnAngleAsync(QAngle idegTarget) override
Turns chassis to desired angle (turns in the direction of smallest angle) (ex.
void turnRawAsync(double idegTarget) override
This delegates to the input ChassisController.
void setTurnsMirrored(bool ishouldMirror) override
This delegates to the input ChassisController.
auto isSettled() -> bool override
This delegates to the input ChassisController.
void waitUntilSettled() override
This delegates to the input ChassisController.
void stop() override
This delegates to the input ChassisController.
void setMaxVelocity(double imaxVelocity) override
This delegates to the input ChassisController.
auto getMaxVelocity() const -> double override
This delegates to the input ChassisController.
auto getChassisScales() const -> ChassisScales override
This delegates to the input ChassisController.
auto getGearsetRatioPair() const -> AbstractMotor::GearsetRatioPair override
This delegates to the input ChassisController.
auto getModel() -> std::shared_ptr<ChassisModel> override
This delegates to the input ChassisController.
auto model() -> ChassisModel& override
This delegates to the input ChassisController.

Protected functions

void waitForOdomTask()

Protected variables

std::shared_ptr<Logger> logger
std::shared_ptr<ChassisController> controller

Function documentation

okapi::DefaultOdomChassisController::DefaultOdomChassisController(const TimeUtil& itimeUtil, std::shared_ptr<Odometry> iodometry, std::shared_ptr<ChassisController> icontroller, const StateMode& imode = StateMode::FRAME_TRANSFORMATION, QLength imoveThreshold = 0_mm, QAngle iturnThreshold = 0_deg, std::shared_ptr<Logger> ilogger = Logger::getDefaultLogger())

Odometry based chassis controller that moves using a separately constructed chassis controller.

Parameters
itimeUtil The TimeUtil.
iodometry The odometry to read state estimates from.
icontroller The chassis controller to delegate to.
imode The new default StateMode used to interpret target points and query the Odometry state.
imoveThreshold minimum length movement (smaller movements will be skipped)
iturnThreshold minimum angle turn (smaller turns will be skipped)
ilogger The logger this instance will log to.

Spins up a task at the default priority plus 1 for odometry when constructed.

Moves the robot around in the odom frame. Instead of telling the robot to drive forward or turn some amount, you instead tell it to drive to a specific point on the field or turn to a specific angle, relative to its starting position.

void okapi::DefaultOdomChassisController::driveToPoint(const Point& ipoint, bool ibackwards = false, const QLength& ioffset = 0_mm) override

Drives the robot straight to a point in the odom frame.

Parameters
ipoint The target point to navigate to.
ibackwards Whether to drive to the target point backwards.
ioffset An offset from the target point in the direction pointing towards the robot. The robot will stop this far away from the target point.

void okapi::DefaultOdomChassisController::turnToPoint(const Point& ipoint) override

Turns the robot to face a point in the odom frame.

Parameters
ipoint The target point to turn to face.

std::shared_ptr<ChassisController> okapi::DefaultOdomChassisController::getChassisController()

Returns The internal ChassisController.

ChassisController& okapi::DefaultOdomChassisController::chassisController()

Returns The internal ChassisController.

void okapi::DefaultOdomChassisController::turnAngle(QAngle idegTarget) override

Turns chassis to desired angle (turns in the direction of smallest angle) (ex.

Parameters
idegTarget target angle

If current angle is 0 and target is 270, the chassis will turn -90 degrees)

void okapi::DefaultOdomChassisController::turnAngleAsync(QAngle idegTarget) override

Turns chassis to desired angle (turns in the direction of smallest angle) (ex.

Parameters
idegTarget target angle

If current angle is 0 and target is 270, the chassis will turn -90 degrees)