Optical Flow Sensor Testing And Setup — Plane Documentation
Maybe your like
- Home
- Copter
- Plane
- Rover
- Blimp
- Sub
- AntennaTracker
- Mission Planner
- APM Planner 2
- MAVProxy
- Companion Computers
- Developer
- Downloads
- Mission Planner
- APM Planner 2
- Advanced User Tools
- Developer Tools
- Firmware
- Community
- Support Forums
- Developer Chat (Discord)
- Developer Voice (Discord)
- Contact us
- Getting involved
- Commercial Support
- Development Team
- UAS Training Centers
- Stores
- About
- News
- History
- License
- Trademark
- Acknowledgments
- Wiki Editing Guide
- Partners Program
- Introduction to Plane
- Choosing an Autopilot
- Ground Control Stations
- First Time Setup
- First Flight and Tuning
- QuadPlane Setup and Operation
- Mission Planning
- If A Problem Arises
- Advanced Configuration
- Peripheral Hardware
- ADS-B Receiver
- Airspeed Sensor
- AIS (Automatic Identification System)
- Barometer (external)
- BlackBox Logger using an AutoPilot
- Button Inputs
- Buzzer
- Cameras & Gimbals
- Companion Computers
- Display (Onboard)
- Drive Calculator Motor/Propeller Analyzer
- DroneCAN Adapter Node
- DroneCAN Peripherals
- ESCs and Motors
- Ethernet Adapters and Switches
- External AHRS Systems
- First Person View Video
- Fuel Flow and Level Sensors
- Generators
- GPS/Compass
- Grippers
- Joystick or Gamepad
- Landing Gear/ Retractable Camera Mount
- LEDs (external)
- On-Screen Display (OSD)
- Optical Flow Sensor
- Optical Flow Setup
- Testing the sensor
- Inflight Calibration
- Log based Calibration
- Range Sensor Check
- Pre-Arm checks
- First Flight
- Second Flight
- Setup for Normal Operation
- Example Video (Copter-3.4)
- ARK Flow
- ARK Flow MR
- Cheerson CX-OF
- HereFlow
- Holybro H-Flow
- Mateksys 3901-L0X
- MicoAir MTF-01
- OpenMV
- PX4FLOW
- UPixels UPFlow
- Optical Flow Setup
- Parachute
- Power Modules
- Power Tether
- PPM Encoder
- Radio Control Systems
- Rangefinders (Sonar, Lidar, Depth Cameras)
- Relay Switch
- Remote Id (aka Drone Id)
- RPM Sensor
- Safety Switch
- Servos and Actuators
- Smart Batteries
- Telemetry Radio
- Temperature Sensors
- Video (High Definition)
- Winch
- Additional Information
- User Alerts
- Advanced Configuration
- Optical Flow Sensors (landingpage)
- Optical Flow Sensor Testing and Setup
- Edit on GitHub
Testing the sensor¶
With the sensor connected to the autopilot, connect to the autopilot with the Mission Planner and open the Flight Data screen’s Status tab. If the sensor is operating you should see non-zero opt_m_x, opt_m_y and opt_qua values.
Inflight Calibration¶
If the vehicle has a GPS, the inflight calibration procedures is the easiest way to get a good calibration:
Set RCx_OPTION = 158 (Optflow Calibration) to allow starting the calibration from an auxiliary switch
Setup the EKF3 to use GPS (the default)
EK3_SRC1_POSXY = 3 (GPS)
EK3_SRC1_POSZ = 1 (Baro)
EK3_SRC1_VELXY = 3 (GPS)
EK3_SRC1_VELZ = 3 (GPS)
EK3_SRC1_YAW = 1 (Compass)
EK3_SRC_OPTIONS = 0 (Disable FuseAllVelocities)
Fly the vehicle in Loiter mode to at least 10m (higher is better but stay within the limits of the rangefinder)
Pull the auxiliary switch high to start the calibration
Use the roll and pitch sticks to rock the vehicle back and forth in both roll and pitch
Check the GCS “Messages” tab for output like below confirming the calibration is complete
Land the vehicle and setup the EKF3 to use OpticalFlow
EK3_SRC1_POSXY = 0 (None)
EK3_SRC1_VELXY = 5 (Optical Flow)
EK3_SRC1_POSZ = 1 (Baro)
EK3_SRC1_VELZ = 0 (None)
EK3_SRC1_YAW = 1 (Compass)
EK3_SRC_OPTIONS = 0 (Disable FuseAllVelocities)
Fly the vehicle again to check performance
An alternative method which avoids the need to land and change EKF3 parameters between calibration and testing is to setup GPS/Non-GPS transitions so the pilot can manually change between GPS and Optical Flow inflight. The full parameter list is below assuming the pilot will engage the calibration using RC input 8 (a 2-position switch) and switch between GPS and Optical flow using RC input 9 (a 3-position switch)
RC8_OPTION = 158 (Optflow Calibration)
RC9_OPTION = 90 (EKF Pos Source) low is GPS, middle is OpticalFlow, high is unused
EK3_SRC1_POSXY = 3 (GPS)
EK3_SRC1_POSZ = 1 (Baro)
EK3_SRC1_VELXY = 3 (GPS)
EK3_SRC1_VELZ = 3 (GPS)
EK3_SRC1_YAW = 1 (Compass)
EK3_SRC2_POSXY = 0 (None)
EK3_SRC2_VELXY = 5 (Optical Flow)
EK3_SRC2_POSZ = 1 (Baro)
EK3_SRC2_VELZ = 0 (None)
EK3_SRC2_YAW = 1 (Compass)
EK3_SRC_OPTIONS = 0 (Disable FuseAllVelocities)
Log based Calibration¶
To calibrate the sensor using Log file data please follow these steps:
Connect to your autopilot and ensure that logging while disarmed is enabled by setting LOG_DISARMED to 1
Find a location with a textured surface and good lighting (natural light or strong incandescent)
Remove Propellers (safety first)
Power on the vehicle and hold level away from your body and at eye level
Rotate about the vehicle in roll through a range from -15 to +15 degrees in about a second and then back again. Repeat this 5 to 10 times. By closing one eye you will be able to keep the centre of the sensor stationary against the background while you do the rotation.
Repeat about the vehicle pitch axis.
Download the data flash logs and plot the OF.flowX, OF.bodyX and IMU.GyrX data. It should look something like this:
If OF.flowX is larger or smaller than OF.bodyX, then it can be adjusted by changing the FLOW_FXSCALER parameter
IF OF.bodyX is uncorrelated or opposite sign to IMU.GyrX, the FLOW_ORIENT_YAW parameter is probably set incorrectly or you do not have the flow sensor pointing downwards
Plot the OF.flowY, OF.bodyYband, IMU.GyrY data. It should look something like this:
If OF.flowY is larger or smaller than OF.bodyY, then it can be adjusted by changing the FLOW_FYSCALER parameter
IF OF.bodyY is uncorrelated or opposite sign to IMU.GyrY, the FLOW_ORIENT_YAW parameter is probably set incorrectly or you do not have the flow sensor pointing downwards
Range Sensor Check¶
Check the EKF5.meaRng message in the flashlog from your flow sensor calibration test. Check the following:
There is continuous range measurement.
It outputs a range on the ground that is 10cm of the expected value (remember that measured range will increase when you roll or pitch the vehicle because the laser is then measuring on a slant)
Pre-Arm checks¶
To allow arming and taking off in Loiter without a GPS the GPS arming check should be turned off as shown below. Unchecking “All” and “GPS” and leave all other options checked.
First Flight¶
Set EK3_SRC1_VELXY = 0 (we don’t want the optical flow being used by the EKF at this stage)
Perform a short test flight hovering in STABILIZE or AltHold for copter, or QSTABILIZE or QHOVER for QuadPlane, at small lean angles at heights ranging from 50cm to 3m with
Download the flash log and plot the following in mission planner
EKF5.meaRng should correlate with the change in vehicle height
OF.flowX and OF.flowY should be varying
OF.bodyX and OF.bodyY should be consistent with IMU.GyrX and IMU.GyrY
Second Flight¶
Warning
You will need at least 15m of clear space around the vehicle to do this flight safely. If the optical flow velocity estimates are bad, you will have little warning and the copter may lean to its maximum lean angle very quickly.
Set EK3_SRC1_VELXY = 5 and EK3_SRC1_POSXY = 0 to make the EKF ignore GPS and use the flow sensor
Ensure you have a loiter and hover mode available on you transmitter.
Set “EKF Origin” on Ground Control Station map. In Mission Planner, right click, select “Set Home here”, and choose to set “set EKF origin here”.
Take-off in loiter and bring the Copter/QuadPlane to about 1m height
If the vehicle starts to accelerate away or there is erratic pitch or roll movement, then switch to hover and land. You will need to download the log file and share it on the forums to understand why.
If it holds location then congratulations, you have succeeded and can now start experimenting with height changes and moving it around in the loiter mode
[/site]
Setup for Normal Operation¶
Set EK3_SRC_OPTIONS = 0 to disable FuseAllVelocities
Set EK3_FLOW_DELAY depending on your optical flow sensor
Set EK3_SRC1_POSXY = 3 (Primary horizontal position from GPS, set this to 0 to only use the optical flow sensor)
Set EK3_SRC1_VELXY = 5 (Primary horizontal velocity from OpticalFlow)
Set EK3_SRC1_POSZ = 1 (Primary vertical position from barometer)
Set EK3_SRC1_VELZ = 0 (No primary vertical velocity sensor)
Set EK3_SRC1_YAW = 1 (Primary yaw/heading from compass)
Alternatively, GPS can work with OpticalFlow using EKF source switching.
See GPS / Non-GPS Transitions for information on EKF source switching.
Note
When Copters have an optical flow sensor enabled (along with a rangefinder) and it is specified as the only horizontal position source (e.g. EK3_SRCx_VELXY``=OpticalFlow and ``EK3_SRCx_POSXY``=None) and the vehicle is flying in a pilot controlled mode requiring a position estimate (ie Loiter or PosHold) the vehicle will not climb above the rangefinder's maximum altitude specified in ``RNGFNDx_MAX. This is a safety mechanism because otherwise the EKF failsafe would trigger as the vehicle flew out of rangefinder range.
Example Video (Copter-3.4)¶
Tag » Ardupilot Px4 Flow
-
PX4FLOW Optical Flow Camera Board — Copter Documentation
-
Ardupilot_wiki_copy/common-px4flow-t At Master - GitHub
-
PX4FLOW Smart Camera - PX4 User Guide
-
HereFlow Optic Flow Lidar Module For Ardupilot/PX4
-
Capteur De Flux Optique PX4FLOW V1.3.1, Caméra ... - AliExpress
-
Capteur De Flux Optique Px4flow V1.3.1, Caméra ... - AliExpress
-
Holybro PX4FLOW KIT Optical Flow Sensor Smart Camera With ...
-
PX4 - Bountysource
-
Px4Flow On Cube?
-
ArduPilot/Hardware - Gitter
-
Firmware · QGroundControl User Guide
-
Install PX4Flow Optical Flow Sensor On ArduPilot Rotorcraft - Actorsfit