OdomChassisController class
Contents
Base classes
- class ChassisController
Derived classes
Constructors, destructors, conversion operators
-
OdomChassisController(TimeUtil itimeUtil,
std::shared_ptr<Odometry> iodometry,
const StateMode& imode = StateMode::
FRAME_TRANSFORMATION, const QLength& imoveThreshold = 0_mm, const QAngle& iturnThreshold = 0_deg, std::shared_ptr<Logger> ilogger = Logger:: getDefaultLogger()) - Odometry based chassis controller.
- ~OdomChassisController() override
- OdomChassisController(const OdomChassisController&) deleted
- OdomChassisController(OdomChassisController&& other) deleted
Public functions
- auto operator=(const OdomChassisController& other) -> OdomChassisController& deleted
- auto operator=(OdomChassisController&& other) -> OdomChassisController& deleted
- void driveToPoint(const Point& ipoint, bool ibackwards = false, const QLength& ioffset = 0_mm) pure virtual
- Drives the robot straight to a point in the odom frame.
- void turnToPoint(const Point& ipoint) pure virtual
- Turns the robot to face a point in the odom frame.
- void turnToAngle(const QAngle& iangle) pure virtual
- Turns the robot to face an angle in the odom frame.
- auto getState() const -> OdomState virtual
- void setState(const OdomState& istate) virtual
- Set a new state to be the current state.
- void setDefaultStateMode(const StateMode& imode)
- Sets a default StateMode that will be used to interpret target points and query the Odometry state.
- void setMoveThreshold(const QLength& imoveThreshold) virtual
- Set a new move threshold.
- void setTurnThreshold(const QAngle& iturnTreshold) virtual
- Set a new turn threshold.
- auto getMoveThreshold() const -> QLength virtual
- auto getTurnThreshold() const -> QAngle virtual
- void startOdomThread()
- Starts the internal odometry thread.
- auto getOdomThread() const -> CrossplatformThread*
- auto getOdometry() -> std::shared_ptr<Odometry>
Protected static functions
- static void trampoline(void* context)
Protected functions
- void loop()
Protected variables
- std::shared_ptr<Logger> logger
- TimeUtil timeUtil
- QLength moveThreshold
- QAngle turnThreshold
- std::shared_ptr<Odometry> odom
- CrossplatformThread* odomTask
- std::atomic_bool dtorCalled
- StateMode defaultStateMode
- std::atomic_bool odomTaskRunning
Function documentation
okapi:: OdomChassisController:: OdomChassisController(TimeUtil itimeUtil,
std::shared_ptr<Odometry> iodometry,
const StateMode& imode = StateMode:: FRAME_TRANSFORMATION,
const QLength& imoveThreshold = 0_mm,
const QAngle& iturnThreshold = 0_deg,
std::shared_ptr<Logger> ilogger = Logger:: getDefaultLogger())
Odometry based chassis controller.
| Parameters | |
|---|---|
| itimeUtil | The TimeUtil. |
| iodometry | The Odometry instance to run in a new task. |
| 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 | |
Starts task at the default for odometry when constructed, which calls Odometry:: every 10ms. The default StateMode is StateMode::.
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:: OdomChassisController:: driveToPoint(const Point& ipoint,
bool ibackwards = false,
const QLength& ioffset = 0_mm) pure virtual
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:: OdomChassisController:: turnToPoint(const Point& ipoint) pure virtual
Turns the robot to face a point in the odom frame.
| Parameters | |
|---|---|
| ipoint | The target point to turn to face. |
void okapi:: OdomChassisController:: turnToAngle(const QAngle& iangle) pure virtual
Turns the robot to face an angle in the odom frame.
| Parameters | |
|---|---|
| iangle | The angle to turn to. |
void okapi:: OdomChassisController:: setState(const OdomState& istate) virtual
Set a new state to be the current state.
| Parameters | |
|---|---|
| istate | The new state in the given format. |
The default StateMode is StateMode::.
void okapi:: OdomChassisController:: setDefaultStateMode(const StateMode& imode)
Sets a default StateMode that will be used to interpret target points and query the Odometry state.
| Parameters | |
|---|---|
| imode | The new default StateMode. |
void okapi:: OdomChassisController:: setMoveThreshold(const QLength& imoveThreshold) virtual
Set a new move threshold.
| Parameters | |
|---|---|
| imoveThreshold | new move threshold |
Any requested movements smaller than this threshold will be skipped.
void okapi:: OdomChassisController:: setTurnThreshold(const QAngle& iturnTreshold) virtual
Set a new turn threshold.
| Parameters | |
|---|---|
| iturnTreshold | new turn threshold |
Any requested turns smaller than this threshold will be skipped.
QLength okapi:: OdomChassisController:: getMoveThreshold() const virtual
| Returns | The current move threshold. |
|---|
QAngle okapi:: OdomChassisController:: getTurnThreshold() const virtual
| Returns | The current turn threshold. |
|---|
void okapi:: OdomChassisController:: startOdomThread()
Starts the internal odometry thread.
This should not be called by normal users.
CrossplatformThread* okapi:: OdomChassisController:: getOdomThread() const
| Returns | The underlying thread handle. |
|---|
std::shared_ptr<Odometry> okapi:: OdomChassisController:: getOdometry()
| Returns | The internal odometry. |
|---|