Servers by jDrones

Help with object avoidance

(ppoirier) #31

Just install QgroundControl , its part of the widgets

(Antonio Policicchio) #32

I will install QGroundControl

(Ash) #33


Which message pack should I use to send the distance messages?
I’m guessing I need something that looks like the pack function for the heartbeat (mavlink_msg_heartbeat_pack(sysid,compid, &msg, system_type, autopilot_type, system_mode, custom_mode, system_state))

But I’m not sure which pack to use. Also, if you know where to find a list of the pack functions, that would be great.


(ppoirier) #34

Take a look at my Arduino code:

(Ash) #35

Hello Patrick

Thanks for the reply and link to your code! I really appreciate it.

I’m using SharpIR sensors, which are sampled at a baud rate of 9600. Do I have to feed the Pixhawk serial port (using Telem1) at 115200 like what your code is doing? or can I simply adjust the serial baud rate in pixhawk parameters to 9600? As you know, switching baud rate on a non-mega arduino is a bit tricky.

(ppoirier) #36

@MCITYFC you can use SoftwareSerial, and the Sharp Library for arduino.

Never been really successfull with the SharpIR , I prefer the VL53L0x for the same range.

(Alan Winlaw) #37

Patrick, I have a LIDARLite v3 working as a horizontal proximity sensor (Mission Planner; Copter 3.5.4). The copter slides (annoyingly) to port side when the AVOID_MARGIN 2m is reached. From the info in your post I gather that I can set PROXIMITY_SENSOR 2 to cause a STOP. You mention that this can be configured using advanced options within Mission Planner. I’ve scoured MP Full Parameter List but can’t find any reference to this setting. Can you please advise further how to define AC_AVOID_USE_PROXIMITY_SENSOR value?
Thanks for your time.

(ppoirier) #38

@Alan_Winlaw depends on the mode and on sensors setup.
As an example , if you have single sensor (looking forward) and fly in Alt-Hold mode , chances are that it will slip one side or the other.
You can adjust this parameter , but bear in mind that in my setup (The POC), I have 6 sensors covering 180 degree forward , making the avoidance system ‘‘boxed’’ within the walls, with no chances of slipping.

(Alan Winlaw) #39

Cheers, mate. I’ll check that out.

(Ash) #40

Hello Patrick

The obstacle stop system is a go on my drone! I switched to VL53L0X as well, it’s tiny, lightweight and effective! Thanks for the suggestion and the help!

Just one point to note for the others who want to try this: When objects are out of range, your sensor should be giving you a constant reading equal to your max value set in the arduino code. If it’s jumping around between max and min, check if the protective film is still on the sensor! I didn’t realize that until a few hours into it! A jumping reading will cause the drone to jerk around or fly in one direction.

1 Like
(Ash) #42

Hello Patrick
Does this feature still work in guided_no_gps mode?

(ppoirier) #43

There is some confusion about the guided_no_gps mode = this mode is ‘‘blind’’ and you control the quad using trust vectors.

I would say I can use the avoidance in alt-hold mode and in guided mode using opticalflow with no gps that is similar to guided GPS in the sense that you can control with EK3 using relative position.

(Ash) #44

Is there a way to only hold altitude using height measuring lidar connected to the pixhawk(no optical flow) while the pixhawk is in guided_nogps mode? I’m trying to fly the drone using an offboard computer that’s handling odometry, mapping, localization and etc. Do I really have to implement an offboard altitude control algorithm too, because from what I gathered, Mavros can only send thrust setpoint but not a height setpoint (maybe I’m wrong?)

Apologies in advance since this is straying from the original topic of this thread :stuck_out_tongue:

(repaer_dewov) #45

Hi @FabricioSilva, If you want to know if you are getting distance values from a sensor in Mission Planner. Have you tried using the Proximity sensor?
It is located in the Flight Data Screen ( press Ctrl + F ) then click on Proximity and it should pop up with a window likeworkexample this.

(Tehniat Fatima) #46


I have just started working on ArduCopter and is using MavLink connection to communicate messages to Matlab. I am working on obstacle avoidance using fuzzy logic and trying to read OBSTACLE_DISTANCE message ( Still now i am unable to receive any information about sensor and obstacles.
Please guide me how to enable distance sensor from Mission Planner and also what can i do to enable my quadcopter detect obstacles during auto mode and flying mission.?
Any guidance and support is appreciated.

(ppoirier) #47

What sensors are you using?
Did you ctrl-f on mission planner to enable radar screen?

(Tehniat Fatima) #48


Sorry i am beginner in Ardupilot and learning at each step. I am not using any hardware for this setup. Everything is based on Mission Planner settings and Mavlink messages. Is it possible to simulate sensors through misison planner settings? I have looked into the screen came after Ctrl-f . What setting will be required in Mission Planner to enable it to send DISTANCE_SENSOR and OBSTACLE_DISTANCE message out to external setup running in Matlab.

(Taha Menebhi) #49

Hi @ppoirier, thank you for your work, it has been a blast learning about arducopter through your replies/code/videos.
I was wondering if the firmware version is important since this post is in the Copter 3.5 section? For example I’m running Arducopter V3.6.1 is it fine?
Also I managed to compile your VL53_MULTI_PROMINI code only by adding mavlink.h and mavlink_msg_distance_sensor.h .

(ppoirier) #50

Any version 3.5 and up are OK

(Kvynlim) #51

Does the object avoidance mode in Arducopter only works when a 360 lidar is connected directly to the FC?