Skip to main content
Version: 3.2.1

Util

Util​

controller​

The pros controller is defined globally in our library as master.

extern pros::Controller master();

screen_print()​

Prints to the LLEMU. This function handles text that's too long for a line by finding the last word and starting it on a new line, and takes \n to set a new line.

text input string
line starting line

void screen_print(std::string text, int line)

to_string_with_precision()​

Returns a string with a specific number of decimal points.

input your input value
n the amount of decimals you want to display

std::string to_string_with_precision(double input, int n = 2);

Prints our branding on your terminal :D.

void print_ez_template();

sgn()​

Returns the sign of the input. Returns 1 if positive, -1 if negative, and 0 if 0.

input value to check the sign of

double sgn(double input);

clamp()​

Returns input restricted to min-max threshold.

input your input value
max the maximum input can be
min the minimum input can be

double clamp(double input, double max, double min);

clamp()​

Returns input restricted to min-max threshold.

The minimum used is negative max.

input your input value
max the maximum input can be
min the absolute value maximum input can be

double clamp(double input, double max);

DELAY_TIME​

Standard delay time for loops in ms.

const int DELAY_TIME = 10;

IS_SD_CARD​

Boolean that checks if an SD card is installed. True if there is one, false if there isn't.

const bool IS_SD_CARD = pros::usd::is_installed();

to_deg()​

Converts radians to degrees.

input your input radian

double to_deg(double input);

to_rad()​

Converts degrees to radians.

input your input degree

double to_deg(double input);

absolute_angle_to_point()​

Returns the angle between two points.

itarget target pose
icurrent current pose

double absolute_angle_to_point(pose itarget, pose icurrent);

distance_to_point()​

Returns the distance between two points.

itarget target pose
icurrent current pose

double distance_to_point(pose itarget, pose icurrent);

wrap_angle()​

Constrains an angle between 180 and -180.

wrap_angle input angle in degrees

double wrap_angle(double theta);

vector_off_point()​

Returns a new pose that is projected off of the current pose.

added how far to project a new point
icurrent point to project off of

pose vector_off_point(double added, pose icurrent);