Part 2/2 How to setup Pixhawk with two rangefinder sensors, object avoidance and height estimation.
HTML-код
- Опубликовано: 6 сен 2024
- Make sure you also watch the first part of the video (link below) so you avoid any knowledge gaps.
• Part 1/2 Benewake TF m...
This video explains what parameters need to be changed so that Pixhawk recognizes two rangefinder sensors.
Get the items I used here:
All in one Drone kit:
www.banggood.c...
TF Mini Lidar Module:
www.banggood.c...
Pixhawk Flight Controller:
www.banggood.c...
S500 Frame:
www.banggood.c...
Frsky r-xsr Receiver:
www.banggood.c...
Frsky Qx7 Transmitter:
www.banggood.c...
ISDT Battery Charger (strongly recomended!):
www.banggood.c...
Get a coupon from Bangood!
Hey friends! I am a VIP5 who has been enjoying Banggood for over 979 days. I have found lots of high-quality and low-cost products. Come on! Join now to get $20.
www.banggood.c...
Usefull websites to read for more in depth understanding:
ardupilot.org/c...
ardupilot.org/d...
ardupilot.org/c...
en.benewake.com...
Pixhawk is the upgrade of APM and PX4, of which APM uses conventional 8-bit SCM with limited arithmetic capability. While the PX4 is a transitional product starting to use STM32F4. Pixhawk is more refined and reliable flight control system developed from PX4. For the details of this series of the open source flight control system, refer to ardupilot.org/. This website reliably introduces Pixhawk in details, and thus it is much helpful for the user to learn and familiarize himself with the flight control system.
TFmini can be connected with Pixhawk for use. By selecting Pixhawk data output format, the TFmini can directly be connected with the serial port of Pixhawk, and also it can connect with other communication interfaces (e.g. IC²) of Pixhawk via appropriate adaptors. TFmini can be used in flight device for altitude holding. It is recommended that Pixhawk adopts ArduCopter V3.4.9-V3.5.5 firmware.
The parameters are listed below:
follow the normal instructions for setting up rangefinders.
set the RNGFNDx_ORIENT parameters (i.e. RNGFND_ORIENT, RNGFND2_ORIENT) to specify the direction the range finder is pointing in (i.e. 0=Forward, 2=Right, 4=Back, 6=Left, 24=Up, 25=Down)
set PRX_TYPE = “4” to enable using range finders as “proximity sensors”.
set AVOID_ENABLE to “7” to enable avoidance using proximity sensors (and fences)
a) TFmini for Mission Planner configuration description for pixhawk in altitude hold mode
Connect the flight control board to MP, Select [Full Parameter List] in the left from the below bar- [CONFIG/TUNING] . Find and modify the following parameters:
AVOID_MARGIN=1
SERIAL2_PROTOCOL = 9 (Lidar)
SERIAL2_BAUD = 115
RNGFND_TYPE = 8 (LightWareSerial) or 20 (benewaketf mini)
RNGFND_SCALING = 1
RNGFND_MIN_CM = 30
RNGFND_MAX_CM = 1000 for indoor use OR 600 for outdoors. This is the distance in centimeters that the rangefinder can reliably read.
RNGFND_GNDCLEAR = 15 (expressed in cm, depending upon mounting height of the module)
RNGFND_ORIENF=25
PRX_TYPE=4
PRX_YAW_CORE=22
Upon setting of these parameters, click [Write Params] on the right of the software to finish.
If the error message “Bad Lidar Health” appears, please check if the connection is correct and the power supply is normal.
b)TFmini for Mission Planner Configuration Instructions for Pixhawk in Obstacle Avoidance Mode
Connect the flight control board to MP, Select [Full Parameter List] in the left from the below bar- [CONFIG/TUNING] . Find and modify the following parameters:
AVOID_MARGIN=1(Unit: m, set obstacle avoidance distance as required)
SERIAL2_PROTOCOL = 9 (Lidar)
SERIAL2_BAUD = 115
RNGFND_TYPE = 8 (LightWareSerial)
RNGFND_SCALING = 1
RNGFND_MIN_CM = 30
RNGFND_MAX_CM = 600 (Unit: cm, can be set according to the needs of measuring distance, outdoor TFmini recommended setting distance ≤ 600)
RNGFND_GNDCLEAR = 15(Unit: cm, depending upon mounting height of the module)
RNGFND_GAIN=0.8
RNGFND_ORIENF=0
PRX_TYPE=4
PRX_YAW_CORE=0
Upon setting of these parameters, click [Write Params] on the right of the software to finish.
after changing RNGFND1_TYPE to 20. i had to save before the other parameters showed up. confused me for a few miniutes. FYI
Good point!
Thanks. How about using more than 1 sensors left, right and front all for obstacle avoidance? Some says I2C but how does it tell the positions? Thanks
Great video! Could you kindly do a flight video that shows how the quad behaves on the different flight modes with the two lidar sensors installed?
@@maixechrys6264 thanks for this info. What about guided RTL? Like terrain following and obstacle avoidance?
the same question that i was looking for
@@kakemboluide After some searching, I believe this is the info you are looking for, ardupilot.org/copter/docs/terrain-following-manual-modes.html ardupilot.org/copter/docs/terrain-following.html#terrain-following
Sir I had a question can we use the same setup for testing my lidar underwater for non gps navigation
Asuming the gear can work underwater I would say yes..
I have a question about setting Obstacle Avoidance Mode.
When the parameter "RNGFND_ORIENF" is set to "25: down", the displayed number moves, but when it is switched to "0: front", the display becomes "0" and it is not measured.
The other parameter settings are the same.
Hello could you also make a video for object avoidance in car with motors and how to use TFmini with it
Thanks for the Video. I have been trying to set up tfmini plus for object avoidance, unsuccessful. I m using serial 5 as rangefinder2, that it did not detect. I tried serial 2, but rangefinder1 jumped to serial2 as rangefinder1. Any suggestions will be helpful. Thank you.
That is weird, sometimes you have to do it one by one and restart when making changes. Use another cable and connect it to the back of the computer, sensors may not work with the battery unpluged.
hi this sensor can i use for opstacle avoidance?
Well, thanks I am also trying to do it, with the help of TF MINI, I have done all the steps you have mentioned, but after that how to check if it is working ?
As I tried practically and it didn't worked
Did you solved it? I have to build one
hello sir, I have 3 question and i didn't find right answer :( please help me. How can we connect external sensors (leakage, ping sonar, temperature-humidity sensors) to Pixhawk PX4? Can we connect multiple sensors if we can how do we do it? Can we connect 3 Distance sensors to Pixhawk if we can, how we can do it?
Hello, first up you need to identify what protocol the sensors use, for example are they using telemetry ports or i2c?
@@maixechrys6264 --> DHT22 humidity & temperature sensor (DHT22 also named as AM2302)
• Output signal: digital signal via single-bus
What protocol does DHT22 use?
• Single wire protocol (single wire/bus for communication)
-->A02YYUW Waterproof Ultrasonic Sensor
• Output: UART
• RX: Processed Value/Real-time Value Output Selection
• TX: UART Output
--> BlueRobotics SOS Leak Sensor
• I did not find any information about its protocol.
--> BlueRobotics Ping Sonar Altimeter and Echosounder
• The Ping sonar communicates with a serial UART using a binary communication protocol called Ping Protocol
• Signal Protocol: TTL Serial (UART)
• I found that we can connect it to pixhawk’s SERIAL2 port (Serial/UART port). Is it ok?
--> DFRobot Gravity: Analog Water Pressure Sensor
• Integrated Circuit (IC) engineering technology.
Uart is a telemetry port, so you have to connect it to one of the 4/5 telemetry ports and go to the advanced settings and change the number that corresponds to your sensor maybe the manual has this information.
Uart or telemetry ports are unfortunately limited and Telem_1 is reserved for the usb connection to pc.
On the other hand I2C port can connect many sensors using an I2C splitter.
it's posible to connect 4 One-way Lidar Range Finder Sensor to the pixhawk or cube? awesome vid!
You can connect as many as spare telemetry ports allow, if you have i2c sensors and not Mavlink there is no limitation within reason. Best you can do is connect 2 mavlink and 2 i2c. Thanks!
Hello Maixe. In february I start my last university year project. Im making a drone that flight inside a greenhouse and collect data. But also I need to implement a object avoidance. Im gonna use the pixhawk and as you do, this lidar sensor. My question is. Once you have done all the process you do in your video, the drone automatically correct its possition when an object is detected by the lidar? Or do i need to do something else apart from this video? thanks
This will work, the only thing you might want to is to play with the settings on how the craft will react.
@@maixechrys6264 Nice. Im forced to fly in althold mode. Does obstacle avoidance works in that mode.
Also, is there a minimun of distance the lidar can detect and the drone react? I mean, as im flying inside, I will need to set the lidar probably at 30-50cm
I have followed all the instructions as mentioned but I am getting Bad lidar health. I am using only 1 Tfmini sensor for obstacle avoidance. Any suggestions?
Please be aware that the tutorial is for two sensors, have you read the manual from benewake page?
Have you seen part 1 of the tutorial?
ruclips.net/video/I1F_ac4Uous/видео.html
b)TFmini for Mission Planner Configuration Instructions for Pixhawk in Obstacle Avoidance Mode
Connect the flight control board to MP, Select [Full Parameter List] in the left from the below bar-
[CONFIG/TUNING] . Find and modify the following parameters:
AVOID_MARGIN=3(Unit: m, set obstacle avoidance distance as required)
SERIAL2_PROTOCOL = 9 (Lidar)
SERIAL2_BAUD = 115
RNGFND_TYPE = 8 (LightWareSerial)
RNGFND_SCALING = 1
RNGFND_MIN_CM = 30
RNGFND_MAX_CM = 600 (Unit: cm, can be set according to the needs of measuring distance, outdoor
TFmini recommended setting distance ≤ 600)
RNGFND_GNDCLEAR = 15(Unit: cm, depending upon mounting height of the module)
RNGFND_GAIN=0.8
RNGFND_ORIENF=0
PRX_TYPE=4
PRX_YAW_CORE=0
Upon setting of these parameters, click [Write Params] on the right of the software to finish.
SJ-PM-TFmini-T-01 A03 Benewake (Beijing) Co. Ltd.
Page30
If the error message “Bad Lidar Health” appears, please check if the connection is correct and the power
supply is normal.
I can see the TFmini used as the object avoidance sensor. I missed what sensor you used for height sensor. Can you please provide a link for that. Thanks.
ok, I see it. Two TFmins.....
My goal is to create a sensor that can detect a wall/surface within a foot, and lock off horizontal travel, essentially terrain follow but for vertical terrain. Would you advise using LiDAR sensors and programs that are made for terrain follow but mount them horizontally on my drone? Or should I go with something else or a different sensor?
Thanks for commenting, yes i think the sensors are capable of doing that. Lidars sometimes have limitations in very bright light in that case you might want to go with camera style avoidace (like the dji drones) but I do not think is nesessary.
Maixe Chrys awesome thanks, as I am quite new to this could you advise me for places to look, I’d rather not program my own system I’m sure it already exists.
Hello, i wanted to know what all modes are best for the collision avoidance, is it possible to test in indoor flight
Your reply will be highly appreciated
Thanks
It is not good practice to use sensors indoors even DJI products suggest that you switch off the sensors the technology isnt there yet. For indoor flying you will need the sensors to cover a 360 field around the copter. Please check with ardupilot to see what modes support collision avoidance, it definatelly supports AltHold and Loiter ever RTL.
Thanks for the Video.I need a help. Im using analog for range finder. i can able to see the data in status too. But still the mission planner shows the barometer reading in altitude.I need to fly the drone one meter above the ground in guided mode .will pixhawk use baro altitude or the range finder data? is there any changes in parameter list?
Pixhawk will mainly use barometer altitude above set max altitude of sensor, are you using the benewake tf mini or another sensor? If so the parameters are irrelevant. I do not recomend setting the lidar as the main instrument for height if you want to see what the sensor reads you need to enable sonar_range in the user items.
@@maixechrys6264 thanks for the reply. yh im using benewake.but im not worrying about the sensor readings. readings are pretty good. but i coudnt fly with that data. pixhawk ask to disable the gps when using range finder as main altitude source. can u suggest me a way to do terrain following using rangefinder with pixhawk using dronekit?
Hello, I noticed that when I set PRX_TYPE=4, the sonarrange becomes zero. But on the proximity console I am able to see the objects detected. Any suggestion?
There must be another problem as the prx_type is always 4 for this kind of sensor. Check that every other paramerer is correct and that you have rebooted the vehicle. Are you using 2 sensors?
@@maixechrys6264 using just one sensor for obstacle avoidance. The other parameters seems to be correct. Should the Rngfnd1_type be 8 or 20 ?
@@pavanshetty9117 it works both ways, rerun the setup if the tf mini and its programming you have to set it up to work with pixhawk. Also watch the first part of the video.
hello sir i connected it to flight controler and i also have connected leds and gps..the problem is that the gps and the leds went off during flight..is it possible that the power consuption is to big to handle ?may i use a 5v beck to power the sensor?
Ya sou Giorgo, Im going to need a bit more info on that, for instance where the led's get their power from? Is it through the servo rail of the pixhawk?
@@maixechrys6264 yes my friend
@@djitastic2502 well assuming that you use some kind of power supply (maybe the current sensor style) that plugs on the power connector on the pixhawk, then the servo rail and the power supply is completely seperate from each other if you think your ubec is not supplying enough power check with another. Also check the zener diode/capacitor mod for the pixhawk. You may need to add a capacitor to the servo rail.
hi i follow all instraction and says only check proximity sensor
Hello, have you been able to check that the sensor is working through the benewake provided software?
@@maixechrys6264 hi rngfnd to get 8 and not working
If get 20 working what the different?
@@wrathfulfpvboyz4481 well, use 20 if it works.
Hi, great video. This was just what I was looking for. I have a doubt. I am using the same two sensors that you are using for the same purpose ( height estimation and object avoidance ). Can we configure the forward sensor for object avoidance and downward sensor for height estimation only( no object avoidance ). I have this doubt because parameters like Avoid_enable,avoid_margin,prx_type are global and not specific to that particular range finder. Please correct me if I am wrong. So how can we set avoidance and avoidance margin individually for each range finder
Thank you very much for your kind words.
Check the video after 7:00 where I switch to the avoidance sensor.
Rangefinder2 in my case .
Avoid parameter only refers to the horizontal sensor(s) for object avoidance, so it really is specific for that purpose.
The setup you are trying to make is exactly what the video discribes so make sure you dont miss a step!
@@maixechrys6264 got it …. So there is no obstacle avoidance for downward sensors. Only surface tracking. The avoid parameters are for horizontal sensors
@@RajPatel-vc6mg yes that is right, unless you start messing with its orientation that is how it works. Surface tracking kind of works like avoidance though.
@@maixechrys6264 Thank you, I got both the sensors working. I just have one more doubt. I can’t see the sensor distances on my mission planner hud. I can see them in my proximity tab by pressing clt f . How can I see the distances on the hud like you have set them up. Thank you
@@RajPatel-vc6mg you right click the hud screen and there is an option to show aditional sensor readings, I dont remember by heart though.
hi sir can you please explain how many sensor i can attach to a pixhawk. can i attach 4-6 sensors?? thank you
You are limited by the telemetry I/O of the controller. In this case we can have a maximum of four, if you want more or if you dont have any other serial ports available you can opt for an I2C based sensor witch can be a lot more than 4.
@@maixechrys6264 m kinda new to all this. And there is no proper tutorial that shows how to install. You said it can take 4. 2 i saw how you did it. What about the other 2? Actually i m using ultrasonic sensors. I do have tfminis too.
@@RETROGAME-FIX Do you use gps? Osd? If yes then i am afraid you do not have any serial ports available. Maybe you can fit one more but you have to see how many teletry ports are available to you.
@@maixechrys6264 the project is to build an obstacle avoidance drone all 4 directions and if possible, add 2 more sensors for up and down. There are tons of video and pages but for some reason its not working for me. Maybe m broken or my electronics are broken. I can compensate the telemetry and osd for the sensors. I saw the I2c option too but again i am not able to use the tfmini with i2c maybe m missing something in mission planner parameters.
i have followed your tutorial, but for some reason i am not able to get the Red line with distance.. dont know what i did wrong.
Have you watched part one of the tutorial, I fear you might havent set up the lidar to talk to pixhawk. You have to enter programming mode and enter a command line to the lidar so that it sends signals compatible with pixhawk and ardupilot.
@@maixechrys6264 i did not before, but i did and followed the tutorial. And it worked well for a while. But now it is stuck on 2.5m red line. Its knid bouncing from 2.2m - 2.8m. Although my quad is facing a wall with 30cm.
@@RETROGAME-FIX I will point something obvious that you must have done already, but never the less have you updated the firmware on the lidar and pixhawk aswell? Have you restarted the pixhawk after any change and checked afterwards? Follow the instructions provided in the tutorial as I suspect any deviation is likely to result in failure. I remember having this sort of problems when doing something different that the parameters I present here (exept the distance that is up to the application of the final user).
@@maixechrys6264 thanks a million sir for the quick response. I did updated the firmware on pixhawk but wasnt able to update the lidar, when clicked the update nothing was happening. And I have found out that when the FC is connected to pc via usb the lidar sensor has some power surge and does not response well. But when i connect it to the battery it starts working. My second question is that the obstacle avoidance is constantly in on position or do i have to assign to a mode. Coz i jave seen the option in modes. M using MP 1.3.66 and i dont have seen AVOID_ENABLE in the parameters list.
@@RETROGAME-FIX Ok first things first, it is the pixhawk firmware that is responsible for showing the parameter required. If it is not implemented in the stable build maybe you have to download a Beta firmware to make the required parameter appear. As for the lidar it should work with usb, provided that the usb port is directly connected(no hub). Tell me what you need more specific and I might make a video about it.
VERY GOOD MY FRIEND
Thank you appreciate it.
Hey can i use 5 of these on a drone 1 for each direction and 1 for heigh estimation??
I think is better to use I2c sensor like the Maxbotic for that application, as I am afraid there are not enough telemetry ports for 5 sensors but I2c can be much more.
@@maixechrys6264 can you provide a link to this sensor?
@@maixechrys6264 better yet is it possible to make a splitter like you made in the video but for 5 instead? Or maybe a circuit that connects 5 to 1 and plug it into the pixhawk?
Can I use only on lidar facing front ?
Yes of course you just skip the steps for the secondary, follow the instructions provided by benewake.
Ok
Can you please provide parameter file for latest pixhawk firmware for Quadcopter?
*** Excellent ****