Compare commits
No commits in common. "c97954b8159cc6c3f894a05032895a1d4a65c35a" and "cc4d99c21899ced6a1e98f68faaf51a2d455928e" have entirely different histories.
c97954b815
...
cc4d99c218
3 changed files with 16 additions and 3 deletions
Binary file not shown.
Binary file not shown.
|
|
@ -36,12 +36,25 @@ void setup() {
|
||||||
// TUNE VELOCITY PID
|
// TUNE VELOCITY PID
|
||||||
left_motor.tune_vel_pid(0.9, 3.7,0.3,0.0);
|
left_motor.tune_vel_pid(0.9, 3.7,0.3,0.0);
|
||||||
delay(10);
|
delay(10);
|
||||||
right_motor.tune_vel_pid(0.9, 3.7,0.3,0.0);
|
right_motor.tune_vel_pid(0.0, 3.7,0.3,0.0);
|
||||||
delay(10);
|
delay(10);
|
||||||
//right_motor.set_direction(PIDDirection::DIRECT);
|
right_motor.set_direction(PIDDirection::DIRECT);
|
||||||
|
|
||||||
|
uint16_t ratio = right_motor.get_gear_ratio();
|
||||||
|
Serial.print("ratio: ");
|
||||||
|
Serial.println(ratio);
|
||||||
|
ratio = left_motor.get_gear_ratio();
|
||||||
|
Serial.print("ratio: ");
|
||||||
|
Serial.println(ratio);
|
||||||
|
|
||||||
|
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
|
||||||
|
// SET MOTOR POSITION
|
||||||
|
//int32_t angle=360;
|
||||||
|
//uint8_t status= left_motor.write_angle(angle);
|
||||||
|
//delay(1000);
|
||||||
|
|
||||||
// READ MOTOR POSITION
|
// READ MOTOR POSITION
|
||||||
int32_t pos = left_motor.read_angle();
|
int32_t pos = left_motor.read_angle();
|
||||||
Serial.print("Pos: ");
|
Serial.print("Pos: ");
|
||||||
|
|
@ -68,7 +81,7 @@ void loop() {
|
||||||
|
|
||||||
left_motor.write_rpm(setpoint.velocity * CMS_RPM);
|
left_motor.write_rpm(setpoint.velocity * CMS_RPM);
|
||||||
delay(10);
|
delay(10);
|
||||||
right_motor.write_rpm((robot_state == TURN ? velocity : -velocity) * CMS_RPM);
|
right_motor.write_rpm(robot_state == TURN ? -velocity : velocity);
|
||||||
delay(10);
|
delay(10);
|
||||||
|
|
||||||
// READ MOTOR POSITION
|
// READ MOTOR POSITION
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue