benewake (2)

Application of TFmini-S in PixHawk

TFmini-S can directly be connected with the serial port of PixHawk. TFmini-S can be used in flight controller for the purpose of altitude holding or obstacle avoidance. This document is suitable to PixHawk adopts ArduCopter V3.6.2 or higher firmware (Note: Standard output mode should be used instead of PIX mode by Benewake GUI in firmware V3.6.2 or above).

Example for connecting PixHawk:

12699363892?profile=RESIZE_710x

12699363892?profile=RESIZE_710x

Figure 1 Schematic Diagram of Connecting TFmini-S with TELEM 2 Interface (Serial Port 2) of PixHawk

a) Mission Planner configuration description of TFmini-S for the purpose of altitude hold 

Connect the flight control board to Mission Planar. Attention: the installation height should be larger than non-detection zone. Select [Full Parameter List] in the left from the below bar- [CONFIG/TUNING]. Find and modify the following parameters:

SERIAL2_PROTOCOL = 9  [Rangefinder option]

SERIAL2_BAUD = 115  [Choose the current LiDAR baud rate, if haven’t been changed, the default baud rate 115200 should be selected, that is 115]

RNGFND1_TYPE = 20 [TFmini-S UART option]

RNGFND1_MIN_CM = 30 [It could be changed according to real demands and should be bigger LiDAR than non-detection zone, unit is cm]

RNGFND1_MAX_CM = 300   [It could be changed according to real demands but should be smaller than effective measure range of LiDAR, unit is cm]

RNGFND1_GNDCLEAR = 15 [expressed in cm, depending upon mounting height of the module and should be bigger LiDAR than non-detection zone]

RNGFND1_ORIENT=25 [face down]

PRX_TYPE=0

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. Also check it whether you have changed the mode from Standard mode to Pix mode while the firmware is 3.6.2 or higher if yes then the same error will encounter.

How to see the altitude value from LiDAR sensor: double click the area of the Mission Planner, look at the following picture:

12699364865?profile=RESIZE_710x

Select option sonarrange, see following picture:

12699364889?profile=RESIZE_710x

The altitude distance from the LiDAR will be displayed in Sonar Range (meters), see the following picture:

12699365661?profile=RESIZE_710x

B)Mission Planner configuration description of TFmini-S for the purpose of Obstacle Avoidance

It’s only recommended to be used in Loiter mode, the detailed setting is as follows:

Connect the flight control board to MP. Attention: distance between UAV margin and LiDAR should be larger than LiDAR non-detection zone. Select [Full Parameter List] in the left from the below bar- [CONFIG/TUNING]. Find and modify the following parameters:

AVOID_MARGIN=2 [Unit: m, set obstacle avoidance distance as required]

SERIAL2_PROTOCOL = 9 [Rangefinder option]

SERIAL2_BAUD = 115 [Choose the current LiDAR baud rate, if haven’t been changed, the default baud rate 115200 should be selected, that is 115]

RNGFND1_TYPE = 20 [TFmini-S UART option]

RNGFND1_MIN_CM = 30   [It could be changed according to real demands and should be bigger LiDAR than non-detection zone, unit is cm]

RNGFND1_MAX_CM = 300 [It could be changed according to real demands but should be smaller than effective measure range of LiDAR, unit is cm]

RNGFND1_GNDCLEAR = 15 [Unit: cm, depending upon mounting height of the module and should be bigger LiDAR than non-detection zone]

RNGFND1_ORIENT=0   [It depends on the LiDAR’s real installation direction, 0~7, 24=Up and 25=Down (total ten) are supported up to now, see detail in MP]

PRX_TYPE=4    [Rangefinder should be selected for proximity sensor in obstacle avoidance mode]

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.

How to see the target distance from the LiDAR: (distance from LiDAR in obstacle avoidance can’t be displayed in sonarrange option) press Ctrl+F button in keyboard, the following window will pop out:

12699365669?profile=RESIZE_710x

Click button Proximity, the following window will appear:

12699365296?profile=RESIZE_710x

The number in green color means the distance from LiDAR in obstacle avoidance mode(the number only refresh when this window opens, closes, zooms in or zooms out, it doesn’t mean the real time distance from LiDAR and will not be influenced in Mission Planner version under v1.3.48, the problem could be solved by updating Mission Planner)

²  Attach: If TELEM 2 port has been used, SERIAL4/5 interface could be used, the other setting are same

12699365887?profile=RESIZE_710x

Figure 2: Schematic Diagram of Connecting TFmini-S with SERIAL4/5 Interface (Serial Port 4/5) of PixHawk

 

 

Configuration Descriptions of Mission Planner:

Connect flight control board to MP, Select [Full Parameter List] in the left from the below bar [CONFIG/TUNING]. Find and modify following parameters:

SERIAL4_PROTOCOL = 9 (LiDAR)

SERIAL4_BAUD = 115

Upon setting of these parameters, the other parameters should be same as Mission Planner configuration description of TFmini-S for the purpose of Obstacle Avoidance or Altitude Holding, then click [Write Params] on the right of the software to finish.

Read more…

TFmini-S can be used with PixHawk for the purpose of obstacle avoidance.

  1. TFmini-SSettings:

Note: Frame rate should be set to 250Hz, see the details in chapter 7.4 “frame rate” and changing the communication interface.

The default communication of TFmini-S is TTL, IIC and TTL uses the same cable, so please set TFmini-S to IIC communication first, see detail commands in product manual.

We take two TFmini-S as an example in this passage and set the address 0x10 and 0x11 separately.

  1. PixHawk Connection:

See the connection details in PixHawk manual and TFmini-S manual, we take example for connecting

PixHawk flight controller:

12629947677?profile=RESIZE_710x

Figure 1: Schematic Diagram of Connecting TFmini-S to I2C Interface of PixHawk

Note:

  1. Default cable sequence of TFmini-S and PixHawk are different, please change it accordingly (SDA and SCL wires need to be interchanged). Look at the pinout of controller, pin configurations are starting from left to right:

 10961543091?profile=RESIZE_710x

  1. IIC connector should be purchased by user
  2. If TFmini-S faces down, please take care the distance between lens and ground should be larger than TFmini-S’s blind zone (10cm)
  3. If more TFmini-S need to be connected (10 LiDARs can be connected), the method is same.
  4. Power source should meet the product manual demands:5V±0.5V, larger than 140mA*number of TFmini-S
  5. Parameters settings:

Common settings:

AVOID_ENABLE= 2 [if 3 = UseFence and UseProximitySensor doesn’t work in IIC then choose 2 = UseProximitySensor]

AVOID_MARGIN=4

PRX_TYPE=4

Settings for first TFmini-S:

RNGFND1_ADDR=16 [Address of #1 TFmini-S in decimal]

RNGFND1_GNDCLEAR=15 [Unit: cm, depending upon mounting height of the module and should be larger LiDAR than non-detection zone]

RNGFND1_MAX_CM=400 [It could be changed according to real demands but should be smaller than
effective measure range of LiDAR, unit is cm] 

RNGFND1_MIN_CM=30 [It could be changed according to real demands and should be larger than
LiDAR non-detection zone, unit is cm] 

RNGFND1_ORIENT=0 [#1 TFmini-S real orientation]

RNGFND1_TYPE = 25 [TFmini-S IIC same as TFmini-Plus IIC]

 

Settings for second TFmini-S:

RNGFND2_ADDR=17 [Address of #2 TFmini-S in decimal]

RNGFND2_GNDCLEAR=15

RNGFND2_MAX_CM=400

RNGFND2_MIN_CM=30

RNGFND2_ORIENT=25 [#2 TFmini-S real orientation]

RNGFND2_TYPE=25 [TFmini-S IIC same as TFmini-Plus IIC]

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.

How to see the target distance from the LiDAR: press Ctrl+F button in keyboard, the following window will pop out:

10961543271?profile=RESIZE_710x

  

Click button Proximity, the following window will appear:

 10961543487?profile=RESIZE_710x

The number in green color means the distance from LiDAR in obstacle avoidance mode(the number only refresh when this window opens, closes, zooms in or zooms out, it doesn’t mean the real time distance from LiDAR and will not be influenced in Mission Planner version under v1.3.48, the problem could be solved by updating Mission Planner

Read more…