Commit 2712234e authored by 李柏葳's avatar 李柏葳
Browse files

Update bbcar.cpp

parent 649eabb0
......@@ -12,17 +12,17 @@ void BBCar::controlWheel(){
}
void BBCar::stop(){
servo0.set_speed(0);
servo1.set_speed(0);
servo0.set_factor(1);
servo1.set_factor(1);
servo0.set_speed(0);
servo1.set_speed(0);
}
void BBCar::goStraight( double speed ){
servo0.set_speed(speed);
servo1.set_speed(-speed);
void BBCar::goStraight( double speed ){\
servo0.set_factor(1);
servo1.set_factor(1);
servo0.set_speed(speed);
servo1.set_speed(-speed);
}
void BBCar::setCalibTable( int len0, double pwm_table0[], double speed_table0[], int len1, double pwm_table1[], double speed_table1[] ){
......@@ -30,10 +30,10 @@ void BBCar::setCalibTable( int len0, double pwm_table0[], double speed_table0[],
servo1.set_calib_table(len1, pwm_table1, speed_table1);
}
void BBCar::goStraightCalib ( double speed ){
servo0.set_speed_by_cm(speed);
servo1.set_speed_by_cm(-speed);
servo0.set_factor(1);
servo1.set_factor(1);
servo0.set_speed_by_cm(speed);
servo1.set_speed_by_cm(-speed);
}
/* speed : speed value of servo
......@@ -41,8 +41,6 @@ void BBCar::goStraightCalib ( double speed ){
control left/right turn with +/-
*/
void BBCar::turn( double speed, double factor ){
servo0.set_speed(speed);
servo1.set_speed(-speed);
if(factor>0){
servo0.set_factor(factor);
servo1.set_factor(1);
......@@ -51,6 +49,9 @@ void BBCar::turn( double speed, double factor ){
servo0.set_factor(1);
servo1.set_factor(-factor);
}
servo0.set_speed(speed);
servo1.set_speed(-speed);
}
float BBCar::clamp( float value, float max, float min ){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment