Ahhh… Winter in Canada …
While the kids play hockey outside with sticks and a puck , I play inside with sticks and a POC !!
A few month ago I started experimenting with the Avoidance Library:
http://ardupilot.org/dev/docs/code-overview-object-avoidance.html
And I designed The POC : Proximity Obstacle Collision avoidance system based on an Arduino Pro Mini and VL50LX0 TOF rangefinders. This unit works pretty well, the only drawback is that it is shortsighted. This inexpensive Laser device is limited to a range of 1,7 Meter and it makes it hard to implement a fully functional Avoidance System.
Then came the Benewake TFMINI RangeFinder, that offers indoor range up to 12 Meter (6M Outdoor) for a price that makes the POC concept a reality. Some of you might have seen a previous Blog explaining how to make this RangeFinder talk I2C with the use of an Arduino:
Configuration of the TFMINI-POC:
The actual prototype is using 4 TFMINI
One looking UP
3 Looking @ -45 Forward + 45
TFMINI are Serial devices and its quite difficult to multiplex serial without buffering.
I did some test with a Teensy 3.5 that offers 6 serial ports, but without handshake (hardware or software) its is quite difficult to have a stable unit, that can work in a variety of configuration and speeds (baudrate).
This is why I opted to ‘‘transform’’ the TFMINI into a I2C device. With the Use of Attiny85 we can read the serial flow @ 115200 and do all sorts of signal manipulation and store results in registers, ready to be consumed by the I2C bus. The controler is an Arduino Pro Mini that sequentially read the I2C devices and transmits over serial on a MavLink DISTANCE SENSOR message
https://mavlink.io/en/messages/common.html#DISTANCE_SENSOR
ARDUINO CODE
You can download the code here:
To make a system set the I2C address for each ATtiny and you assign the corresponding vector to the I2C Address:
SETTINGS:
On Mission Planner you set Proximity and Avoidance (as per Avoidnce wiki above) and you can set the avoidance enabling using a transmitter switch, I used ch7 = 40 for Object Avoidance.
And this is how it goes in Alt-Hold Mode:
I use the transmitter to ‘‘push’’ the quad against the garage door and the avoidance system makes it ‘‘bounce’’ back. The harder we push , the harder it bounce back… just like a hockey puck…
This is how the different signals look on the Logs:
ArduPilot, you blinded me with science…
I would like to thanks the development team and more specifically Randy Mackay for this excellent library that makes me play like a kid in these cold winter days
To make thing easy , just copy this mavlink file into your Documents/Arduino/libraries
mavlink.zip (623.9 KB)