SW improvement - Bumper stuck or sonar error

alda

Member
I have question regarding following problems :
if bumper is stuck, mower will start reverse mode which is still repeated, till mower cross a wire loop and jump somewhere :)
Did anybody tried implement error stop after one or two reverse mode with bumper still switched ?
Same function I'm missing for sonar.

Alex
 
Hi Alex,

I did implement bumperstuck behaviour:
Error immediatly when bumper still pressed after reverse: https://github.com/Holoratte/ardumower/commit/ff06ca556fbceae963c4a6283bb56d40eb2c4555 and here I got a timeout of 1min. After that it will go error. If the bumper is free withing 1min, it will continue. https://github.com/Holoratte/ardumower/commit/1858013f4a04aa1eead7e08fe2fdd084fd010803
You will have to sort out the nessacery changes, since there is more than just bumper changes in these pushes.
Chris
 
Holoratte schrieb:
Hi Alex,

I did implement bumperstuck behaviour:
Error immediatly when bumper still pressed after reverse: https://github.com/Holoratte/ardumower/commit/ff06ca556fbceae963c4a6283bb56d40eb2c4555
Chris

Not sure if it's linked directly to reverse mode, because there is only time :


Code:
+    if (bumperLeft) { 
+        if (((millis() - bumperLeftLastTime) > 2000) && ((millis() - bumperLeftLastTime) < (motorReverseTime+5000))){ 
+          setNextState(STATE_BUMPER_STUCK, LEFT);


is this possible for left ? :

Code:
if (bumperLeft) { 
      if (bumperLeftLastTime){ 
      setNextState(STATE_BUMPER_STUCK, LEFT);
      else{
      reverseOrBidir(RIGHT); 
      bumperLeftLastTime)=true;
      {
   else{
    bumperLeftLastTime)=false;
   {




Alex
 
Zuletzt bearbeitet von einem Moderator:
Hi Alex,

when a bumper is pushed, the mower goes reverseOrBidir(). In my case reverse.
During reverse there is no checkbumpers(). After reverse state is finished, if the bumper is still pressed: STATE_BUMPER_STUCK
Tested and working on SheepSheep...

Chris
 
Hi,
One question regarding error counter. I want add new error, because in Chris code is : addErrorCounter(ERR_STUCK);
but I want add new error ERR_BUMPER_STUCK
I want add it here :


Code:
// error types
enum {
  ERR_MOTOR_LEFT,
  ERR_MOTOR_RIGHT,
  ERR_MOTOR_MOW,
  ERR_MOW_SENSE,
  ERR_IMU_COMM,
  ERR_IMU_TILT,
  ERR_RTC_COMM,
  ERR_RTC_DATA,
  ERR_PERIMETER_TIMEOUT,
  ERR_TRACKING,
  ERR_ODOMETRY_LEFT,
  ERR_ODOMETRY_RIGHT,
  ERR_BATTERY,
  ERR_CHARGER,
  ERR_GPS_COMM,
  ERR_GPS_DATA,
  ERR_ADC_CALIB,
  ERR_IMU_CALIB,
  ERR_EEPROM_DATA,
  ERR_STUCK,
  // <---- add new error types here (NOTE: increase MAGIC to avoid corrupt EEPROM error data!)
  ERR_ENUM_COUNT,  
};


But not sure what means increase MAGIC ? What is it magic and how it's working ?

Thank you

Alex
 
Hi Alda.

But not sure what means increase MAGIC ? What is it magic and how it's working ?

For me but need to be confirm.
The MAGIC=52 is here to know if the value in the eeprom are not corrupted (It can be the value you want 25, 10, 53 etc....).
It's also use to tell that there is no data stored by put 0 instead of this Magic value


For the eeprom You have
#define ADDR_USER_SETTINGS 0
#define ADDR_ERR_COUNTERS 400
#define ADDR_ROBOT_STATS 800
In normal working the value 52 is write at addr 0 , 400 and 800 so at the first addr of each Type of storing data.
If you add a lot of variable in the user setting for example, the addr where you are writting maybe can go over the 400 so replace the 52 value and the next time you read the ERR_COUNTERS you don't find the 52 Value and generate a "EPROM ERR COUNTERS: NO EEPROM ERROR DATA.

I think Increase the Magic value is an error in the comment

What you can do is only change the starting addr of type data 0 400 or 800 but normaly no problem to add 1 error counter.

Hope i's TRUE and can help.
 
as I understand, MAGIC is a tool to force the user to load factory settings when eeprom adresses or order of settings change.
If MAGIC change the code refuse to read or write the settings to eeprom and forces default settings to be used.
MAGIC should be increased by 1, when when you change the order of the settings in the eeprom.
If you just add settings to the eeprom at the end of existing settings it may not be nesssacery to change MAGIC as long as the adress space is sufficient.

There are adress spaces defined, as Bernard say, but there are more: IMU #define ADDR 600 has its own adress space, as well as adcman #define ADDR 500 and others.... so be careful.

Maybe Alexander can explain this more detailed?

Chris
 
Oben