RIT VEXU Core API
|
#include <odometry_3wheel.h>
Classes | |
struct | odometry3wheel_cfg_t |
Public Member Functions | |
Odometry3Wheel (CustomEncoder &lside_fwd, CustomEncoder &rside_fwd, CustomEncoder &off_axis, odometry3wheel_cfg_t &cfg, bool is_async=true) | |
pose_t | update () override |
void | tune (vex::controller &con, TankDrive &drive) |
Public Member Functions inherited from OdometryBase | |
OdometryBase (bool is_async) | |
pose_t | get_position (void) |
virtual void | set_position (const pose_t &newpos=zero_pos) |
void | end_async () |
double | get_speed () |
double | get_accel () |
double | get_angular_speed_deg () |
double | get_angular_accel_deg () |
Additional Inherited Members | |
Static Public Member Functions inherited from OdometryBase | |
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) |
Public Attributes inherited from OdometryBase | |
bool | end_task = false |
end_task is true if we instruct the odometry thread to shut down | |
Static Public Attributes inherited from OdometryBase | |
static constexpr pose_t | zero_pos = {.x = 0.0L, .y = 0.0L, .rot = 90.0L} |
Protected Attributes inherited from OdometryBase | |
vex::task * | handle |
vex::mutex | mut |
pose_t | current_pos |
double | speed |
double | accel |
double | ang_speed_deg |
double | ang_accel_deg |
This class handles the code for a standard 3-pod odometry setup, where there are 3 "pods" made up of undriven (dead) wheels connected to encoders in the following configuration:
+Y ------------— ^ | | | | | | | || O || | | | | | | === | | ------------— | +-------------------> + X
Where O is the center of rotation. The robot will monitor the changes in rotation of these wheels and calculate the robot's X, Y and rotation on the field.
This is a "set and forget" class, meaning once the object is created, the robot will immediately begin tracking it's movement in the background.
Odometry3Wheel::Odometry3Wheel | ( | CustomEncoder & | lside_fwd, |
CustomEncoder & | rside_fwd, | ||
CustomEncoder & | off_axis, | ||
odometry3wheel_cfg_t & | cfg, | ||
bool | is_async = true ) |
Construct a new Odometry 3 Wheel object
lside_fwd | left-side encoder reference |
rside_fwd | right-side encoder reference |
off_axis | off-axis (perpendicular) encoder reference |
cfg | robot odometry configuration |
is_async | true to constantly run in the background |
void Odometry3Wheel::tune | ( | vex::controller & | con, |
TankDrive & | drive ) |
A guided tuning process to automatically find tuning parameters. This method is blocking, and returns when tuning has finished. Follow the instructions on the controller to complete the tuning process
con | Controller reference, for screen and button control |
drive | Drivetrain reference for robot control |
A guided tuning process to automatically find tuning parameters. This method is blocking, and returns when tuning has finished. Follow the instructions on the controller to complete the tuning process
It is assumed the gear ratio and encoder PPR have been set correctly
|
overridevirtual |
Update the current position of the robot once, using the current state of the encoders and the previous known location
Implements OdometryBase.