SW modification - bumper high speed reaction

alda

Member
Hi,
I need help with following modification.
I want imediate mower stop when left/right bumper is pressed.
Problem is, that motors are controled via motorControl(). Here with odometry via PID or without odometry with acceleration on - in both cases stop isn't imediate.

I tried change checkbumpers from :

Code:
void Robot::checkBumpers(){ 
   if ((mowPatternCurr == MOW_BIDIR) && (millis() < stateStartTime + 4000)) return; 
 
   if ((bumperLeft || bumperRight)) {     
       if (bumperLeft) { 
         reverseOrBidir(RIGHT);           
       } else { 
         reverseOrBidir(LEFT); 
       }     
   }   
 }


to :


Code:
// check bumpers
void Robot::checkBumpers(){
  if ((mowPatternCurr == MOW_BIDIR) && (millis() < stateStartTime + 4000)) return;
  if ((bumperLeft || bumperRight)) { 

    setMotorPWM( 0, 0, false );    // immediate stop at bumping

    if (bumperLeft) {
      reverseOrBidir(RIGHT);          
    } else {
      reverseOrBidir(LEFT);
    }    
  }  
}


Mower will stop very fast, but will not start again till bumper is released.

Please can you help me modification which make imediate stop of mower when bumper is pressed ?

Thanks

Alex
 
Hi.
Normaly this may work but need to be tested .

in robot.cpp

Code:
// check bumpers
void Robot::checkBumpers(){
  if ((mowPatternCurr == MOW_BIDIR) && (millis() < stateStartTime + 4000)) return;

  if ((bumperLeft || bumperRight)) { 
	// immediate stop at bumping
    motorLeftRpmCurr = motorRightRpmCurr = 0 ;
    setMotorPWM( 0, 0, false );
    if (bumperLeft) {
      reverseOrBidir(rollDirection);          
    } else {
      reverseOrBidir(rollDirection);
    }    
  }  
}



And Also if you use protector board you can reduce the motorZeroSettleTime
Do not put less than 2000ms to avoid problem with the motor controler.
In Mower.cpp

Code:
motorZeroSettleTime   = 2000 ; // defaut 3000 how long (ms) to wait for motors to settle at zero speed
 
Hi,
modification in in robot.cpp not working, because if bumper is still pressed,
setMotorPWM( 0, 0, false ); is still stopping motor movement. Tested yesterday.

Alex
 
Ok.
You also need to remove the checkBumpers() test in the reverse function or effectively the mower definitively stop

Code:
case STATE_REVERSE:
      // driving reverse
      checkErrorCounter();
      checkTimer();
      checkCurrent();
      //checkBumpers();
      checkDrop();                                                                                                                            // Dropsensor - Absturzsensor
      //checkSonar();
      checkPerimeterBoundary();
      //checkLawn();
 
Oben