RIT VEXU Core API
|
#include <odometry_serial.h>
Public Member Functions | |
OdometrySerial (bool is_async, bool calc_vel_acc_on_brain, Pose2d initial_pose, Pose2d sensor_offset, int32_t port, int32_t baudrate) | |
void | send_config (const Pose2d &initial_pose, const Pose2d &sensor_offset, const bool &calc_vel_acc_on_brain) |
Pose2d | update () override |
void | set_position (const Pose2d &new_pose) override |
int | receive_cobs_packet (uint32_t port, uint8_t *buffer, size_t buffer_size) |
Pose2d | get_position (void) override |
Pose2d | get_pose2d (void) |
size_t | cobs_decode (const uint8_t *buffer, size_t length, void *data) |
size_t | cobs_encode (const void *data, size_t length, uint8_t *buffer) |
![]() | |
OdometryBase (bool is_async) | |
void | end_async () |
double | get_angular_speed_deg () |
double | get_angular_accel_deg () |
Additional Inherited Members | |
![]() | |
static int | background_task (void *ptr) |
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 | |
vex::task * | handle |
vex::mutex | mut |
Pose2d | current_pos |
double | speed |
double | accel |
double | ang_speed_deg |
double | ang_accel_deg |
This class handles the code for an odometry setup where calculations are done on an external coprocessor. Data is sent to the brain via smart port, using a generic serial (UART) connection.
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.
https://rit.enterprise.slack.com/files/U04112Y5RB6/F080M01KPA5/predictperpindiculars2.pdf 2024-2025 Notebook: Entries/Software Entries/Localization/N-Pod Odometry
OdometrySerial::OdometrySerial | ( | bool | is_async, |
bool | calc_vel_acc_on_brain, | ||
Pose2d | initial_pose, | ||
Pose2d | sensor_offset, | ||
int32_t | port, | ||
int32_t | baudrate ) |
Construct a new Odometry Serial Object
This class handles the code for an odometry setup where calculations are done on an external coprocessor. Data is sent to the brain via smart port, using a generic serial (UART) connection.
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.
https://rit.enterprise.slack.com/files/U04112Y5RB6/F080M01KPA5/predictperpindiculars2.pdf 2024-2025 Notebook: Entries/Software Entries/Localization/N-Pod Odometry
size_t OdometrySerial::cobs_decode | ( | const uint8_t * | buffer, |
size_t | length, | ||
void * | data ) |
COBS decode data from buffer
buffer | Pointer to encoded input bytes |
length | Number of bytes to decode |
data | Pointer to decoded output data |
size_t OdometrySerial::cobs_encode | ( | const void * | data, |
size_t | length, | ||
uint8_t * | buffer ) |
COBS encode data to buffer
data | Pointer to input data to encode |
length | Number of bytes to encode |
buffer | Pointer to encoded output buffer |
Pose2d OdometrySerial::get_pose2d | ( | void | ) |
Gets the current position and rotation
|
overridevirtual |
Gets the current position and rotation
Reimplemented from OdometryBase.
int OdometrySerial::receive_cobs_packet | ( | uint32_t | port, |
uint8_t * | buffer, | ||
size_t | buffer_size ) |
Attempts to recieve an entire packet encoded with COBS, stops at delimiter or there's a buffer overflow
port | the port number the serial is plugged into, counts from 0 instead of 1 |
buffer | pointer to a uint8_t[] where we put the data |
buffer_size | length in bytes of the buffer |
void OdometrySerial::send_config | ( | const Pose2d & | initial_pose, |
const Pose2d & | sensor_offset, | ||
const bool & | calc_vel_acc_on_brain ) |
Send
|
overridevirtual |
Resets the position and rotational data to the input.
Resets the position and rotational data to the input.
new_pose | the pose to set the odometry to |
Reimplemented from OdometryBase.
|
overridevirtual |
Update the current position of the robot once by reading a single packet from the serial port
Update the current position of the robot once by reading a single packet from the serial port, then updating all over values, velocity, accel
Implements OdometryBase.