Benewake LiDAR's Posts (8)

Sort by

TFmini-i and TF02-i can be interfaced with PixHawk1 CAN port or any flight controller which has Ardupilot firmware flashed and having CAN interface. Support for CAN protocol has been added to Ardupilot firmwares, starting from Copter 4.2.0 for the purpose of obstacle avoidance and Altitude Hold.

1.  TFmini-iandTF02-i Settings:

It should be noted that TF02-i and TFmini-i have two different hardware versions for 485 and CAN. So when buying LiDAR, please pay attention to buy LiDAR with CAN interface. Multiple LiDARs can be interfaced to a single CAN bus. We need to assign different CAN IDs to each LiDAR just like we do for IIC communication. The baud-rate of each LiDAR needs to be set to the same value. On LiDAR side we have two types of CAN IDs:

    Send ID: it becomes Receive ID on CAN bus side (we need to set this ID to a new value ifwe

are connecting multiple LiDARs.)

    Receive ID: it becomes Send ID on CAN bus side

I will consider three LiDARs example but Ardupilot supports up to  10 sensors. The commands are mentioned in details in the manual of LiDAR but I will add them here for convenience. It is still advised to read the manual of LiDAR carefully there are important points.

5A 0E 51 00 08 03 00 00 00 04 00 00 00 C8 [CHANGE SEND ID TO 04]

5A 0E 51 00 08 03 00 00 00 05 00 00 00 C9 [CHANGE SEND ID TO 05]

5A 0E 51 00 08 03 00 00 00 06 00 00 00 CA [CHANGE SEND ID TO 06]

5A 04 11 6F [SAVE SETTINGS]

5A 05 60 01 C0 [Enable 120Ω Terminating Resistor]

5A 05 60 00 BF [Disable (Default) 120Ω Terminating Resistor]

5A 0E 51 00 08 03 00 00 00 03 00 00 00 C7 [CHANGE RECEIVING ID BACK TO 03]

Some  details  about terminating  resistor  on LiDAR: Although resistor  on LiDAR  is  disabled by default and LiDAR works without enabling resistor but adding resistor helps in reducing equivalent resistance of transmission wires, because adding more resistors in parallel will reduce the equivalent resistance. So in case you are experiencing any kind problem with data stability then you could enable resistors on LiDARs by sending command I added above. I have tested with total five LiDARs (two with resistors enabled and three without enabling resistors and I was able to get stable data).

For sending the above commands, you will either need CAN analyzer or TTL-USB board (because UART interface of TF02-i/TFmini-i can be used to configure its parameters).

Once you are done with above settings then it’s time to move to physical connection and Ardupilot firmware settings.

We take three TFmini-i or TF02-i CAN as an example in this passage and set the addresses to 0x03 and 0x04 and 0x05 separately. The default sending ID of LiDAR is 0x03 so leave it for one LiDAR and configure for other two LiDARs to 0x04 and 0x05.

2.   PixHawkConnection:

The following two diagrams show how to interface TFmini-i and TF02-i CAN with PixHawk flight controller. The wiring details of TFmini-i and TF02-i CAN is the same.

 12222374661?profile=RESIZE_710x

 

Figure 1: Schematic Diagram of Connecting TFmini-i CAN to CAN Interface ofPixHawk1

Note

     1.  Pleasepayattention to connect right wire to the right pin of flight controller. Look at the pinout of controller, pin configurations are starting from left to right:

12222374861?profile=RESIZE_400x

Figure 2: Pin details of CAN Interface ofPixHawk1

  1.  Relatedconnectorsneed to be purchased by user, LiDAR connector is 7-pin JST with25mm pitch.
  2.  IfLiDARfaces down, please take care the distance between lens and ground, it should be larger than LiDAR’s blind zone ( 10cm).
  3.  IfmoreLiDARs need to be connected ( 10 LiDARs can be connected), the method is same.
  4.  Powersourceshould meet the product manual current and voltage requirement: 7V to 30V, larger than 100mA*number of LiDAR. I used 12V supply.

 12222375096?profile=RESIZE_584x

 Figure 3: Schematic Diagram of Connecting TF02-i CAN to CAN Interface ofPixHawk1

 

3.  Parameterssettings:

Common settings for obstacle avoidance :

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

AVOID_MARGIN=4

 

PRX_TYPE=4

Settings for CAN-1 port:

CAN_P1_DRIVER = 1

CAN_D1_PROTOCOL = 11

CAN_P1_BITRATE =  [Baud-rate: For TFmini-i and TF02-i it is 250000, and for TF03 the default baud-rate needs to be set to 1000000.]

In case of pixhawk1 we only have one CAN interface but if there are more than one interfaces then configure the parameters for CAN-2 interface.

Settings for CAN-2 port:

CAN_P2_DRIVER = 1

CAN_D2_PROTOCOL = 11

CAN_P2_BITRATE =  [Baud-rate: For TFmini-i and TF02-i it is 250000, and for TF03 the default baud-rate needs to be set to 1000000.]

 

Settings for first TFmini-i or TF02-i:

RNGFND1_RECV_ID = 3 [CAN Transmit ID of #1 TFmini-i or TF02-i in decimal]

RNGFND1_GNDCLEAR=15 [Unit: cm, depending upon mounting height of the module and should be larger LiDAR than non-detection zone. This parameter is required to be configured for altitude hold, it is the installation height of LiDAR from ground.]

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-i real orientation]

RNGFND1_TYPE = 34 [TFmini-i CAN same as TF02-i and TF03-CAN]

 

Settings for second TFmini-i or TF02-i:

RNGFND2_RECV_ID = 4 [CAN Transmit ID of #2 TFmini-i or TF02-i in decimal]

RNGFND2_MAX_CM=400

RNGFND2_MIN_CM=30

RNGFND2_ORIENT = 6 [#2 TFmini-i real orientation]

RNGFND2_TYPE = 34 [TFmini-i CAN same as TF02-i and TF03-CAN]

 

Settings for third TFmini-i or TF02-i:

RNGFND3_RECV_ID = 5 [CAN Transmit ID of #3 TFmini-i or TF02-i in decimal]

RNGFND3_MAX_CM=400

 

RNGFND3_MIN_CM=30

RNGFND3_ORIENT = 4 [#3 TFmini-i real orientation]

RNGFND3_TYPE = 34 [TFmini-i CAN same as TF02-i and TF03-CAN]

 

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:
12222375465?profile=RESIZE_710x

  

Click button Proximity, the following window will appear:
12222375870?profile=RESIZE_584x

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 used at the time writing this tutorial is v1.3.72.

Altitude Hold using CAN Interface:

Let say we use fourth LiDAR for the purpose of Altitude Hold. 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 ifRNGFND4_ORIENT = 25]

RNGFND4_RECV_ID = 6 [CAN Transmit ID of #4 TFmini-i or TF02-i in decimal]                                 

RNGFND4_GNDCLEAR = 15 [Unit: cm, depending upon mounting height of the module and should be larger LiDAR than non-detection zone. This parameter is required for Altitude Hold.]

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

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

RNGFND4_ORIENT = 25 [#4 TFmini-i real orientation]

RNGFND4_TYPE = 34 [TFmini-i CAN same as TF02-i and TF03-CAN]

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:
12222376255?profile=RESIZE_710x

 

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

picture:

12222376078?profile=RESIZE_180x180

Read more…

Application of TF-Luna in Pixhawk

TF-Luna can directly be connected with the serial port of Pixhawk. TF-Luna can be used in flight device

for the purpose of altitude holding or obstacle avoidance. This document is suitable to Pixhawk adopts ArduCopter V4.0.0 or higher firmware.

Example for connecting Pixhawk:

 12214371691?profile=RESIZE_584x

Figure 1 Schematic Diagram of Connecting TF-Luna with TELEM 2 Interface (Serial Port 2) of Pixhawk

a)MissionPlanner configuration description of TF-Luna for the purpose of altitude hold

 

Connect the flight control board to MP.Attention:the installation height should be bigger 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]

RNGFND_TYPE = 20    [Same option with TFmini]

 

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

RNGFND_MAX_CM = 200      [It could be changed according to real demands but should be smaller than

effective measure range of LiDAR,unit is cm]

 

RNGFND_GNDCLEAR = 15    [expressed in cm, depending upon mounting height of the module and

should be bigger LiDAR than non-detection zone]

 

RNGFND_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, then restart Pixhawk.

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

12214373260?profile=RESIZE_400x

Select option sonarrange,see following picture:

 12214371897?profile=RESIZE_584x

 

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

b)  MissionPlannerconfiguration description of TF-Luna for the purpose of Obstacle Avoidance

12214373277?profile=RESIZE_400x

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

 

Connect the flight control board to MP. Attention:distance between UAV margin and LiDAR should be bigger 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=3 [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]

RNGFND_TYPE = 20    [Same option with TFmini]

 

RNGFND_MIN_CM = 20      [It could be changed according to real demands and should be bigger LiDAR

than non-detection zone,unit is cm]

 

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

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

RNGFND_ORIENT=0      [It depends on the LiDAR’s real installation direction,0~7 is 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, then restart Pixhawk.

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:

 12214372872?profile=RESIZE_710x

Click button Proximity,the following window will appear: 

 

The number in green color means the distance from LiDAR in obstcle avoidance mode  (the number only refresh when this window open,close,zoom in or zoom 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

 

Figure 2 Schematic Diagram of Connecting TF-Luna 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 TF-Luna for the purpose of Obstacle Avoidance or Altitude Holding,then click [Write Params] on the right of the software to finish.

Read more…

Application of TF-Luna in Pixhawk

TF-Luna can directly be connected with the serial port of Pixhawk. TF-Luna can be used in flight device

for the purpose of altitude holding or obstacle avoidance. This document is suitable to Pixhawk adopts ArduCopter V4.0.0 or higher firmware.

Example for connecting Pixhawk:

 12163570060?profile=RESIZE_584x

 

 

 

 

 

 

 

 

 

 

 

 

Figure 1 Schematic Diagram of Connecting TF-Luna with TELEM 2 Interface (Serial Port 2) of Pixhawk

 

a)MissionPlanner configuration description of TF-Luna for the purpose of altitude hold

 

Connect the flight control board to MP.Attention:the installation height should be bigger 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]

RNGFND_TYPE = 20    [Same option with TFmini]

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

RNGFND_MAX_CM = 200      [It could be changed according to real demands but should be smaller than

effective measure range of LiDAR,unit is cm]

RNGFND_GNDCLEAR = 15    [expressed in cm, depending upon mounting height of the module and

should be bigger LiDAR than non-detection zone]

RNGFND_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, then restart Pixhawk.

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

12163575283?profile=RESIZE_584x

Select option sonarrange,see following picture:

12163575294?profile=RESIZE_584x 

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

 

b)  MissionPlannerconfiguration description of TF-Luna for the purpose of Obstacle Avoidance

12163576459?profile=RESIZE_584x 

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

Connect the flight control board to MP. Attention:distance between UAV margin and LiDAR should be bigger 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=3 [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]

RNGFND_TYPE = 20    [Same option with TFmini]

RNGFND_MIN_CM = 20      [It could be changed according to real demands and should be bigger LiDAR

than non-detection zone,unit is cm]

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

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

RNGFND_ORIENT=0      [It depends on the LiDAR’s real installation direction,0~7 is 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, then restart Pixhawk.

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:

12163575698?profile=RESIZE_710x

Click button Proximity,the following window will appear: 

The number in green color means the distance from LiDAR in obstcle avoidance mode  (the number only refresh when this window open,close,zoom in or zoom 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

Figure 2 Schematic Diagram of Connecting TF-Luna 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 TF-Luna for the purpose of Obstacle Avoidance or Altitude Holding,then click [Write Params] on the right of the software to finish.

Read more…

TF-Luna can be used with PixHawk1 for the purpose of obstacle avoidance and Altitude Hold. But because it’s a short range sensor so in most cases it is used for obstacle avoidance.

  1. TF-Luna Settings:
  2. Note: If there are any spikes while using the LiDAR as obstacle avoidance sensor then it is advised to change the frame rate to 250Hz, see the command details having command ID as 0x03 in the manual and for the sake of convenience configuring other parameters (like setting frame-rate, changing address etc.) in UART mode is recommended if you don’t have IIC-USB converter. A simple UART-USB adapter or board should work.

At the time of writing this document latest firmware was 3.3.0. For firmware upgrade please contact our technical support.

The default communication of TF-Luna is UART. LiDAR comes with a single cable. In order to use IIC, the cable needs a little modification, details are mentioned in the coming paragraph. Please see TF-Luna IIC communication pin details as below:

 10995528260?profile=RESIZE_710x

 

If we look at the pin configuration of TF-Luna, IIC can be set by grounding pin-5 in addition to the other four pins. For this purpose a customized cable is needed because in IIC mode we need to connect both pin-4 and pin-5 to the ground.

The modified cable is shown below. I have connected green wire (pin-4) and blue wire (pin-5) to single pin which will go to the GND pin of the source. Leave pin-6 connected. Please ignore the color standard in this case as black wire represents RXD/SDA while yellow wires represents TXD/SCL, just follow the pin numbering according to the user-manual.   

 10995528097?profile=RESIZE_710x

 

TF-Luna, TFmini-S, TFmini-Plus and TF02-Pro can be interfaced with IIC port of PixHak1 flight controller. Their settings are almost same. We take two TF-Luna LiDARs as example and set the address 0x08 and 0x09 separately.

  1. PixHawk Connection:

 We take PixHawk1 flight controller as an example:

10995530287?profile=RESIZE_710x

Figure 1: Schematic Diagram of Connecting TF-Luna to I2C Interface of PixHawk

Note:

  1. Default cable sequence of TF-Luna 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:

 10995529253?profile=RESIZE_710x

  1. IIC connector should be purchased by user
  2. If TF-Luna faces down, please take care the distance between lens and ground, it should be larger than TF-Luna’s blind zone (20cm)
  3. If more TF-Luna need to be connected (10 LiDARs are supported), the method is same.
  4. Power source should meet the product manual demands:5V±0.5V, larger than 150mA (peak current)*number of TF-Luna
  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 TF-Luna:

RNGFND1_ADDR=08 [Address of #1 TF-Luna in decimal]

RNGFND1_GNDCLEAR=25 [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 TF-Luna real orientation]

RNGFND1_TYPE = 25 [TF-Luna IIC same as TFmini-Plus IIC]

 

Settings for second TF-Luna:

RNGFND2_ADDR=09 [Address of #2 TF-Luna in decimal]

RNGFND2_GNDCLEAR=25

RNGFND2_MAX_CM=400

RNGFND2_MIN_CM=30

RNGFND2_ORIENT=25 [#2 TF-Luna real orientation]

RNGFND2_TYPE=25 [TF-Luna IIC same as TFmini-Plus IIC]

Upon setting of these parameters, click [Write Params] on the right of the software to finish the process.

If the error message “Bad LiDAR Health” or “Bad Proximity” 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:

 10995530864?profile=RESIZE_710x

 

Click button Proximity, the following window will appear:

 10995530899?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 The mission planner version at the time of writing this tutorial was v1.3.76.

Read more…

TF03 standard version comes with CAN interface and can be interfaced with PixHawk1 CAN port or any flight controller which has Ardupilot firmware flashed and having CAN interface. Support for CAN protocol has been added to Ardupilot firmwares, starting from Copter 4.2.0 for the purpose of obstacle avoidance and Altitude Hold.

  1. 1.  TF03-CANSettings:

It should be noted that TF03 has two different hardware versions for 485/RS232 and UART/CAN. So when  buying  LiDAR,  please  pay  attention  to  buy  LiDAR  with  CAN  interface  (standard  version). Multiple LiDARs can be interfaced to a single CAN bus. We need to assign different CAN IDs to each LiDAR just like we do for IIC communication. The baud-rate of each LiDAR needs to be set to the same value. On LiDAR side we have two types of CAN IDs:

    Send ID (Transmit CAN ID): it becomes Receive ID on CAN bus side (we need to set this ID

to a new value ifwe are connecting multiple LiDARs.)

    Receive ID: it becomes Send ID on CAN bus side

I will consider three LiDARs example but Ardupilot supports up to  10 sensors. The commands are mentioned in details in the manual of LiDAR but I will add them here for convenience. It is still advised to read the manual of LiDAR carefully there are important points.

5A 08 50 04 00 00 00 B6 [CHANGE SEND ID TO 04]

5A 08 50 05 00 00 00 B7 [CHANGE SEND ID TO 05]

5A 08 50 06 00 00 00 B8 [CHANGE SEND ID TO 06]

5A 05 45 02 A6 [CHANGE INTERFACE TO CAN]

5A 04 11 6F [SAVE SETTINGS]

5A 08 50 03 00 00 00 B5 [CHANGE RECEIVING ID BACK TO 03]

Some details about terminating resistor on LiDAR: Terminating resistor on LiDAR is connected by default, utilizing this resistor helps in reducing equivalent resistance of transmission wires, because adding more resistors in parallel will reduce the equivalent resistance. I have tested with total five LiDARs with all LiDARs having resistors enabled.

For sending the above commands, in case you dont have CAN analyzer and only have TTL-USB adapter, it is suggested that first configure the IDs and then switch the interface from UART to CAN because if you first switch interface then you cant use UART interface of LiDAR. In that case you have to use CAN analyzer to set different IDs. 

Once you are done with above settings then it’s time to move to physical connection and Ardupilot firmware settings.

We take three TF03-CAN as an example in this passage and set the addresses to 0x03 and 0x04 and 0x05 separately. The default sending ID of LiDAR is 0x03 so leave it for one LiDAR and configure for other two LiDARs to 0x04 and 0x05.

  1. 2.PixHawkConnection:

The following diagram shows how to interface TF03-CAN with PixHawk flight controller.

 10995521688?profile=RESIZE_710x

 

 

Figure 1: Schematic Diagram of Connecting TF03 to CAN Interface ofPixHawk1

Note

  1. 1.   Pleasepayattention to connect correct wire to correct pin of flight controller. Look at the pinout of controller, pin configurations are starting from left to right:

 10995522462?profile=RESIZE_400x

Figure 2: Pin details of CAN Interface ofPixHawk1

  1. 2.   Relatedconnectorsneed to be purchased by user, LiDAR connector is 7-pin JST with25mm pitch.
  2. 3.   IfLiDARfaces down, please take care the distance between lens and ground, it should be larger than LiDAR’s blind zone ( 10cm).
  3. 4.   IfmoreLiDARs need to be connected ( 10 LiDARs can be connected), the method is same.
  4.   Powersourceshould meet the product manual current and voltage requirement: 5V to 24V, larger than 150mA*number of LiDAR. I used 12V supply just for reference.
  5. 3.  Parameterssettings:

Common settings for obstacle avoidance :

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

UseProximitySensor]

AVOID_MARGIN = 4

PRX_TYPE = 4

Settings for CAN-1 port:

CAN_P1_DRIVER = 1

CAN_D1_PROTOCOL = 11

CAN_P1_BITRATE = [Baud-rate: For TF03 the baud-rate needs to be set to 1000000.]

In case of pixhawk1 we only have one CAN interface but if there are more than one interfaces then configure the parameters for CAN-2 interface. 

Settings for CAN-2 port:

CAN_P2_DRIVER = 1

CAN_D2_PROTOCOL = 11

CAN_P2_BITRATE = [Baud-rate: For TF03 the baud-rate needs to be set to 1000000.] 

Settings for first TF03:

RNGFND1_RECV_ID = 3 [CAN Transmit ID of #1 TF03 in decimal]

RNGFND1_GNDCLEAR=15 [Unit: cm, depending upon mounting height of the module and should be larger LiDAR than non-detection zone. This parameter is required to be configured for altitude hold, it is the installation height of LiDAR from ground.]

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 TF03 real orientation]

RNGFND1_TYPE = 34 [TF03 same as TF02-i and TFmini-i CAN] 

Settings for second TF03:

RNGFND2_RECV_ID = 4 [CAN Transmit ID of #2 TF03 in decimal]

RNGFND2_MAX_CM=400 

RNGFND2_MIN_CM=30

RNGFND2_ORIENT = 6 [#2 TF03 real orientation]

RNGFND2_TYPE = 34 [TF03 same as TF02-i and TFmini-i CAN] 

Settings for third TF03:

RNGFND3_RECV_ID = 5 [CAN Transmit ID of #3 TF03 in decimal]

RNGFND3_MAX_CM=400 

RNGFND3_MIN_CM=30

RNGFND3_ORIENT = 4 [#3 TF03 real orientation]

RNGFND3_TYPE = 34 [TF03 same as TF02-i and TFmini-i CAN] 

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:

 10995523652?profile=RESIZE_710x

 Click button Proximity, the following window will appear:

 10995523853?profile=RESIZE_584x

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 used at the time writing this tutorial is v1.3.72.

Altitude Hold using CAN Interface:

Let say we use fourth LiDAR for the purpose of Altitude Hold. 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 RNGFND4_ORIENT = 25]

RNGFND4_RECV_ID = 6 [CAN Transmit ID of #4 TF03 in decimal]

RNGFND4_GNDCLEAR = 15 [Unit: cm, depending upon mounting height of the module and should be larger LiDAR than non-detection zone. This parameter is required for Altitude Hold.]

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

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

RNGFND4_ORIENT = 25 [#4 TF03 real orientation]

RNGFND4_TYPE = 34 [TF03 same as TF02-i and TFmini-i CAN]

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:

 10995523879?profile=RESIZE_710x

 

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

picture:

 10995523891?profile=RESIZE_180x180

Read more…

Note: This document is applicable to Cube Orange and Cube Black flight controllers. The IIC interface available that can be used to connect multiple TF-Lunas is the same on both flight controllers. TF-Luna can be used with PixHawk Cube for the purpose of obstacle avoidance and Altitude Hold. But because it’s a short range sensor so in most cases it is used for obstacle avoidance.

  1. TF-Luna Settings:

Note: If there are any spikes while using the LiDAR as obstacle avoidance sensor then it is advised to change the frame rate to 250Hz, see the command details having command ID as 0x03 in the manual and for the sake of convenience configuring other parameters (like setting frame-rate, changing address etc.) in UART mode is recommended if you don’t have IIC-USB converter. A simple UART-USB adapter or board should work.

At the time of writing this document latest firmware was 3.3.0. For firmware upgrade please contact our technical support.

The default communication of TF-Luna is UART. LiDAR comes with a single cable. In order to use IIC the cable needs a little modification, details are mentioned in the coming paragraph. Please see TF-Luna IIC communication pin details as below:

10972789873?profile=RESIZE_710x

 

If we look at the pin configuration of TF-Luna, IIC can be set by grounding pin-5 in addition to the other four pins. For this purpose a customized cable is needed because in IIC mode we need to connect both pin-4 and pin-5 to the ground.

The modified cable is shown below. I have connected green wire (pin-4) and blue wire (pin-5) to single pin which will go to the GND pin of the source. Leave pin-6 connected. Please ignore the color standard in this case as black wire represents RXD/SDA while yellow wires represents TXD/SCL, just follow the pin numbering according to the user-manual.   

 10972790082?profile=RESIZE_710x

  

TF-Luna, TFmini-S, TFmini-Plus and TF02-Pro can be interfaced with IIC port of PixHak Cube Orange flight controller. Their settings are almost same. We take two TF-Luna LiDARs as example and set the addresses 0x08 and 0x09 separately.

  1. PixHawk Cube Connection:

We take PixHawk Cube Orange flight controller as an example:

 10972790471?profile=RESIZE_710x

 Figure 1: Schematic Diagram of Connecting TF-Luna to I2C Interface of PixHawk Cube

Note:

  1. Default cable sequence of TF-Luna and PixHawk Cube are different, please change it accordingly (SDA and SCL wires need to be interchanged). Look at the pinout of controller, pin configurations are:

10972790669?profile=RESIZE_710x

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

Select [CONFIG/TUNING] and then click on [Full Parameter List] in the left from the below bar. Find and modify the following parameters.

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 TF-Luna:

RNGFND1_ADDR=08 [Address of #1 TF-Luna in decimal]

RNGFND1_GNDCLEAR=25 [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 TF-Luna real orientation]

RNGFND1_TYPE = 25 [TF-Luna IIC same as TFmini-Plus IIC]

 

Settings for second TF-Luna:

RNGFND2_ADDR=09 [Address of #2 TF-Luna in decimal]

RNGFND2_GNDCLEAR=25

RNGFND2_MAX_CM=400

RNGFND2_MIN_CM=30

RNGFND2_ORIENT= 6 [#2 TF-Luna real orientation]

RNGFND2_TYPE=25 [TF-Luna IIC same as TFmini-Plus IIC]

Upon setting of these parameters, click [Write Params] on the right of the software to finish the process. After writing the parameters you need to power off the controller and then turn it on to apply the setting changes. If the error message “Bad LiDAR Health” or “Bad Proximity” appears, please check if the connection is correct and 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:

And click button Proximity, the following window will appear:10972790863?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. The mission planner version at the time of writing this tutorial was v1.3.76.

Read more…

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…