faster reverse driving
This commit is contained in:
parent
7975ca4c7d
commit
8a57f4b876
|
@ -58,6 +58,9 @@ unsigned long brake_ok_time=0;
|
|||
bool error_throttle_outofrange=false;
|
||||
bool error_brake_outofrange=false;
|
||||
|
||||
#define REVERSE_ENABLE_TIME 1000 //ms. how long standstill to be able to drive backward
|
||||
#define REVERSE_SPEED 0.15 //reverse driving speed //0 to 1
|
||||
|
||||
#define NORMAL_MAX_ACCELERATION_RATE 10000
|
||||
#define SLOW_MAX_ACCELERATION_RATE 500
|
||||
int16_t max_acceleration_rate=NORMAL_MAX_ACCELERATION_RATE; //maximum cmd send increase per second
|
||||
|
@ -433,7 +436,7 @@ void readADC() {
|
|||
last_notidle=loopmillis;
|
||||
reverse_enabled=false;
|
||||
}
|
||||
#define REVERSE_ENABLE_TIME 1000
|
||||
|
||||
if (loopmillis-last_notidle > REVERSE_ENABLE_TIME) {
|
||||
reverse_enabled=true;
|
||||
}
|
||||
|
@ -566,8 +569,9 @@ void sendCMD() {
|
|||
|
||||
int16_t cmd_send_toMotor=constrain(cmd_send* (1.0-(brake_pos*0.5/1000.0) ) ,0,1000); //brake "ducking"
|
||||
|
||||
|
||||
if (reverse_enabled) {
|
||||
cmd_send_toMotor-=brake_pos*0.1;
|
||||
cmd_send_toMotor-=brake_pos*REVERSE_SPEED;
|
||||
}
|
||||
|
||||
if (!controllers_connected || !armed) { //controllers not connected or not armed
|
||||
|
@ -588,12 +592,11 @@ void sendCMD() {
|
|||
log_update=true;
|
||||
//Serial.print(cmd_send); Serial.print(", "); Serial.print(throttle_pos); Serial.print(", "); Serial.print(filtered_curFL*1000); Serial.print(", "); Serial.print(filtered_curFR*1000); Serial.print(", "); Serial.print(filtered_currentAll*1000); Serial.println()
|
||||
|
||||
}else if(loopmillis>last_log_send+LOGMININTERVAL){
|
||||
}/*else if(loopmillis>last_log_send+LOGMININTERVAL){
|
||||
//Serial.print(throttle_raw); Serial.println();
|
||||
|
||||
Serial.print(linearizeThrottle(throttle_raw)); Serial.println();
|
||||
last_log_send=loopmillis;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue