This WG has now been archived / closed.
The MAVLink camera working groups main purpose is to facilitate the integration of camera systems into autopilots running MAVlink Communications. The main idea is to provide a set of rules for cameras that want to support a MAVlink interface so that we have a common set of commands that autopilots and groundstations can implement and that MAVlink enabled cameras can understand.
This guide will show you how to get started implementing this messages, what connections need to be made, what messages should be implemented, how they should be interpreted, and where to find resources and examples.
System Diagram
Connections
Protocol Overview
Heartbeat message
Mavlink Routing
Ping Message
Messages sent by the Autopilot
Messages that should be sent by the camera
Testing the camera
Geotagging
Accurate Camera Feedback
Mission Items and Triggering methods
Insert picture here
The camera should usually be connected to one of the Telemetry ports (UART), these ports are bi-directional and can be configured for baudrate and protocol. The protocol should be set to MAVlink and the baudrate should match the cameras baudrate.
For TELEM1, and TELEM2
Pin | Signal | Volt |
---|---|---|
1 (red) | VCC | +5V |
2 (blk) | TX (OUT) | +3.3V |
3 (blk) | RX (IN) | +3.3V |
4 (blk) | CTS (IN) | +3.3V |
5 (blk) | RTS (OUT) | +3.3V |
6 (blk) | GND | GND |
For Serial 4/5 (two ports on one connector)
Pin | Signal | Volt |
---|---|---|
1 (red) | VCC | +5V |
2 (blk) | TX Serial 4 (OUT) | +3.3V |
3 (blk) | RX Serial 4 (IN) | +3.3V |
4 (blk) | TX Serial 5 (OUT) | +3.3V |
5 (blk) | RX Serial 5 (IN) | +3.3V |
6 (blk) | GND | GND |
Please keep in mind that the autopilot may not provide enough power to your camera, TELEM2 provides up to 1A, and the others only provide up to 500mA
The serial connection is all that is needed to be able to control the camera and send feedback and status messages back to the autopilot.
In case the camera does not geotag the images and a more precise geotag is desired, you can feedback a signal from the camera to tell the autopilot the exact moment the sensor on the camera is exposed. If the camera is equiped with a hotshoe, the signal from the hotshoe can be used for this. This enables high presicion systems using RTK or other cm level GPS to more accurately geotag the images. More on that later.
The MAVLink protocol incorporates some routing rules that tell the receivers if the message is meant for them. These rules are also used by the autopilot to decide if a message should be acted upon by the autopilot, or forwarded to another telemetry port. Two values are the most important for this, target_system and target_component. You can think of the target_system as the drone, every component onboard that drone should have its target system set to the same number, while the target_component value would vary on each component.
When the flight controller receives a message, it will forward it to a different port if the following conditions are met:
The message has no target_system field The message has a target_system field of zero The message does not have the flight controllers target_system and the flight controller has seen a message from that target system on that port The message has the flight controllers target_system and has a target_component that the flight controller has seen a message from on that port
This means that in order for the flight controller to know that a certain component is present it must see a message from that component on the port its connected to. The most common way of making sure the routing is set up is to send a heartbeat message so that the route is learned.
It is also important the the camera has a way of setting up its target_system value and target_component value. There is a list of valid target_component (MAV_COMPONENT) values on the MAVLink Common Message set specification. The value ID for a MAV_COMP_ID_CAMERA is 100. If multiple cameras are used, each should have its own target_component id if it needs to be talked to independently.
It is recommended that the component send out a heartbeat message once per second and populated with the appropriate values in order for the system to be able to tell if it is functioning properly.
–Insert Heartbeat Description–
The autopilot provides a lot of important information to its components. This includes, position information, status information, camera commands, among others. Your system can benefit from receiving these messages and can use them to trigger the camera, change settings, write position information to the EXIF headers, etc. The following list are some of the message you may benefit from but you might find a lot more on the MAVLink wiki
==== The MAVLink camera working group can be reached on the Dronecode Discussion Forum.
WARNING! Work in progress
The camera trigger is a component running on a peripheral or the autopilot itself.
Send a one-time command or include a MISSION_ITEM in the MAVLink mission with the DO_SET_CAM_TRIGG_DIST command. The vehicle should interpret this as enabling the trigger once reaching this MISSION_ITEM and triggering every X meters from that point on (according to the parameters). Send the DO_TRIGGER_CONTROL to disable.
Send a one-time command or include a MISSION_ITEM in the MAVLink mission with the DO_TRIGGER_CONTROL command.