ARMS  3.1.1
Documentation for ARMS movement library
arms::odom Namespace Reference

This namespace deals with the odometry system. More...

Classes

struct  config_data_s
 

Typedefs

typedef enum arms::odom::EncoderType EncoderType_e_t
 
typedef struct arms::odom::config_data_s config_data_s_t
 

Enumerations

enum  EncoderType { ENCODER_ADI , ENCODER_ROTATION }
 

Functions

double getLeftEncoder ()
 
double getRightEncoder ()
 
double getMiddleEncoder ()
 
Point getPosition ()
 
double getHeading (bool radians=false)
 
void reset (Point point={0, 0})
 
void reset (Point point, double angle)
 
double getAngleError (Point point)
 
double getDistanceError (Point point)
 

Variables

std::shared_ptr< pros::Imu > imu
 

Detailed Description

This namespace deals with the odometry system.

It is used to track the robot's position on the field.

Function Documentation

◆ getAngleError()

double arms::odom::getAngleError ( Point  point)
Parameters
pointThe point we want to get the angle error of

Example:

// get the angle error of the point (24, 0)
double error = arms::odom::getAngleError({24, 0});
double getAngleError(Point point)

Return the angle error between the robot's current heading and the angle to the provided point.

◆ getDistanceError()

double arms::odom::getDistanceError ( Point  point)
Parameters
pointThe point we want to get the distance error of

Example:

// get the distance error of the point (24, 0)
double error = arms::odom::getDistanceError({24, 0});
double getDistanceError(Point point)

Return the distance error between the robot's current position and the provided point.

◆ getHeading()

double arms::odom::getHeading ( bool  radians = false)
Parameters
radiansIf true, the heading will be returned in radians. If false, the heading will be returned in degrees.

Return the robot's heading based in degrees or radians, depending on the radians option

◆ getLeftEncoder()

double arms::odom::getLeftEncoder ( )

Return the left encoder position

◆ getMiddleEncoder()

double arms::odom::getMiddleEncoder ( )

Return the middle encoder position

◆ getPosition()

Point arms::odom::getPosition ( )

Return a Point representing the robot's position on the field

◆ getRightEncoder()

double arms::odom::getRightEncoder ( )

Return the right encoder position

◆ reset() [1/2]

void arms::odom::reset ( Point  point,
double  angle 
)
Parameters
pointThe position to reset the robot to
angleThe angle to reset the robot to

Example:

// reset the robot's position to be at x: 24 inches, y: 0 inches, and angle: 90 degrees
arms::odom::reset({24, 0}, 90);
void reset(Point point={0, 0})

Reset the odometry system to the provided position and angle.

◆ reset() [2/2]

void arms::odom::reset ( Point  point = {0, 0})
Parameters
pointThe position to reset the robot to

Example:

// reset the robot's position to be at x: 24 inches, y: 0 inches

Reset the odometry system to the provided position.

Variable Documentation

◆ imu

std::shared_ptr< pros::Imu > arms::odom::imu
extern

The IMU sensor. This is used by odom to get the robot's heading.