added coeff for left motor
This commit is contained in:
parent
a15dc3d11d
commit
c97954b815
1 changed files with 3 additions and 16 deletions
|
|
@ -36,25 +36,12 @@ 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.0, 3.7,0.3,0.0);
|
right_motor.tune_vel_pid(0.9, 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: ");
|
||||||
|
|
@ -81,7 +68,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);
|
right_motor.write_rpm((robot_state == TURN ? velocity : -velocity) * CMS_RPM);
|
||||||
delay(10);
|
delay(10);
|
||||||
|
|
||||||
// READ MOTOR POSITION
|
// READ MOTOR POSITION
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue