Drive and Telemetry
Set Drive​
set_tank()​
Sets the drive to voltage.
left
an integer between -127 and 127
right
an integer between -127 and 127
- Prototype
- Example
void autonomous() {
set_tank(127, 127);
pros::delay(1000); // Wait 1 second
set_tank(0, 0);
}
void set_tank(int left, int right);
set_drive_brake()​
Sets brake mode for all drive motors.
brake_type
takes either MOTOR_BRAKE_COAST
, MOTOR_BRAKE_BRAKE
, and MOTOR_BRAKE_HOLD
as parameters
- Prototype
- Example
void initialize() {
set_drive_brake_mode(MOTOR_BRAKE_COAST);
}
void set_drive_brake(pros::motor_brake_mode_e_t brake_type);
set_drive_current_limit()​
Sets mA limit to the drive. Default is 2500.
mA
input miliamps
- Prototype
- Example
void initialize() {
set_drive_brake_mode(1000);
}
void set_drive_current_limit(int mA);
Telemetry​
right_sensor()​
Returns right sensor value, either integrated encoder or external encoder.
- Prototype
- Example
void opcontrol() {
while (true) {
chassis.tank();
printf("Right Sensor: %i \n", chassis.right_sensor());
pros::delay(ez::util::DELAY_TIME);
}
}
int right_sensor();
right_velocity()​
Returns integrated encoder velocity.
- Prototype
- Example
void opcontrol() {
while (true) {
chassis.tank();
printf("Right Velocity: %i \n", chassis.right_velocity());
pros::delay(ez::util::DELAY_TIME);
}
}
int right_velocity();
right_mA()​
Returns current mA being used.
- Prototype
- Example
void opcontrol() {
while (true) {
chassis.tank();
printf("Right mA: %i \n", chassis.right_mA());
pros::delay(ez::util::DELAY_TIME);
}
}
double right_mA();
right_over_current()​
Returns true
when the motor is pulling too many amps.
- Prototype
- Example
void opcontrol() {
while (true) {
chassis.tank();
printf("Right Over Current: %i \n", chassis.right_over_current());
pros::delay(ez::util::DELAY_TIME);
}
}
bool right_over_current();
left_sensor()​
Returns left sensor value, either integrated encoder or external encoder.
- Prototype
- Example
void opcontrol() {
while (true) {
chassis.tank();
printf("Left Sensor: %i \n", chassis.left_sensor());
pros::delay(ez::util::DELAY_TIME);
}
}
int left_sensor();
left_velocity()​
Returns integrated encoder velocity.
- Prototype
- Example
void opcontrol() {
while (true) {
chassis.tank();
printf("Left Velocity: %i \n", chassis.left_velocity());
pros::delay(ez::util::DELAY_TIME);
}
}
int left_velocity();
left_mA()​
Returns current mA being used.
- Prototype
- Example
void opcontrol() {
while (true) {
chassis.tank();
printf("Left mA: %i \n", chassis.left_mA());
pros::delay(ez::util::DELAY_TIME);
}
}
double left_mA();
left_over_current()​
Returns true
when the motor is pulling too many amps.
- Prototype
- Example
void opcontrol() {
while (true) {
chassis.tank();
printf("Left Over Current: %i \n", chassis.left_over_current());
pros::delay(ez::util::DELAY_TIME);
}
}
bool left_over_current();
reset_drive_sensor()​
Resets integrated encoders and trackers if applicable.
- Prototype
- Example
void initialize() {
chassis.reset_drive_sensor();
}
void reset_drive_sensor();
reset_gyro()​
Sets current gyro position to parameter, defaulted to 0.
- Prototype
- Example
void initialize() {
chassis.reset_gyro();
}
void reset_gyro(double new_heading = 0);
get_gyro()​
Gets IMU sensor, value is degrees.
- Prototype
- Example
void opcontrol() {
while (true) {
chassis.tank();
printf("Gyro: %f \n", chassis.get_gyro());
pros::delay(ez::util::DELAY_TIME);
}
}
double get_gyro();
imu_calibrate()​
Calibrates IMU, and vibrates the controller after a successful calibration.
- Prototype
- Example
void initialize() {
chassis.imu_calibrate();
}
bool imu_calibrate();