Arlo + BOE Control System Adjustments

Arlo + BOE Control System Adjustments

Integration and deadzone comprise a group of values that may need to be tuned to accommodate certain payload weights, and gearbox play.  The three integration constants (KI, KIT, and KIP) affect how rapidly the Arlo can make final adjustments in its destination.  The deadzone (DZ) value specifies allowable error.  This example program is actually setting the default values, but you can change them, and then test the responses under the conditions you need the Arlo to perform.  

If your battery is charged, and the payload is small, the default settings should be fine.  If payloads increase and decrease during runtime, you may wish to programmatically adjust those constants, either to give it some extra push to get to each final goal, or to apply less push toward the final goal to prevent oscillations (repeated over corrections).  For more information, see the DHB-10 command set for information on KI, KIT, KIP, and DZ.  

Code for making the changes semi-permanent by writing them to the DHB-10’s EEPROM have been commented out.  As long as you keep the lines with STORE commented, the changes only affect performance until the DHB-10 is restarted.  You can restart the DHB-10 by pressing and releasing its Reset button or turning the Motors power off, and then back on.

  • No need to run this program unless you want to observe different possible Arlo behaviours as it approaches its final distance destination.
' Arlo - Tune Integral Constants

' Set control system constants that give the extra push to get to the
' final position and control the allowable positional error.

' {$STAMP BS2}
' {$PBASIC 2.5}

n VAR Byte                                   ' Serial message index

FREQOUT 4, 2000, 3000                        ' Signal program start/reset
DEBUG "Program Running!", CR

' Integral constant, value multiplied by accumulated positional error
' to give wheels that extra push to get to the goal.
n = n + 1                                    ' Increment serial COM index
DEBUG "KI 65", CR                            ' Display integral constant
SEROUT 13, 32800, ["KI 65", CR]              ' Set integral constant
SERIN  13, 32800, 50, ERR, [WAIT(CR)]        ' Wait for DHB-10 confirmation

' Time decay causes older integral measurements to weigh less than newer
' ones.  100 is no decay.  85 takes 85% of the previous measurement, 60%
' of the one before that, etc.
n = n + 1                                    ' Increment serial COM index
DEBUG "KIT 65", CR                           ' Display integral time decay
SEROUT 13, 32800, ["KIT 65", CR]             ' Set integral time decay
SERIN  13, 32800, 50, ERR, [WAIT(CR)]        ' Wait for DHB-10 confirmation

' Smaller values increase the allowed integral contribution to motor power
' at lower speeds.
n = n + 1                                    ' Increment serial COM index
DEBUG "KIP 512", CR                          ' Display integral power ratio
SEROUT 13, 32800, ["KIP 512", CR]            ' Set integral power ratio
SERIN  13, 32800, 50, ERR, [WAIT(CR)]        ' Wait for DHB-10 confirmation

' Max deadzone (positional error) = +/- 1.  Typically set greater than or equal
' to the slack in the wheels.  If you can wiggle the wheel and see a deviation
' of +/- 1, then make deadzone 1.  Deadzone errors do not propagate, so the
' next position goal will start from the previous target value, not the
' previous measured value.
n = n + 1                                    ' Increment serial COM index
DEBUG "DZ 1", CR                             ' Display deadzone
SEROUT 13, 32800, ["DZ 1", CR]               ' Set deadzone
SERIN  13, 32800, 50, ERR, [WAIT(CR)]        ' Wait for DHB-10 confirmation

' Un-comment these lines to make the new settings the ones that get loaded
' when the DHB-10 is reset or turned off and back on.
'n = n + 1                                    ' Increment serial COM index
'DEBUG "STORE KI", CR                         ' Display storing new KI
'SEROUT 13, 32800, ["STORE KI", CR]           ' Remember new KI
'SERIN  13, 32800, 50, ERR, [WAIT(CR)]        ' Wait for DHB-10 confirmation

'n = n + 1                                    ' Increment serial COM index
'DEBUG "STORE KIT", CR                        ' Display storing new KIT
'SEROUT 13, 32800, ["STORE KIT", CR]          ' Remember new KIT
'SERIN  13, 32800, 50, ERR, [WAIT(CR)]        ' Wait for DHB-10 confirmation

'n = n + 1                                    ' Increment serial COM index
'DEBUG "STORE KIP", CR                        ' Display storing new KIP
'SEROUT 13, 32800, ["STORE KIP", CR]          ' Remember new KIP
'SERIN  13, 32800, 50, ERR, [WAIT(CR)]        ' Wait for DHB-10 confirmation

'n = n + 1                                    ' Increment serial COM index
'DEBUG "STORE DZ", CR                         ' Display storing new DZ
'SEROUT 13, 32800, ["STORE DZ", CR]           ' Remember new DZ
'SERIN  13, 32800, 50, ERR, [WAIT(CR)]        ' Wait for DHB-10 confirmation

DEBUG "Done!"                                 ' Display program done

END                                           ' End program

ERR:                                          ' Error routine
  DEBUG "ERROR, no reply from DHB-10.", CR    ' Error message
  DEBUG "n = ", DEC n                         ' Display which message failed
  END                                         ' End program