Sunray modding Spielwiese

Ich nochmal, habe jetz endlich den plan umgesetzt alle tuning funktionen auch ohne rpm sondern zb. nur über pwm mit strom (leistung) bereitzustellen umgesetzt, für die die keine mowmotor odometrie haben. Also Rückwärts falls gras zu hoch, langsamer/schneller nach leistung (gab es vorher auch schon). Es lässt sich jetzt auch alles mischen, ich habe es getestet. Allerdings ist das tuning schwierig und die konstanten sind nicht optimal, es funktioniert aber, da muss jeder mal selbst auf seine hardware hinoptimieren. Auch sind die einstellungen ziemlich erschlagend geworden, wenn man nicht weis was wann überhaupt benutzt wird, habe dahingehend noch die beschreibungen erweitert, allerdings hilft das dann auch nicht viel. Ich werde da demnächst noch n bissl debuggen bzw. vereinfachen. aber mehr wird da erstmal nicht hinzukommen. Bei konfigschwierigkeiten stehe ich gerne zur verfügung. Wer die ultimative experience haben möchte sollte Escape Lawn im mode 2 einstellen (RPM) und AdaptiveSpeed im mode 1 (Power).
Bugs sind garantiert, und dann am besten hier schreiben.

Cheers.
 
Seems a lot of interesting developments are ongoing in this branch!

My ardumower rotates like a balerina when trying to exit (and sometimes just before entering) the docking station. (I'm aware of the amount of points which need to be defined in the path but still it doesn't seem to solve the problem.)
Would any of the changes in this branch give a possible solution to this?

thanks
 
Zuletzt bearbeitet:
Ist zwar nicht das richtige Forum, aber darf ich trotzdem fragen, ob schon jemand aufgefallen ist, dass die Obstacle Erkennung nicht funktioniert wenn der Mäher zwischendurch zum Laden ans Dock fährt?
 
Yes, defenitely. That behaviour is the root issue that led to the DOCK_NO_ROTATION function as a workaround.
so I did a test with the latest software from github https://github.com/MrTreeBark.

  • Converted my original parameters to the config file. (I have an ardumower with the brushed drivers, no sensor on the mower motor.)
  • Created a new docking path.
Observations/issues (posting here since I don't think issues are enabled in github):
  • When mowing it manually through cassandra the speed is very slow
  • I've tried to let it mow:
    • it moves to its first point of the map (without the mowing blade turned on :)). Then it turns on its mower but it immediately goes into an obstacle error.
    • The movement towards its first point was very slow (maybe half speed or so compared to standard software)
  • I've tried to let it go to its docking station
    • but immediately resulted in an obstacle error (didn't observe any actual movement)
Any suggestions or further debugging advice?

for completeness added the used parameters here:
// #define MPU6050
//#define MPU9150
#define MPU9250 // also choose this for MPU9255
//#define BNO055
//#define ICM20948
#define MPU_ADDR 0x69 // I2C address (0x68 if AD0=LOW, 0x69 if AD0=HIGH)
// imu fifo rate (Hz)
#define IMU_FIFO_RATE 5
// should the mower turn off if IMU is tilt over? (yes: uncomment line, no: comment line)
#define ENABLE_TILT_DETECTION 1
// --------- lift sensor (e.g. Alfred mower) ---------------------------------------------
// should the lift sensor be enabled? (yes: uncomment line, no: comment line)
//#define ENABLE_LIFT_DETECTION 1
// should the lift sensor be used for obstacle avoidance (if not, mower will simply go into error if lifted)
// #define LIFT_OBSTACLE_AVOIDANCE 1
////////////////////////////////////////////////////////////////////////////////////////////////////
//Modsection START
//please keep in mind that there are bugs, but if you encounter bugs that stop the operation of mower on an area completely please tell me about it...
//Experimental Modfunctions/Options/Speeds/Time etc. for different stuff and movement operations. Please read the descriptions. Cheers.
//Mower general times and speeds with their condition parameters, this section is the easiest to be tuned for one´s needs... so feel free and just tune to what you want to see on the lawn
#define MOWSPINUPTIME 10000 // (ms) Adds time to rotate mowingdisc before starting moving, use high value if you enable ESCAPE_LAWN for good reading of idle mow motor RPM
#define OVERLOADSPEED 0.15 // (m/s) if there is a overloadcurrent of a motordriver, mower will use OVERLOADSPEED
#define TRACKSLOWSPEED 0.20 // (m/s) e.g the docking speed or functions of the future
#define NEARWAYPOINTSPEED 0.25 // (m/s) the speed of mower when reaching/leaving a waypoint
#define NEARWAYPOINTDISTANCE 0.45 // (m) the distance of mower if approaching and leaving a waypoint and thus triggers NEARWAYPOINTSPEED of mower
#define FLOATSPEED 0.25 // (m/s) on GPS FLOAT SOLUTION, mower will use FLOATSPEED
#define SONARSPEED 0.15 // (m/s) if sonar enabled and used, on sonar trigger mower will use SONARSPEED
#define OBSTACLEAVOIDANCESPEED 0.35 // (m/s) on obstacle evade operations, mower will use OBSTACLEAVOIDANCESPEED
#define ESCAPE_REVERSE_WAY 0.45 // (m) distance in meters the mover will drive reverse in escapeReverseOp if obstacle triggered eg. by bumper org gps no speed
#define ESCAPE_FORWARD_WAY 0.25 // (m) distance in meters the mover will drive forward in escapeForwardOp if obstacle triggered by OBSTACLE_ROTATION (no rotation)
#define GLOBALSPEEDLIMIT true // if true, MOTOR_MAX_SPEED and MOTOR_MIN_SPEED will limit possible code bugs or inputs directly in motor.cpp
#define MOTOR_MAX_SPEED 0.60 // (m/s) maximum mower speed
#define MOTOR_MIN_SPEED 0.05 // (m/s) minimal mower speed
//rotation speeds, also this is easy to tune for your expectations
#define DOCKANGULARSPEED 25.0 // (deg/s) the turning rate of mower when docking (no change needed, keep low; tune at your needs if you must)
#define ROTATETOTARGETSPEED1 65.0 // (deg/s) if angle difference to point is more than ANGLEDIFF1 then this value will be used... warning, a high value will result in extreme gearmotor stress (test at own risk, 65deg/s is still safe and fast)
#define ROTATETOTARGETSPEED2 40.0 // (deg/s) if angle difference to point is between ANGLEDIFF1 and ANGLEDIFF2 then this value will be used...
#define ROTATETOTARGETSPEED3 25.0 // (deg/s) if angle difference to point is less than ANGLEDIFF2 then this value will be used...
#define ANGLEDIFF1 30.0 // (deg) if angle to point is more than ANGLEDIFF1 --> ROTATETOTARGETSPEED1 will be used
#define ANGLEDIFF2 15.0 // (deg) if angle to point is between ANGLEDIFF1 and ANGLEDIFF2 --> ROTATETOTARGETSPEED2 will be used, if it is less ROTATETOTARGETSPEED3 will be used...
#define ANGLEPRECISE 5.0 // (deg) if Angle to point ist within 5deg, mower will continue with Linetracker.cpp Stanleycode and NEARWAYPOINT setup
//use a PID controller for mowmotor to set an RPM instead of PWM? If you use this (there will be a console output with data after 10sec when you activate the mowmotor and this is enabled)
//CONFIG HINT: for the following options it is important if you have mow motor odometrie: USE_MOW_RPM_SET, ADAPTIVE_SPEED_MODE, ESCAPE_LAWN_MODE. If you do not have odometrie: use mode 1 on both cases and set USE_MOW_RPM_SET = false, if you have odometrie use mode 2 on both cases and set USE_MOW_RPM_SET = true (recommended)
#define USE_MOW_RPM_SET false // uses RPM instead of PWM to set mowmotor (RPM_FAULT_DETECTION of orig Sunray is best to be set TRUE for all RPM based functions!!)
#define MOWMOTOR_RPM_OFFSET 110 // compensate small RPM offsets (positive if RPM reading is less then RPM setpoint)
#define MOWMOTOR_PID_KP 0.0024// (0.0024 Mowmotordriver DRV8308) (0.0018 JYQD) this is enough to compensate battery drainage over time and have a slow spinup, there may be a controlleroffset to rpm which has to be thought of... RPM_OFFSET
#define MOWMOTOR_PID_KI 0.002 // (0.04 (Mowmotordriver DRV8308/JYQD))
#define MOWMOTOR_PID_KD 0.00 // (0.0000 (Mowmotordriver DRV8308/JYQD))
//adaptive_speed settings on RPM or LOAD of mowmotor (consider if you have mowmotor odometrie)
#define ADAPTIVE_SPEED false // if true, mowing speed will adjust to RPM or MOWMOTORPOWER of mow motor on all forward speed mow operations
#define ADAPTIVE_SPEED_MODE 1 // (1, 2) adaptive speed modes. mode 1 - uses mowmotorpower measurement for speeding up/down; mode 2 - uses rpm measurement of mowmotor for speeding up/down
#define MOWPOWERMAX_AUTO true // uses highest actual measured mowPower during operation, if true MOWPOWERMAX is ignored
#define MOWPOWERMIN 10.0 // (Watt) idle Power of Mowmotor or minimum load power of mowmotor, if under this load mower will have maximum speed
#define MOWPOWERMAX 35.0 // (Watt) max load power of mowmotor, when hitting this load mower will be at minspeed
#define MOW_RPM_NORMAL 3000 // (3200)(rpm, only used if USE_MOW_RPM_SET = true) mow motor rpm for mowing (WARNING, you should check if your rpm output works as espected! if it does work, but the reading is wrong, you need to calculate the mowmotorticks per second according to realistic rpm!)
#define MOW_RPM_SLOW 3300 // (3400)(rpm, only used if USE_MOW_RPM_SET = true) mow motor rpm when MOW_RPMtr_SLOW (%) of MOW_RPM_NORMAL (rpm) is met. Should be higher or the same as MOW_RPM_NORMAL
#define MOW_RPM_RETRY 3600 // (3600)(rpm, only used if USE_MOW_RPM_SET = true) mow motor rpm when MOW_RPMtr_RETRY (%) of MOW_RPM_NORMAL (rpm) is met. Should be higher or the same as MOW_RPM_SLOW4 (is only used by ESCAPE_LAWN)
#define MOW_PWM_NORMAL 185 // (pwm, only used if USE_MOW_RPM_SET = false) pwm of mow motor for normal mowing
#define MOW_PWM_SLOW 205 // (pwm, only used if USE_MOW_RPM_SET = false) pwm of mow motor when during mowing a keepslow state is triggered. Should be higher or the same as MOW_PWM_NORMAL
#define MOW_PWM_RETRY 235 // (pwm, only used if USE_MOW_RPM_SET = false) pwm of mow motor when during mowing a retryslow state is triggered (after escape lawn). Should be higher or the same as MOW_PWM_SLOW
//escapeLawn operation, mower will backup on a mowmotor stall and retry with given values... after the first try and still stalling, it backs up and waits for mowmotor to recover
#define ESCAPE_LAWN false // mower drives reverse if true and RPM stall of mow motor is detected by more than MOW_RPMtr_STALL(percentage), only available if ENABLE_RPM_FAULT_DETECTION true
#define ESCAPE_LAWN_MODE 1 // (1, 2) escape lawn modes to trigger escape becouse of high motormow load: mode 1 - uses mowmotorpower for triggering, mode 2 - uses rpm for triggering
#define MOW_POWERtr_STALL 80 // (%, only used if ESCAPE_LAWN_MODE = 1) if power of mowmotor exceeds e.g 90% of MOWPOWERMAX, escapelawn is triggered
#define MOW_POWERtr_SLOW 70 // (%, only used if ESCAPE_LAWN_MODE = 1) if power of mowmotor exceeds e.g 70% of MOWPOWERMAX, keepslow is triggered
#define MOW_RPMtr_STALL 60 // (70)(%, only used if ESCAPE_LAWN_MODE = 2) if RPM of mowmotor stalls under % of MOW_RPM_NORMAL mower will back up with ESCAPELAWNDISTANCE and ESCAPELAWNSPEED and try again
#define MOW_RPMtr_SLOW 80 // (85)(%, only used if ESCAPE_LAWN_MODE = 2) if RPM of mowmotor stalls under % of MOW_RPM_NORMAL mower will trigger a keepSlow state with KEEPSLOWSPEED
#define ESCAPELAWNSPEED 0.35 // (m/s) speed of mower reverse due to MOW_RPM_STALL trigger
#define ESCAPELAWNDISTANCE 0.5 // (m) distance mower reverses with ESCAPELAWNSPEED due to MOW_RPM_STALL triggered
#define ESCAPELAWNWAITTIME 5000 // (ms)after reversing the second time within ESCAPELAWNTIMER, mower will wait for this time before continue (recover rpm)
#define ESCAPELAWNTIMER 20000 // (ms)timer to reset retries of ESCAPELAWN, if time is met and retries stay under MAXRETRY triggercounter will reset, otherwise there will be an obstacle error
#define ESCAPELAWN_DEADTIME 3000 // (ms)deadtime between allowed ESCAPELAWN triggers (deadtime should be the reverse time of action and be calculated in code :| )
#define MAXRETRY 5 // number of possible retries of ESCAPELAWN within ESCAPELAWNTIMER until there will be an obstacle error or obstacle avoidance
#define MAXRETRYOBSTACLE false // if true, ESCAPELAWN will trigger Obstacle avoidance when to many MAXRETRY´s and will not trigger an error
#define RETRYSLOWSPEED 0.15 // (ms) if ESCAPELAWN true, mower will back up with ESCAPELAWNSPEED if RPM stall is detected and retry mowing forward with RETRYSPEED until RETRYSLOWTIME is met, then it will continue with normal Speed
#define KEEPSLOWSPEED 0.25 // mower will use this speed if there is a rpm stall (%) of mowingblades defined by MOW_RPMtr_SLOW
#define RETRYSLOWTIME 15000 // (ms) mower will continue slow with RETRY_SLOW_SPEED after ESCAPELAWN operation (reversing triggered by MOW_RPMtr_RETRY (%)) for RETRYSLOWTIME, if a MOW_RPMtr_SLOW will happen again in this retryslowstate, mower resets this timer until no rpm stall occurs in set time
#define KEEPSLOWTIME 15000 // (ms) mower will continue slow with KEEP_SLOW_SPEED for given Time if MOW_RPMtr_SLOW (%) was met... if a MOW_RPMtr_SLOW will happen again during keepslowstate, mower resets this timer until no rpm stall occurs in set time.
//stanley options for experiments
#define MAP_STANLEY_CONTROL true // if true, stanley values will be mapped linear from MOTOR_MIN_SPEED-->MOTOR_MAX_SPEED with SC_P_*|SC_K_* to actual speedset of mower (recommended if you use high operation speeds)
#define STANLEYNORMALMUL false // if true, StanleyNormal parameters in Sunray-App will be multiplied by 10! (0,1 = 1) (for testing)
//svol0s GPS reboot option after undocking-->mowing
#define GPS_REBOOT true // if false and DOCK_POINT_GPS_REBOOT is not 0, mower will wait at the DOCK_POINT_GPS_REBOOT point for fix without rebooting GPS, if false and DOCK_POINT_GPS_REBOOT = 0 this function is off (hopefully)
#define GPSWAITREBOOT 15000 // (ms) time to wait after rebooting gps for response from ublox?
#define GPS_STABLETIME 30000 // (ms) GPS Time with fix solution, before continueing from DOCK_POINT_GPS_REBOOT after undock
#define DOCK_POINT_GPS_REBOOT 3 // (pt)(MrTree: Warning, you need 3 more dockpoints than this number, or there will be bugs! so, if there is 4 defined, you need 7 on the Map!) Svol0: dockingpoint number (counted from last dockingpoint) where the gps will be rebooted and waited for gps-fix by undocking. 0 = no gps reboot by undocking. MrTree: if not "0" and GPS_REBOOT = false, mower will wait at the point for fix without rebooting GPS
#define DOCK_SLOW_ONLY_LAST_POINTS 4 // (pt) Svol0: dockingpoint number (counted from last dockingpoint) where slow speed will be used to reach the dockingstation (0 = all points will be reached with slow speed)
//keep mower from rotating in dock by all means, needs situation dependent tuning, so be aware!
#define DOCK_NO_ROTATION true // if true, rotation for the mower when reaching or leaving the last dockpoint is not allowed! Make sure mower comes just before the dock in a straight line from the point before, then the last point is the dockposition, on that path angular steering is not allowed!
#define DOCK_NO_ROTATION_DISTANCE 1.2 // (m) distance to dockpoint to stop angular motion of mower, make sure mower comes straight to dock and the point distance from dockpoint to pointbefore is double this number!
#define DOCK_NO_ROTATION_TIMER 12000 // (ms) if mower doesnt hit the charger in given time after passing dockpoint before last dockpoint(charger), an obstacle will be triggered and mower will reverse to gps reboot point and try again.
#define DOCK_NO_ROTATION_SPEED 0.15 // (m/s) (original it was 0.10, made it changeable...) when angular is not allowed while going to dockposition, this speed is used
//GPS
#define GPS_RESET_WAIT_FIX true // reset GPS if mower is in a float timeout?
#define GPS_RESET_WAIT_FIX_TIME 15 // (min) time in minutes to reset gps if mower is in a float timeout without getting fix within GPS_RESET_WAIT_FIX_TIME
#define GPS_NO_SPEED_TIME 2000 // (ms) time for GPS no speed trigger --> obstacle
//other
#define MOW_START_AT_WAYMOW true // mowmotor only starts if way state of mower is waymow for the first time, used for mowmotor not starting directly at dock, but at mow area. This is a onetime trigger that only works when mower is ---> undocking ---> wayfree ---> mowarea ---> start mowmotor. After this, mowmotor will behave like it used to be
//obstacle behaviour when OBSTACLE_ROTATION is enabled and escapeForward is triggered due to IMUYaw difference (wheel at backside, popo situation)
#define CHANGE_OBSTACLE_ROTATION true // if true, after 2 times moving forward due to an IMUyaw difference or OVERLOAD_ROTATION with escapeForward because of FREEWHEEL_IS_AT_BACKSIDE, escapeReverse with obstacle is triggered (prevent mower going forward if it can´t rotate and already tried to evade with escapeForward op)
#define OVERLOAD_ROTATION true // this function is dependent of FREEWHEEL_IS_AT_BACKSIDE and is usefull if there is alot of grip of wheels which lead to a high current and can result in a motor error overcurrent, before that happens... we want an evasion of the situation. If FREEWHEEL_IS_AT_BACKSIDE is true mower will drive forward on MOTOROVERLOAD if mower state is shouldrotate... otherwise it will trigger an Obstacle and escapeReverse (front snout of mower is hitting something during rotation)
//try to fix 8308 driver with pwm (keep FALSE if you have no issues or no DRV8308, this is for experiments only) ---> to be removed
#define DRV8308_FIX false // only for testing, if true and charger is connected, drivers pwm will be 1 for DRVFIXITERATIONS iteration of code everytime DRVFIXTIMER is met
#define DRVFIXITERATIONS 5 // iterations of code for pwm of drivers to be PWM_GEAR and PWM_MOW (below)
#define DRVFIXTIMER 60000 // (ms) timer for DRV8308_FIX, everytime timer is met, function will run once for DRVFIXITERATIONS and set pwm of drivers to 1
#define PWM_GEAR 1 // PWM for DRVFIX efforts..
#define PWM_MOW 1 // PWM for DRVFIX efforts..
//try to fix 8308 driver with moving, only works reliable with "DOCK_RETRY_TOUCH = true"! tested and seems to be a valid workaround for the DRV8308 related dock stuck issue (keep FALSE if you have no issues or no DRV8308)
#define MOVE_REGULARLY true // if true, mower will move in dock in given MOVE_AGAIN_AFTER time, kk: move mower to keep 8308 alive
#define MOVE_AGAIN_AFTER 10.0 // kk: move the mower every xx minutes
#define MOVING_TIME 400 // kk: time (ms) for moving back
#define SWITCH_OFF_TRACTION_MOTORS true // should tractionmotors be disabled in dock?
//LOG
#define OUTPUT_ENABLED false // output standard Sunray_FW LOG in serial monitor and SDlog
#define CALC_LOOPTIME false // calc and output the sunray loop time in serial monitor and SDlog
#define TUNING_LOG true // outputs valuable var-states of sunray for debugging tuning functions or just for observation and insights
#define TUNING_LOG_TIME 5000 // (ms) periodic output time of TUNING_LOG
#define DEBUG_LOG true // adds output informations on changed mower states, functions and operations
//Modsection END
\#define FREEWHEEL_IS_AT_BACKSIDE true // default Ardumower: true (change to false, if your freewheel is at frontside) - this is used for obstacle avoidance
#define WHEEL_BASE_CM 36 // wheel-to-wheel distance (cm)
#define WHEEL_DIAMETER 250 // (250) wheel diameter (mm)
#define MOWER_SIZE 60 // mower / chassis size / length in cm
#define ENABLE_ODOMETRY_ERROR_DETECTION true // use this to detect odometry erros
//#define ENABLE_ODOMETRY_ERROR_DETECTION false
// choose ticks per wheel revolution :
#define TICKS_PER_REVOLUTION 696 /2 // odometry ticks per wheel revolution
// ...for the older 42mm diameter motor (white connector) https://wiki.ardumower.de/images/d/d6/Ardumower_chassis_inside_ready.jpg
#define MOTOR_MOW_TICKS_PER_REVOLUTION 12 /2 //ACT BLDC MOTOR from Shop = 6! (DRV8308/JYQD)
// ----- gear motors --------------------------------------------------
// for brushless motors, study the sections (drivers, adapter, protection etc.) in the Wiki (https://wiki.ardumower.de/index.php?title=DIY_Brushless_Driver_Board)
// #define MOTOR_DRIVER_BRUSHLESS 1 // uncomment this for new brushless motor drivers
//#define MOTOR_DRIVER_BRUSHLESS_MOW_DRV8308 1 // uncomment for brushless DRV8308 driver and mowing motor
//#define MOTOR_DRIVER_BRUSHLESS_MOW_A4931 1 // uncomment for brushless A3931 driver and mowing motor
//#define MOTOR_DRIVER_BRUSHLESS_MOW_BLDC8015A 1 // uncomment for brushless BLDC8015A driver and mowing motor
// #define MOTOR_DRIVER_BRUSHLESS_MOW_JYQD 1 // uncomment for brushless JYQD driver and mowing motor (https://forum.ardumower.de/threads/jyqd-treiber-und-sunray.24811/)
//#define MOTOR_DRIVER_BRUSHLESS_MOW_OWL 1 // uncomment for brushless owlDrive mowing motor
// #define MOTOR_DRIVER_BRUSHLESS_GEARS_DRV8308 1 // uncomment for brushless DRV8308 driver and gear/traction motors
//#define MOTOR_DRIVER_BRUSHLESS_GEARS_A4931 1 // uncomment for brushless A4931 driver and gear/traction motors
//#define MOTOR_DRIVER_BRUSHLESS_GEARS_BLDC8015A 1 // uncomment for brushless BLDC8015A driver and gear/traction motors
//#define MOTOR_DRIVER_BRUSHLESS_GEARS_JYQD 1 // uncomment for brushless JYQD driver and gears/traction motor
//#define MOTOR_DRIVER_BRUSHLESS_GEARS_OWL 1 // uncomment for brushless owlDrive gears/traction motor
#define MOTOR_FAULT_CURRENT 6.0 // gear motors fault current (amps)
#define MOTOR_TOO_LOW_CURRENT 0.005 // gear motor too low current (amps)
#define MOTOR_OVERLOAD_CURRENT 0.8 // gear motors overload current (amps)
#define USE_LINEAR_SPEED_RAMP true // use a speed ramp for the linear speed //MrTree overshooting is reduced, deceleration is more agressive: keep enabled! (recommended)
//#define USE_LINEAR_SPEED_RAMP false // do not use a speed ramp
// motor speed control (PID coefficients) - these values are tuned for Ardumower motors
// general information about PID controllers: https://wiki.ardumower.de/index.php?title=PID_control
#define MOTOR_PID_LP 0.0 // encoder low-pass filter (use for low encoder tickcount - use zero to disable)
#define MOTOR_PID_KP 2.0 // do not change 2.0 (for non-Ardumower motors or if the motor speed control is too fast you may try: KP=1.0, KI=0, KD=0)
#define MOTOR_PID_KI 0.03 // do not change 0.03
#define MOTOR_PID_KD 0.03 // do not change 0.03
#define MOTOR_PID_LIMIT 255 // output limit - do not change 255
#define MOTOR_PID_RAMP 0 // output derivative limit - do not change 0
//#define MOTOR_LEFT_SWAP_DIRECTION 1 // uncomment to swap left motor direction
//#define MOTOR_RIGHT_SWAP_DIRECTION 1 // uncomment to swap right motor direction

// ----- mowing motor -------------------------------------------------

#define ENABLE_MOW_MOTOR true // Default is true, set false for testing purpose to switch off mow motor permanently
#define MOW_FAULT_CURRENT 8 // mowing motor fault current (amps)
#define MOW_TOO_LOW_CURRENT 0.005 // mowing motor too low current (amps)
#define MOW_OVERLOAD_CURRENT 3.5 // mowing motor overload current (amps)
// should the direction of mowing motor toggle each start? (yes: true, no: false)
#define MOW_TOGGLE_DIR true
//#define MOW_TOGGLE_DIR false
// should the error on motor overload detection be enabled?
#define ENABLE_OVERLOAD_DETECTION true // robot will stop on overload
//#define ENABLE_OVERLOAD_DETECTION false // robot will slow down on overload
// should the motor fault (error) detection be enabled?
#define ENABLE_FAULT_DETECTION true
//#define ENABLE_FAULT_DETECTION false // use this if you keep getting 'motor error'
#define ENABLE_RPM_FAULT_DETECTION false // use mow rpm signal to detect a motor fault (requires mowing motor with rpm output!)
//#define ENABLE_RPM_FAULT_DETECTION false // do not use mow rpm signal to detect a motor fault
// should the robot trigger obstacle avoidance on motor errors if motor recovery failed?
#define ENABLE_FAULT_OBSTACLE_AVOIDANCE true
// ------ GPS ------------------------------------------
// ------- RTK GPS module -----------------------------------


#define REQUIRE_VALID_GPS true // mower will pause if no float and no fix GPS solution during mowing (recommended)
//#define REQUIRE_VALID_GPS false // mower will continue to mow if no float or no fix solution (not recommended)
#define GPS_SPEED_DETECTION true // will detect obstacles via GPS feedback (no speed) - recommended
//#define GPS_SPEED_DETECTION false
// detect if robot is actually moving (obstacle detection via GPS feedback)
#define GPS_MOTION_DETECTION true // if robot is not moving trigger obstacle avoidance (recommended)
//#define GPS_MOTION_DETECTION false // ignore if robot is not moving
#define GPS_MOTION_DETECTION_TIMEOUT 3 // (5) timeout for motion (secs)
#define GPS_MOTION_DETECTION_DELTA 0.10 // (0.20) distance mower must be moving in timeouttime until gps no motion is triggered
// configure ublox f9p with optimal settings (will be stored in f9p RAM only)
// NOTE: due to a PCB1.3 bug GPS_RX pin is not working and you have to fix this by a wire:
// https://wiki.ardumower.de/index.php?title=Ardumower_Sunray#PCB1.3_GPS_pin_fix_and_wire_fix (see 'GPS wire fix')
#define GPS_REBOOT_RECOVERY true // allow GPS receiver rebooting (recommended - requires GPS wire fix above! otherwise firmware will stuck at boot!)
//#define GPS_REBOOT_RECOVERY false // do not allow rebooting GPS receiver (no GPS wire fix required)
#define GPS_CONFIG true // configure GPS receiver (recommended - requires GPS wire fix above! otherwise firmware will stuck at boot!)
//#define GPS_CONFIG false // do not configure GPS receiver (no GPS wire fix required)
#define GPS_CONFIG_FILTER true // use signal strength filter? (recommended to get rid of 'FIX jumps') - adjust filter settings below
//#define GPS_CONFIG_FILTER false // use this if you have difficulties to get a FIX solution (uses ublox default filter settings)
#define CPG_CONFIG_FILTER_MINELEV 3 // Min SV elevation degree: 14 (high elevation, less robust), 10 (low elevation, robust)
#define CPG_CONFIG_FILTER_NCNOTHRS 8 // C/N0 Threshold #SVs: 10 (robust), 6 (less robust)
#define CPG_CONFIG_FILTER_CNOTHRS 17 // 30 dbHz (robust), 13 dbHz (less robust)
#define CPG_CONFIG_FILTER_MINCNO 10 // min satelite signal strenght for observing?

// ------ obstacle detection and avoidance -------------------------
#define ENABLE_PATH_FINDER true // path finder calculates routes around exclusions and obstacles
//#define ENABLE_PATH_FINDER false
#define ALLOW_ROUTE_OUTSIDE_PERI_METER 1.0 // max. distance (m) to allow routing from outside perimeter
// (increase if you get 'no map route' errors near perimeter)
#define OBSTACLE_DETECTION_ROTATION true // detect robot rotation stuck (requires IMU)
//#define OBSTACLE_DETECTION_ROTATION false // NOTE: recommended to turn this off for slope environment
#define ROTATION_TIMEOUT 5000 //15000 Timeout of rotation movement that triggers an obstacle with escapeReverse
#define ROTATION_TIME 1000 //3000 Time the code expects to rotate without a IMU yaw difference
---
// is a docking station available?
#define DOCKING_STATION true // use this if docking station available and mower should dock automatically
//#define DOCKING_STATION false // mower will just stop after mowing instead of docking automatically
//#define DOCK_IGNORE_GPS false // use GPS fix in docking station and IMU for GPS float/invalid
#define DOCK_IGNORE_GPS true // ignore GPS fix in docking station and use IMU-only (use this if robot gets false GPS fixes in your docking station)
//#define DOCK_AUTO_START true // robot will automatically continue mowing after docked automatically
#define DOCK_AUTO_START false // robot will not automatically continue mowing after docked automatically
#define DOCK_RETRY_TOUCH true // robot will retry touching docking contacts (max. 1cm) if loosing docking contacts during charging
//#define DOCK_RETRY_TOUCH false // robot will not retry touching docking contacts (max. 1cm) if loosing docking contacts during charging
#define DOCK_UNDOCK_TRACKSLOW_DISTANCE 1.5 // set distance (m) from dock for trackslow (speed limit)
#define UNDOCK_IGNORE_GPS_DISTANCE 1.2 // set distance (m) from dock to ignore gps while undocking
// ---- path tracking -----------------------------------
// below this robot-to-target distance (m) a target is considered as reached
#define TARGET_REACHED_TOLERANCE 0.03
// stanley control for path tracking - determines gain how fast to correct for lateral path errors
#define STANLEY_CONTROL_P_NORMAL 3.4 // 3.0 for path tracking control (angular gain) when mowing
#define STANLEY_CONTROL_K_NORMAL 2.3 // 1.0 for path tracking control (lateral gain) when mowing
#define STANLEY_CONTROL_P_SLOW 1.0 // 3.0 for path tracking control (angular gain) when docking tracking
#define STANLEY_CONTROL_K_SLOW 0.05 // 0.1 for path tracking control (lateral gain) when mowing or docking
 
I'll test your config, possibly there should be something off but it's not. Until then you could yourself look at debug and tuning log = true. This way we know if it's adaptive speed, which should be off, that makes it go slow.

There are 2 things i see, you set motor overload from the gears very low. In this FW the lowpass filter is shorter than in original, please try larger values there.
The other thing: you have a typo at \#define FREE_WHEEL_IS_AT_BACKSIDE

Another thing, if you say its moving slow even when manually controlled --> the interrupt reading of ticks is different, its a version from bernard. Try deleting the devider at TICKS_PER_REVOLUTION "/2"

You could also to validate there is or is not an issue with ticks: run the motor test and odometrie setup described in the wiki

For me, i equalized the actual gps speed with mower speed. i realized the ticks/rpm where 10% too low, giving a gpsspeed of 34cm/s when it should do 40cm/s.
That is possible with the tuninglog, let it run long lanes with fix at all times, mow doesnt need to be enabled. Then take a look in the log for the actual gpsspeed, it´s easier if you have OTA console output. But works with sdlogging too.
 
Zuletzt bearbeitet:
Thanks!

Clearly very slow - I had also figured out in parallel the ticks were the issue for the slow speed :). It was indeed the factor 2.
Increasing the current of the wheelmotors seems to make the robot operational again for mowing ! Rotations seem to behave much smoother than before.
I've tried a few times to undock now, this seems to be reliable 🥳

Remaining items:
  • the robot wiggles much more around its lane now / tracks less accurately the path and points. As a consequence it constantly bounces against my borders and bushes.
  • for some weird reason cassandra suddenly reported the robot as docked while it was mowing / doing some maneuvres against a border ... . I need to figure out if I can reproduce this.
thanks a lot for all the development and support.
 
Because you have other odometrie and motors, change the Stanley normal parameters. Try 2/3 of actual parameters.
 
If it's running then, test adaptive speed in power mode. Possibly the power triggers need to be adjusted to your mow motor hardware. Because you don't have the drv8103, disable move regularly also.

To find good values for Stanley, you can also let the mower drive lanes with 49 cm/s or maybe 40cm/s. Lateral value kicks in when angle is ok, but mower has parallel offset to lane. That's most likely the cause of going from side to side, the value is too high. Find the sweet spot. I'm not sure, but I think you can alter the Stanley parameters OTA still with this fw over the orig sunray mobile app. Start with reducing the normal vals by .1 step-by-step and observe

If this is successfull, please let me know the parameters so I can comment it as brushed parameters in the config.h
 
Zuletzt bearbeitet:
If it's running then, test adaptive speed in power mode. Possibly the power triggers need to be adjusted to your mow motor hardware. Because you don't have the drv8103, disable move regularly also.

To find good values for Stanley, you can also let the mower drive lanes with 49 cm/s or maybe 40cm/s. Lateral value kicks in when angle is ok, but mower has parallel offset to lane. That's most likely the cause of going from side to side, the value is too high. Find the sweet spot. I'm not sure, but I think you can alter the Stanley parameters OTA still with this fw over the orig sunray mobile app. Start with reducing the normal vals by .1 step-by-step and observe

If this is successfull, please let me know the parameters so I can comment it as brushed parameters in the config.h
okido, I should be able to experiment a little bit over the weekend. Will let you know if I make progress
 
Das wäre eine schöne Sache, aber insgesamt schwierig umzusetzen. Es hat ja jeder bestimmte Vorstellungen. Allerdings sollten verschiedene Verbesserungen relativ robust funktionieren, man müsste vllt nur diese einpflegen. Bei mir zb ist ziemlich viel mitten in den Code geworfen, es sollten aber immer Funktionen sein. Damit habe ich vor kurzem angefangen. Alles entheddern und in Funktionen packen. Aber man könnte ja einfach wie du sagst einen fork imitieren und denjenigen, die sich hier melden eine Berechtigung zum pushen geben... Geht das überhaupt? Mal sehen was dann dabei herauskommt. Ich glaube, wenn nur einer ein Auge auf alles haben muss wird das nichts, da es zu viel Arbeit ist.
 
okido, I should be able to experiment a little bit over the weekend. Will let you know if I make progress
I haven't made it to adaptive speed tuning yet since I don't get the docking aspect fully calibrated yet. But I'm keeping my settings (and some of my own changes) on a fork of your github repo :).

It approaches the docking point but, for reasons I don't seem to understand yet, returns backwards before hitting the contacts.
Then sometimes after going back and forth a few times, it does seem to drive far enough to hit the contacts (which is already a significant improvement :p).
  • First I thought the sonars detected something (it's approaching a wall in the end) but I have disabled them. This didn't seem to contribute.
  • I've played with increasing the DOCK_NO_ROTATION_TIMER significantly. But this didn't seem to be the cause either.
I believe the amount of points on the map (6) are in compliance with the comment about the minimum amount of points needed.
#define DOCK_POINT_GPS_REBOOT 2
#define DOCK_SLOW_ONLY_LAST_POINTS 4
#define DOCK_NO_ROTATION true
#define DOCK_NO_ROTATION_DISTANCE 1.2
#define DOCK_NO_ROTATION_TIMER 45000
#define DOCK_NO_ROTATION_SPEED 0.05
//GPS

1720464719740.png
 
Zuletzt bearbeitet:
Possibly, just try to move you dockpoint in a straight way further beyond your actual dockpoint? My dockpoint is a straight line but the dock position it thinks it has to go is half a meter further than the charger contacts, because you never know if it thinks it reached the dockpoint because the jumping GPS position is a point cloud around the mower and will eventually be near the point reached value of 7cm, Imagin this position of mower is updated every Iteration of code, so that's a lot of points. That's why it was freaking out before when trying to reach the dock.

A general thing to make this work, despite your issue:
The mower needs to be tracking the line nicely before angular will get clamped to zero, so the angle is good. This means that you need well tuned Stanley parameters too! GPS should be stable of course too. I think with some broad charger contacts with a lot of tolerance, this function works up to 2 - 3 meters going blind.

1000032607.png
 
Zuletzt bearbeitet:
I fixed this by ignoring gps when getting close to the dock station, the mower can still make angular adjustments and position is estimated with imu+odometry.
Having a nice straight line going into the dock station definitely helps.
 
Das wäre eine schöne Sache, aber insgesamt schwierig umzusetzen. Es hat ja jeder bestimmte Vorstellungen. Allerdings sollten verschiedene Verbesserungen relativ robust funktionieren, man müsste vllt nur diese einpflegen. Bei mir zb ist ziemlich viel mitten in den Code geworfen, es sollten aber immer Funktionen sein. Damit habe ich vor kurzem angefangen. Alles entheddern und in Funktionen packen. Aber man könnte ja einfach wie du sagst einen fork imitieren und denjenigen, die sich hier melden eine Berechtigung zum pushen geben... Geht das überhaupt? Mal sehen was dann dabei herauskommt. Ich glaube, wenn nur einer ein Auge auf alles haben muss wird das nichts, da es zu viel Arbeit ist.
ja da bin ich bei Dir, das ist sich nicht einfach und es müssten sich halt auch einige zusammenschließen um das zu ermöglichen.
Leider bin ich auch nur ein Laie was Github betrifft und habe damit noch nicht viel gemacht und die Möglichkeiten dort sind sicherlich ernorm wenn man sich damit auskennt.
Mir blutet nur immer das Herz wenn man die ganzen Pullrequests oder offenen Fehler (wobei einige sicherlich auch noch alte Leichen sind) im Sunray Github sieht, dazu noch die ganzen Features die immer wieder hier im Forum genannt werden die einige sich eingebaut haben oder dies und jenes so gelöst haben und schlussendlich noch die Forks z.B. von Dir oder WhatATest und natürlich auch von anderen die man gerne ausprobieren möchte.
Auch für die MQTT oder API Fraktion die sich sicherlich noch Erweiterungen vorstellen können, ist halt einfach schade dass es so dermaßen verstreut ist und das Wissen und Kenntnisse von hier einigen dadurch untergeht und die Software aus meiner Sicht enorm weiterbringen würde. Gerade auch durch Cassandra hat doch der Ardumower enorm an Komfort gewonnen und ist so alltagstauglicher geworden.
sorry ich weiß ich drehe mich im Kreis
 
Not sure , but it's possible that in dock recording when mower detect charging contact the location is update to map registering and a distance is add behind station to have a perfect docking contact.
So what's append when editing a docking trajectory, maybe it's better to uplug it when record docking process.
 
Oben