Home Contents Start Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Next

Mowing Algorithms

Here are the basic ideas behind different mowing algorithms. In an ideal world, the plan is mow in stripes, avoid obstacles and only mow the grass we want to. The idea of using an optical camera and some Machine Learning would be the holy grail, but I need to work out a lot of the lower level details first so I will build on each sensor as they come on-line.

Approach

Each algorithm will be stand-alone and I'll keep them all in the software and switch them on/off remotely using the telemetry link at this stage. They will be named MO1, MO2 etc which is quite boring but that works with my telemetry link. Each algorithm will need to periodically check the telemetry input in case an abort is sent. Note that this is pseudo code, there are more details that have been removed.


MO0 - Mow in timed Stripes

Uses: Compass

The aim here is to use the compass to mow in stripes by calculating reciprocal bearings. The PID control of the locomotion motors should auto-correct deviation and no obstacle detection is undertaken.

void mowStripes0(int numStripes)
while stripeCount > 0:
  mowStraight()				// with PID control
  delay(4000)
  motorsOff()
  endRowTurn(stripeCount)
  delay(1000)  // allow it to start turning in the right direction
  setpoint = calculateReciprocal(setpoint)
  stripeCount--
motorsOff()

No obstacle detection or serial port monitor so when it goes, it goes!


MO1 - Mow in Stripes Using Bump Sensors

Uses: Compass, Bump Sensors

The compass should work as it did in MO0, but rather than timed stripes, we continue until we hit an obstacle before turning.

void mowStripes1(int numStripes)
while stripeCount > 0:
  obstruction = false
  while obstruction == false:
  	mowStraight()					// with PID control
  	delay(100)
  	handleSerialCommands()			// so we can send STP command
  	obstruction = detectBump()		// any bumpSwitch
  
  // obstruction detected by bump sensors	
  motorsOff()
  backupMower(200, 6000)
  motorsOff()
  
  // if we get stuck turning, we should stop. Not done here
  endRowTurn(stripeCount)	// start turning the correct way		
  for i in range(4):
    delay(250);
    handleSerialCommands();			// allows STP

  setpoint = calculateReciprocal(setpoint)
  stripeCount--
  
motorsOff()


MO2 - Mow in Stripes Using Bump Sensor and Central Sonar

Uses: Compass, Bump Sensors, Central Sonar

This is the next step forward. If bumpSensor or sonar detects an obstacle we turn around and do the next stripe. No intelligence reading the sensors yet, it is just an obstacle or no obstacle.

void mowStripes2(int numStripes)
obstruction = 0
while stripeCount > 0:
  obstruction = isObstructed()		// any bumpSwitch or central sonar
  while obstruction == 0:
  	mowStraight()					// with PID control
  	delay(100)
  	handleSerialCommands()			// so we can send STP command
  	obstruction = isObstructed()	// any bumpSwitch or central sonar
  
  // obstruction detected by bump sensors	
  motorsOff()
  backupMower(200, 6000)
  motorsOff()
  
  // if we get stuck turning, we should stop. Not done here
  endRowTurn(stripeCount)	// start turning the correct way		
  for i in range(4):
    delay(250);
    handleSerialCommands();			// allows STP

  setpoint = calculateReciprocal(setpoint)
  stripeCount--
  
motorsOff()



Nov 2018


Home Contents Start Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Next