We do not have an example, but it is fairly easy to make the changes.
First you need to initialise both boards at the top of the script.
# Setup the ThunderBorgs
TB1 = ThunderBorg.ThunderBorg()
TB2 = ThunderBorg.ThunderBorg()
TB1.i2cAddress = 10
TB2.i2cAddress = 11
TB1.Init()
TB2.Init()
if not TB1.foundChip or not TB2.foundChip:
boards = ThunderBorg.ScanForThunderBorg()
if len(boards) == 0:
print 'No ThunderBorg found, check you are attached :)'
else:
print 'ThunderBorg missing at address %02X or %02X, but we did find boards:' % (TB1.i2cAddress, TB2.i2cAddress)
for board in boards:
print ' %02X (%d)' % (board, board)
print 'If you need to change the I²C address change the setup line so it is correct, e.g.'
print 'TB1.i2cAddress = 0x%02X' % (boards[0])
sys.exit()
# Ensure the communications failsafes have been enabled!
failsafe1 = False
failsafe2 = False
for i in range(5):
TB1.SetCommsFailsafe(True)
TB2.SetCommsFailsafe(True)
failsafe1 = TB1.GetCommsFailsafe()
failsafe2 = TB2.GetCommsFailsafe()
if failsafe1 and failsafe2:
break
if not failsafe1:
print 'Board %02X failed to report in failsafe mode!' % (TB1.i2cAddress)
sys.exit()
if not failsafe2:
print 'Board %02X failed to report in failsafe mode!' % (TB2.i2cAddress)
sys.exit()
Make sure the i2cAddress values match what the boards were set to.
Next you will need to change the motor outputs. Assuming the first ThunderBorg is connected to both right side motors and the second to both left side motors change these lines:
piborg
Sun, 02/24/2019 - 12:25
Permalink
Running with two ThunderBorgs
We do not have an example, but it is fairly easy to make the changes.
First you need to initialise both boards at the top of the script.
Make sure the
i2cAddress
values match what the boards were set to.Next you will need to change the motor outputs. Assuming the first ThunderBorg is connected to both right side motors and the second to both left side motors change these lines:
to:
Next change the drive fault check so that it includes all four outputs. Change:
to
Now all that needs to be done is to change all of the remaining calls to
TB
to bothTB1
andTB2
. For example:becomes:
After all the changes the script should behave like it did before, but using two motor outputs per side ^_^
Thieu
Sun, 02/24/2019 - 18:31
Permalink
Thankyou very much, it works
Thankyou very much, it works perfectly