RIT VEXU Core API
Loading...
Searching...
No Matches
Odometry3Wheel Class Reference

#include <odometry_3wheel.h>

Inheritance diagram for Odometry3Wheel:
OdometryBase

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
 

Detailed Description

Odometry3Wheel

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.

Author
Ryan McGee
Date
Oct 31 2022

Constructor & Destructor Documentation

◆ Odometry3Wheel()

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

Parameters
lside_fwdleft-side encoder reference
rside_fwdright-side encoder reference
off_axisoff-axis (perpendicular) encoder reference
cfgrobot odometry configuration
is_asynctrue to constantly run in the background

Member Function Documentation

◆ tune()

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

Parameters
conController reference, for screen and button control
driveDrivetrain 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

◆ update()

pose_t Odometry3Wheel::update ( )
overridevirtual

Update the current position of the robot once, using the current state of the encoders and the previous known location

Returns
the robot's updated position

Implements OdometryBase.


The documentation for this class was generated from the following files: