RIT VEXU Core API
|
#include <odometry_tank.h>
Public Member Functions | |
OdometryTank (vex::motor_group &left_side, vex::motor_group &right_side, robot_specs_t &config, vex::inertial *imu=NULL, bool is_async=true) | |
OdometryTank (CustomEncoder &left_custom_enc, CustomEncoder &right_custom_enc, robot_specs_t &config, vex::inertial *imu=NULL, bool is_async=true) | |
OdometryTank (vex::encoder &left_vex_enc, vex::encoder &right_vex_enc, robot_specs_t &config, vex::inertial *imu=NULL, bool is_async=true) | |
pose_t | update () override |
void | set_position (const pose_t &newpos=zero_pos) override |
![]() | |
OdometryBase (bool is_async) | |
pose_t | get_position (void) |
void | end_async () |
double | get_speed () |
double | get_accel () |
double | get_angular_speed_deg () |
double | get_angular_accel_deg () |
Additional Inherited Members | |
![]() | |
static int | background_task (void *ptr) |
static double | pos_diff (pose_t start_pos, pose_t end_pos) |
static double | rot_diff (pose_t pos1, pose_t pos2) |
static double | smallest_angle (double start_deg, double end_deg) |
![]() | |
bool | end_task = false |
end_task is true if we instruct the odometry thread to shut down | |
![]() | |
static constexpr pose_t | zero_pos = {.x = 0.0L, .y = 0.0L, .rot = 90.0L} |
![]() | |
vex::task * | handle |
vex::mutex | mut |
pose_t | current_pos |
double | speed |
double | accel |
double | ang_speed_deg |
double | ang_accel_deg |
OdometryTank defines an odometry system for a tank drivetrain This requires encoders in the same orientation as the drive wheels Odometry is a "start and forget" subsystem, which means once it's created and configured, it will constantly run in the background and track the robot's X, Y and rotation coordinates.
OdometryTank::OdometryTank | ( | vex::motor_group & | left_side, |
vex::motor_group & | right_side, | ||
robot_specs_t & | config, | ||
vex::inertial * | imu = NULL, | ||
bool | is_async = true ) |
Initialize the Odometry module, calculating position from the drive motors.
left_side | The left motors |
right_side | The right motors |
config | the specifications that supply the odometry with descriptions of the robot. See robot_specs_t for what is contained |
imu | The robot's inertial sensor. If not included, rotation is calculated from the encoders. |
is_async | If true, position will be updated in the background continuously. If false, the programmer will have to manually call update(). |
OdometryTank::OdometryTank | ( | CustomEncoder & | left_custom_enc, |
CustomEncoder & | right_custom_enc, | ||
robot_specs_t & | config, | ||
vex::inertial * | imu = NULL, | ||
bool | is_async = true ) |
Initialize the Odometry module, calculating position from the drive motors.
left_custom_enc | The left custom encoder |
right_custom_enc | The right custom encoder |
config | the specifications that supply the odometry with descriptions of the robot. See robot_specs_t for what is contained |
imu | The robot's inertial sensor. If not included, rotation is calculated from the encoders. |
is_async | If true, position will be updated in the background continuously. If false, the programmer will have to manually call update(). |
OdometryTank::OdometryTank | ( | vex::encoder & | left_vex_enc, |
vex::encoder & | right_vex_enc, | ||
robot_specs_t & | config, | ||
vex::inertial * | imu = NULL, | ||
bool | is_async = true ) |
Initialize the Odometry module, calculating position from the drive motors.
left_vex_enc | The left vex encoder |
right_vex_enc | The right vex encoder |
config | the specifications that supply the odometry with descriptions of the robot. See robot_specs_t for what is contained |
imu | The robot's inertial sensor. If not included, rotation is calculated from the encoders. |
is_async | If true, position will be updated in the background continuously. If false, the programmer will have to manually call update(). |
set_position tells the odometry to place itself at a position
newpos | the position the odometry will take |
Resets the position and rotational data to the input.
Reimplemented from OdometryBase.
|
overridevirtual |
Update the current position on the field based on the sensors
Update, store and return the current position of the robot. Only use if not initializing with a separate thread.
Implements OdometryBase.