tf02-pro iic in pixhawk (1)

TF02-Pro can be used with PixHawk for the purpose of obstacle avoidance and Altitude Hold.

  1. TF02-Pro Settings:

Note: If there are fluctuations in readings then set the frame rate to 250Hz, see the details in chapter 6.2 for “frame rate” and changing the communication interface in table-8.

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

We take two TF02-Pros 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 TF02-Pro manual; we take the example of PixHawk1 for connecting LiDARs.

Obstacle Avoidance:

10961541688?profile=RESIZE_710x

Figure 1: Schematic Diagram of Connecting TF02-Pro to I2C Interface of PixHawk

Note:

  1. Default cable sequence of TF02-Proand PixHawk is 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 TF02-Profaces down, please take care the distance between lens and ground should be larger than TF02-Pro’s blind zone (10cm)
  3. If more TF02-Prosneed 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 200mA (peak is 300mA)*number of TF02-Pro
  5. Parameters settings:

Common settings for obstacle avoidance:

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 TF02-Pro:

RNGFND1_ADDR = 16 [Address of #1 TF02-Pro 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 TF02-Pro real orientation]

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

Settings for second TF02-Pro:

RNGFND2_ADDR=17 [Address of #2 TF02-Pro in decimal]

RNGFND2_GNDCLEAR=15

RNGFND2_MAX_CM=400

RNGFND2_MIN_CM=30

RNGFND2_ORIENT = 4 [#2 TF02-Pro real orientation]

RNGFND2_TYPE = 25 [TF02-Pro 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. Please turn-off completely the flight controller after configuring the parameters, otherwise changes will not take place. If your battery is connected to your flight controller, please disconnect it as well.

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 refreshes when the distance changes or window opens, closes, zooms in or zooms out, and this distance will not be influenced in Mission Planner, the version available at the time writing this tutorial is v1.3.72.

Altitude Hold using IIC Interface:

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

PRX_TYPE=0 [on equal to 4 also gives the value if RNGFND1_ORIENT = 25]

RNGFND1_ADDR = 16 [Address of #1 TF02-Pro 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 = 25 [#1 TF02-Pro real orientation, this parameter is must for altitude hold]

RNGFND1_TYPE = 25 [TF02-Pro IIC same as TFmini-Plus IIC and TFmini-S 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.

Select option sonarrange, see following picture:10961543885?profile=RESIZE_710xThe altitude distance from the LiDAR will be displayed in Sonar Range (meters), see the following picture:10961543900?profile=RESIZE_400x

Read more…