Skip to content

Commit

Permalink
drive.hpp EZ-Robotics#65
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhlb committed Oct 25, 2022
1 parent 5771520 commit 3159235
Show file tree
Hide file tree
Showing 23 changed files with 863 additions and 889 deletions.
274 changes: 137 additions & 137 deletions docs/Docs/auton_functions.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/Docs/auton_selector.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ void selected_auton_call();
**Example**
```cpp
void autonomous() {
chassis.reset_gyro();
chassis.reset_drive_sensor();
chassis.set_drive_brake(MOTOR_BRAKE_HOLD);
chassis.imu_reset();
chassis.drive_sensors_reset();
chassis.drive_brake_set(MOTOR_BRAKE_HOLD);

ez::as::auton_selector.selected_auton_call();
}
Expand Down
16 changes: 8 additions & 8 deletions docs/Docs/pto.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ bool pto_check(pros::Motor check_if_pto);
**Example**
```cpp
pros::Motor& intake_l = chassis.left_motors[1];
pros::Motor& intake_r = chassis.right_motors[1];
pros::Motor& intake_l = chassis.motors_left[1];
pros::Motor& intake_r = chassis.motors_right[1];
void initialize() {
printf("Check: %i %i\n", chassis.pto_check(intake_l), chassis.pto_check(intake_r))); // This prints 0 0
Expand All @@ -101,8 +101,8 @@ void pto_add(std::vector<pros::Motor> pto_list);
**Example**
```cpp
pros::Motor& intake_l = chassis.left_motors[1];
pros::Motor& intake_r = chassis.right_motors[1];
pros::Motor& intake_l = chassis.motors_left[1];
pros::Motor& intake_r = chassis.motors_right[1];
void initialize() {
printf("Check: %i %i\n", chassis.pto_check(intake_l), chassis.pto_check(intake_r))); // This prints 0 0
Expand All @@ -124,8 +124,8 @@ void pto_remove(std::vector<pros::Motor> pto_list);
**Example**
```cpp
pros::Motor& intake_l = chassis.left_motors[1];
pros::Motor& intake_r = chassis.right_motors[1];
pros::Motor& intake_l = chassis.motors_left[1];
pros::Motor& intake_r = chassis.motors_right[1];
void initialize() {
printf("Check: %i %i\n", chassis.pto_check(intake_l), chassis.pto_check(intake_r))); // This prints 0 0
Expand All @@ -149,8 +149,8 @@ void pto_toggle(std::vector<pros::Motor> pto_list, bool toggle);
**Example**
```cpp
pros::Motor& intake_l = chassis.left_motors[1];
pros::Motor& intake_r = chassis.right_motors[1];
pros::Motor& intake_l = chassis.motors_left[1];
pros::Motor& intake_r = chassis.motors_right[1];
pros::ADIDigitalOut pto_intake_piston('A');
bool pto_intake_enabled = false;
Expand Down
82 changes: 41 additions & 41 deletions docs/Docs/set_and_get_drive.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,34 +69,34 @@ Drive chassis (

# Set Drive

## set_tank()
## tank_set()
Sets the drive to voltage.
`left` an integer between -127 and 127.
`right` an integer between -127 and 127.
**Prototype**
```cpp
void set_tank(int left, int right);
void tank_set(int left, int right);
```
**Example**
```cpp
void autonomous() {
set_tank(127, 127);
tank_set(127, 127);
pros::delay(1000); // Wait 1 second
set_tank(0, 0);
tank_set(0, 0);
}
```


---


## set_drive_brake()
## drive_brake_set()
Sets brake mode for all drive motors.
`brake_type` takes either `MOTOR_BRAKE_COAST`, `MOTOR_BRAKE_BRAKE`, and `MOTOR_BRAKE_HOLD` as parameters.
**Prototype**
```cpp
void set_drive_brake(pros::motor_brake_mode_e_t brake_type);
void drive_brake_set(pros::motor_brake_mode_e_t brake_type);
```
**Example**
Expand All @@ -110,12 +110,12 @@ void initialize() {
---


## set_drive_current_limit()
## drive_current_limit_set()
Sets mA limit to the drive. Default is 2500.
`mA`input miliamps.
**Prototype**
```cpp
void set_drive_current_limit(int mA);
void drive_current_limit_set(int mA);
```
**Example**
Expand All @@ -131,11 +131,11 @@ void initialize() {

# Telemetry

## right_sensor()
## sensor_right()
Returns right sensor, either integrated encoder or external encoder.
**Prototype**
```cpp
int right_sensor();
int sensor_right();
```

**Example**
Expand All @@ -144,7 +144,7 @@ void opcontrol() {
while (true) {
chassis.tank();

printf("Right Sensor: %i \n", chassis.right_sensor());
printf("Right Sensor: %i \n", chassis.sensor_right());

pros::delay(ez::util::DELAY_TIME);
}
Expand All @@ -155,11 +155,11 @@ void opcontrol() {
---


## right_velocity()
## velocity_right()
Returns integrated encoder velocity.
**Prototype**
```cpp
int right_velocity();
int velocity_right();
```

**Example**
Expand All @@ -168,7 +168,7 @@ void opcontrol() {
while (true) {
chassis.tank();

printf("Right Velocity: %i \n", chassis.right_velocity());
printf("Right Velocity: %i \n", chassis.velocity_right());

pros::delay(ez::util::DELAY_TIME);
}
Expand All @@ -179,11 +179,11 @@ void opcontrol() {
---


## right_mA()
## mA_right()
Returns current mA being used.
**Prototype**
```cpp
double right_mA();
double mA_right();
```

**Example**
Expand All @@ -192,7 +192,7 @@ void opcontrol() {
while (true) {
chassis.tank();

printf("Right mA: %i \n", chassis.right_mA());
printf("Right mA: %i \n", chassis.mA_right());

pros::delay(ez::util::DELAY_TIME);
}
Expand All @@ -203,11 +203,11 @@ void opcontrol() {
---


## right_over_current()
## over_current_right()
Returns `true` when the motor is over current.
**Prototype**
```cpp
bool right_over_current();
bool over_current_right();
```

**Example**
Expand All @@ -216,7 +216,7 @@ void opcontrol() {
while (true) {
chassis.tank();

printf("Right Over Current: %i \n", chassis.right_over_current());
printf("Right Over Current: %i \n", chassis.over_current_right());

pros::delay(ez::util::DELAY_TIME);
}
Expand All @@ -227,11 +227,11 @@ void opcontrol() {
---


## left_sensor()
## sensor_left()
Returns left sensor, either integrated encoder or external encoder.
**Prototype**
```cpp
int left_sensor();
int sensor_left();
```

**Example**
Expand All @@ -240,7 +240,7 @@ void opcontrol() {
while (true) {
chassis.tank();

printf("Left Sensor: %i \n", chassis.left_sensor());
printf("Left Sensor: %i \n", chassis.sensor_left());

pros::delay(ez::util::DELAY_TIME);
}
Expand All @@ -251,11 +251,11 @@ void opcontrol() {
---


## left_velocity()
## velocity_left()
Returns integrated encoder velocity.
**Prototype**
```cpp
int left_velocity();
int velocity_left();
```

**Example**
Expand All @@ -264,7 +264,7 @@ void opcontrol() {
while (true) {
chassis.tank();

printf("Left Velocity: %i \n", chassis.left_velocity());
printf("Left Velocity: %i \n", chassis.velocity_left());

pros::delay(ez::util::DELAY_TIME);
}
Expand All @@ -275,11 +275,11 @@ void opcontrol() {
---


## left_mA()
## mA_left()
Returns current mA being used.
**Prototype**
```cpp
double left_mA();
double mA_left();
```

**Example**
Expand All @@ -288,7 +288,7 @@ void opcontrol() {
while (true) {
chassis.tank();

printf("Left mA: %i \n", chassis.left_mA());
printf("Left mA: %i \n", chassis.mA_left());

pros::delay(ez::util::DELAY_TIME);
}
Expand All @@ -299,11 +299,11 @@ void opcontrol() {
---


## left_over_current()
## over_current_left()
Returns `true` when the motor is over current.
**Prototype**
```cpp
bool left_over_current();
bool over_current_left();
```

**Example**
Expand All @@ -312,7 +312,7 @@ void opcontrol() {
while (true) {
chassis.tank();

printf("Left Over Current: %i \n", chassis.left_over_current());
printf("Left Over Current: %i \n", chassis.over_current_left());

pros::delay(ez::util::DELAY_TIME);
}
Expand All @@ -322,47 +322,47 @@ void opcontrol() {

---

## reset_drive_sensor()
## drive_sensors_reset()
Resets integrated encoders and trackers if applicable.
**Prototype**
```cpp
void reset_drive_sensor();
void drive_sensors_reset();
```

**Example**
```cpp
void initialize() {
chassis.reset_drive_sensor();
chassis.drive_sensors_reset();
}
```


---


## reset_gyro()
## imu_reset()
Sets current gyro position to parameter, defaulted to 0.
**Prototype**
```cpp
void reset_gyro(double new_heading = 0);
void imu_reset(double new_heading = 0);
```
**Example**
```cpp
void initialize() {
chassis.reset_gyro();
chassis.imu_reset();
}
```


---


## get_gyro()
## imu_get()
Gets IMU.
**Prototype**
```cpp
double get_gyro();
double imu_get();
```

**Example**
Expand All @@ -371,7 +371,7 @@ void opcontrol() {
while (true) {
chassis.tank();

printf("Gyro: %f \n", chassis.get_gyro());
printf("Gyro: %f \n", chassis.imu_get());

pros::delay(ez::util::DELAY_TIME);
}
Expand Down
Loading

0 comments on commit 3159235

Please sign in to comment.