Avoidance Experiments with the POC and Benewake TFMINI

Hi Mister Poirier,
Thank you for sharing your POC . I have a general question for you. Before to assembly the hardware necessary I tried to use SITL with an Arduino to emulate the proximity sensor . Simply Arduino send the mavlink message for distance sensor to SITL through the serial. When I use loiter mode work fine, but in althold or guided mode the avoidance control don’t work. Wiki explain that avoidance control it’s possible in althold, loiter and guided mode. Does it possible to simulate the behaviour in SITL ? Did you perform some test in guided mode ?

Hello, I don’t think having tested in guided. Incidentally I am revisiting the avoidance library theses days with a new setup, and I will try this mode and report back

Oh thank for your answer I will stay tuned!

Hey Patrick
IS there a document on how to actually build this thing. Would love to give it a try.

The POC ?

Well the blog is pretty self explain it all…

Hi Patrick hope you and your family are well and a very merry xmas to you all,like Ricky g I would love to do this im woundering if you could maybe do a laymans /idots guide on how to implement this and thank you for all your hard work,ile buy new benewakes with I2C if that makes things easier

4 Likes

I know that the VL53L0X has a too small range to be useful, but what about the VL53L1X?
Because it would bring the cost down significantly…
Are 3 meters enough for a useful obstacle avoidance?

Yes for indoor only it would work.

Dear Patrick,
I´m pretty impressed of your TFMini POC ! So I tried to (re)build it according to your instructions. I got 5 TFMini (one facing downwards) and attached them each to a Attiny85, flashing those worked after some troubleshooting, so most of the hardware is set up and ready. But I can´t get the ProMini to work, compiling the ino-file in Arduino 1.8.9 is always stopped by error message that “mavlink_msg_distance_sensor.h” was not found. I used several mavlink libraries from github, but none of them works.
So, I´m stuck here. Any idea what I´m doing wrong?

Cool,

You need to build this header file from a recent copy of MavLink using the python script in order all the new messages and modifications.
Refer to this excellent blog for detailed instructions:

Please note that mavlink site has moved here: Introduction · MAVLink Developer Guide

Ok, I was able to generate a new library with mavlink generator. I used regarding to the mentioned instructions c as language and ardupilotmega as xml-file. I copied the folder as “mavlink” into the library folder of Arduino IDE. mavlink is shown as library in Arduino IDE, but compiling still hangs up with the error message “mavlink.h not found”. Indeed there is no mavlink.h in the root directory. There are serveral mavlink.h files in the subfolders named ardupilotmega, common and others. The distance-sensor-header file is located in commons.
So, what do I need to add? Copying those files in mavlink root folder doesn´t work, including mavlink library into the ino-file adds following header files to the code, but with no effort:
#include <checksum.h>
#include <mavlink_conversions.h>
#include <mavlink_helpers.h>
#include <mavlink_types.h>
#include <protocol.h>

Thanks for help in advance!

To make things simpler I added my mavlink library == look at the last line of the blog
Enjoy !!

1 Like

Copied your library and it compiled instantly like a charm! Many thanks to you and your efforts!

2 Likes

Yesterday I tried playing a bit with Mavlink messages but I couldn’t get it to work, so I decided to give the code on Github a try but also that I wasn’t able to run…
I’ve tried different baudrates and swapping RX and TX cables but nothing solved the problem.
I’ve used an arduino mega and since I don’t have the attiny etc. I just placed constant values for distance…

Any idea what I could be doing wrong?
Thanks in advance

Hello Mister Poirier,

I am very interested in your project about avoidance. I have tried to implement it on my pixhawk with the code that you specified about using arduino. But the results of the radar in the mission planner did not show any changes. I am very confused about anything from mavlink from Arduino to Pixhawk to nothing. Yet when I use raspberrie for communication with Pixhawk, it can happen well. I don’t know where is my fault, can you help me solve my problem?

This code runs on an Arduino only.
You have to validate that the systems is sending MavLink messages using the Mavlink inspector tool (CTRL-F on Mission Planner)

I’ve tried the mavlink inspector, and the results are still not there. I just copied pasted yout code on Github, nothing I changed. i use radiolink pixhawk 2.7 and it runs on arducopter 3.6. Does the type of pixhawk and software also affect?

Btw, my arduino is promini 5v, we know pixhawk have level power 3.3v,
does it matter?

You have to confirm the code is working ok on promini : you must have data going out at the serial port, you should see MavLink binary message output on Arduino monitor

I’ve tried to see the serial output from Promini in serial monitor. but I can’t read it because it only shows binner code in the form of boxes and occasional question marks