ARMS
3.1.1
Documentation for ARMS movement library
|
This namespace contains all of the functions and variables needed to control the chassis. More...
Functions | |
void | setBrakeMode (pros::motor_brake_mode_e_t b) |
bool | settled () |
void | waitUntilFinished (double exit_error) |
void | move (std::vector< double > target, double max, double exit_error, double lp, double ap, MoveFlags=NONE) |
void | move (double target, double max, double exit_error, double lp, double ap, MoveFlags=NONE) |
move the chassis a target distance forward More... | |
void | turn (double target, double max, double exit_error, double ap, MoveFlags=NONE) |
turn the chassis a target angle More... | |
void | turn (Point target, double max, double exit_error, double ap, MoveFlags=NONE) |
turn the chassis to face a target point More... | |
void | tank (double left, double right, bool velocity=false) |
move the chassis using tank drive More... | |
void | arcade (double vertical, double horizontal, bool velocity=false) |
move the chassis using arcade drive More... | |
Variables | |
double | maxSpeed |
std::shared_ptr< pros::Motor_Group > | leftMotors |
std::shared_ptr< pros::Motor_Group > | rightMotors |
This namespace contains all of the functions and variables needed to control the chassis.
void arms::chassis::arcade | ( | double | forward, |
double | turn, | ||
bool | velocity = false |
||
) |
move the chassis using arcade drive
forward | The forward velocity or percentage (0%-100%). |
turn | The turn velocity or percentage (0%-100%). |
velocity | Whether the values are velocities or percentages. Defaults to false for percentage mode. |
Example 1:
Example 2:
Example 3:
void arms::chassis::move | ( | double | target, |
double | max, | ||
double | exit_error, | ||
double | lp, | ||
double | ap, | ||
MoveFlags | flags = NONE |
||
) |
move the chassis a target distance forward
target | The target distance to move to. |
flags | The flags to use when moving the chassis. |
max | The maximum speed to move at. |
exit_error | The minimum distance from the target point to exit the movement. |
lp | The linear kP for the movement. |
ap | The angular kP for the movement. |
flags | The flags to use when moving the chassis. |
Almost all parameters are optional. Technically, only the target parameter is required. However, it is recommended to provide the max parameter aswell so that you have control over the maximum speed of the chassis.
Example 1:
Example 2:
Example 3:
Moves the chassis a target distance. Almost all parameters are optional. Technically, only the target parameter is required. However, it is recommended to provide the max parameter aswell so that you have control over the maximum speed of the chassis.
The target parameter is used to specify how far the chassis should move. The max parameter can be used to set the maximum speed of the movement. It will default to 100% if not provided.
The exit_error parameter can be used to set the minimum error from the target point to exit the movement. It will default to what is provided in config::h::MIN_ERROR if not provided.
The lp parameter can be used to set the linear kP for the movement. It will default to what is provided in config.h if not provided.
The ap parameter can be used to set the angular kP for the movement. It will default to what is provided in config.h if not provided.
The flags parameter can be used to set the flags for the movement. A list of them and their descriptions can be found in the MoveFlags enum. The arms::RELATIVE flag is always enabled for this, as you should only use this to move a relative distance straight with the bot.
void arms::chassis::move | ( | std::vector< double > | target, |
double | max, | ||
double | exit_error, | ||
double | lp, | ||
double | ap, | ||
MoveFlags | flags = NONE |
||
) |
Perform a 2D chassis movement based on the parameters provided.
target | The target point to move to. |
max | The maximum speed to move at. |
exit_error | The minimum distance from the target point to exit the movement. |
lp | The linear kP for the movement. |
ap | The angular kP for the movement. |
flags | The flags to use when moving the chassis. |
Example 1:
Example 2:
Example 3:
Moves the chassis to a target point. Almost all parameters are optional. Technically, only the target parameter is required. However, it is recommended to provide the max parameter aswell so that you have control over the maximum speed of the chassis.
The target parameter is a vector of doubles that represents the target point (x, y), or pose (x, y, theta). For a target point, our standard point-point odometry motion is used. For a target pose, our Boomerang controller is used. More information on these can be seen at MotionControl.
The max parameter can be used to set the maximum speed of the movement. It will default to 100% if not provided.
The exit_error parameter can be used to set the minimum error from the target point to exit the movement. It will default to what is provided in config::h::MIN_ERROR if not provided.
The lp parameter can be used to set the linear kP for the movement. It will default to what is provided in config.h if not provided.
The ap parameter can be used to set the angular kP for the movement. It will default to what is provided in config.h if not provided.
The flags parameter can be used to set the flags for the movement. A list of them and their descriptions can be found in the MoveFlags enum.
void arms::chassis::setBrakeMode | ( | pros::motor_brake_mode_e_t | brakeMode | ) |
Sets the chassis's brake mode
brakeMode | The chassis brake mode |
Example 1:
Sets the chassis's brake mode to a valid PROS Brake Mode Options are coast, hold, and brake.
bool arms::chassis::settled | ( | ) |
Example 1:
Checks if the chassis is settled.
void arms::chassis::tank | ( | double | left, |
double | right, | ||
bool | velocity = false |
||
) |
move the chassis using tank drive
left | The left side velocity or percentage (0%-100%). |
right | The right side velocity or percentage (0%-100%). |
velocity | Whether the values are velocities or percentages. Defaults to false for percentage mode. |
Example 1:
Example 2:
Example 3:
void arms::chassis::turn | ( | double | target, |
double | max, | ||
double | exit_error, | ||
double | ap, | ||
MoveFlags | flags = NONE |
||
) |
turn the chassis a target angle
Perform a turn movement
target | The target angle to turn to. |
flags | The flags to use when moving the chassis. |
max | The maximum speed to move at. |
exit_error | The minimum distance from the target point to exit the movement. |
ap | The angular kP for the movement. |
flags | The flags to use when moving the chassis. |
Almost all parameters are optional. Technically, only the target parameter is required. However, it is recommended to provide the max parameter aswell so that you have control over the maximum speed of the chassis.
Example 1:
Example 2:
Example 3:
Turns the chassis a target angle. Almost all parameters are optional. Technically, only the target parameter is required. However, it is recommended to provide the max parameter aswell so that you have control over the maximum speed of the chassis.
The target parameter is a double that represents the target angle (theta). We use our PID controller to turn to the target angle. More information on this can be seen at MotionControl.
The max parameter can be used to set the maximum speed of the movement. It will default to 100% if not provided.
The exit_error parameter can be used to set the minimum error from the target point to exit the movement. It will default to what is provided in config::h::MIN_ERROR if not provided.
The ap parameter can be used to set the angular kP for the movement. It will default to what is provided in config.h if not provided.
The flags parameter can be used to set the flags for the movement. A list of them and their descriptions can be found in the MoveFlags enum.
void arms::chassis::turn | ( | Point | target, |
double | max, | ||
double | exit_error, | ||
double | ap, | ||
MoveFlags | flags = NONE |
||
) |
turn the chassis to face a target point
target | The target point to turn to. |
flags | The flags to use when moving the chassis. |
max | The maximum speed to move at. |
exit_error | The minimum distance from the target point to exit the movement. |
ap | The angular kP for the movement. |
flags | The flags to use when moving the chassis. |
Example 1:
Example 2:
Example 3:
Turns the chassis a target angle. Almost all parameters are optional. Technically, only the target parameter is required. However, it is recommended to provide the max parameter aswell so that you have control over the maximum speed of the chassis.
The target parameter is a Point that represents the point we want to turn to face. We use our PID controller to turn to the target angle. More information on this can be seen at MotionControl.
The max parameter can be used to set the maximum speed of the movement. It will default to 100% if not provided.
The exit_error parameter can be used to set the minimum error from the target point to exit the movement. It will default to what is provided in config::h::MIN_ERROR if not provided.
The ap parameter can be used to set the angular kP for the movement. It will default to what is provided in config.h if not provided.
The flags parameter can be used to set the flags for the movement. A list of them and their descriptions can be found in the MoveFlags enum.
void arms::chassis::waitUntilFinished | ( | double | exit_error | ) |
exit_error | The minimum error from the target point to exit the wait |
Example 1:
Waits for the chassis to reach a target point within a certain exit_error. This function should not be required, as chassis::move is already a blocking function by default. However, this may need to be used if the chassis::move function is called with the MoveFlags::async flag.
|
extern |
This variable is a pointer to a Motor_Group object that contains all of the left motors.
|
extern |
This variable is used to set the maximum speed of the chassis.
|
extern |
This variable is a pointer to a Motor_Group object that contains all of the right motors.