Matek
MTF-01P is an optical flow ranging integrated sensor developed by MicoAir Technology. It uses uart to output data and is compatible with mainstream open source flight controllers such as Ardupilot, PX4 and INAV. It can be used directly after simple configuration without complicated development process.
MTF-01P features an integrated PMW3901 optical flow sensor and a high-performance Laser TOF sensor, which can be used normally in outdoor sunlight environments.
The micolink is a lightweight protocol customized by MicoAir Tech, prepared for developers who are ready to write their own code to read sensor data.
Decoding Micolink Messages from MTF-01 – MicoAir Tech
Step 1:
Configure the MTF-01 output protocol as “mav_apm”, by using MicoAssitant.
Step 2:
Connect the MTF-01 module to the serial port of the flight controller, such as Telem2 on pixhawk.
Step 3:
Configure these parameters in the Mission Planner
SERIALn_BAUD 115
SERIALn_OPTIONS 1024
SERIALn_PROTOCOL 1
FLOW_TYPE 5
RNGFND1_TYPE 10
n depends on which serial port the MTF-01 connected, for example, n=2 when it connect to Telem2.
Step 4:
After that, we need to reboot the flight controller or just refresh the parameters in Mission Planner.
And then these parameters need to be configured.
RNGFND1_MAX_CM 800
RNGFND1_MIN_CM 1
RNGFND1_ORIENT 25
When you complete the above steps, you should be able to observe the optical flow and range sensor data on the Mission Planner’s “Status” page. The “opt_qua” and “rangefinder1” should have some value.
Step 5:
After the flight controller has recognized MTF-01, we need to perform some configurations so that the sensor data can be used in EKF fusion.
If you just need to use optical flow to fly indoors and don’t consider using GPS outdoors, then you only need to configure EK3_SRC1.
AHRS_EKF_TYPE 3
EK3_SRC_OPTIONS 0
EK3_SRC1_POSXY 0
EK3_SRC1_POSZ 2
EK3_SRC1_VELXY 5
EK3_SRC1_VELZ 0
EK3_SRC1_YAW 1
But if you need to take into account both indoor and outdoor environments, then you may need to use a method that can switch the EK3 data source. Keep the EK3_SRC1 as default, and set EK3_SRC2 as follows.
AHRS_EKF_TYPE 3
EK3_SRC_OPTIONS 0
EK3_SRC2_POSXY 0
EK3_SRC2_POSZ 2
EK3_SRC2_VELXY 5
EK3_SRC2_VELZ 0
EK3_SRC2_YAW 1
Then set the RC6 channel to switch using optical flow as EKF3 source.RC6_OPTION 90
Now you can use RC6 channel to switch between using SRC1 or SRC2 as the data source of EK3.
When the RC6 value is in the low position, SRC1(GPS) will be used, and in the middle position, SRC2(Optical flow)will be use.
Step 6:
When all settings are completed, switch to loiter mode, unlock and take off.
Sometimes the flight controller may not be allowed to unlock in Loiter mode when the sensor is too close to the ground. You can unlock it in Althold mode and then switch to Loiter mode after taking off.
Setup Optic Flow&Lidar(MTF-01) For INAV6 To Make Drones Hover And Fly Indoors Better (youtube.com)
Note: INAV 7.1.1 may have some bugs that can not work properly with the sensor. You need to upgrade to version 7.1.2 which have been tested well.
MAV_1_CONFIG TELEMn
(n depends on which serial port you connect to)
Reboot the flight controller
MAV_1_MODE Normal
SER_TELn_BAUD 115200 8N1
SENS_FLOW_ROT No rotation
EKF2_AID_MASK use optical flow
EKF2_RNG_AID Range aid enable
EKF2_HGT_MODE Range sensor
MAV_1_CONFIG TELEMn
(n depends on which serial port you connect to)
Reboot the flight controller
MAV_1_MODE Normal
SER_TELn_BAUD 115200 8N1
EKF2_OF_CTRL Enabled
EKF2_RNG_CTRL Enabled
EKF2_HGT_REF Range sensor
Reboot the flight controller
SENS_FLOW_ROT No rotation