Writing telemetry data (specifically, depth) to gopro video?

Has anyone worked out a system for writing telemetry data onto the frames of a gopro video? We have everything working in our new BlueROV2, but we want to use gopro video for analysis (we need the highest quality we can get, for counting fairly small organisms such as ascidians), and we want to be able to see the depth on each frame. This sounds like a fairly basic thing, but it’s my first time working with .tlog files.

I’ve converted a .tlog file to .csv using TLogtoCSV.jar from Telemetry Log to CSV | blog.markbrown.space. I’m pretty sure I can figure out how to write data to a gopro video frame-by-frame using a python script, once I know what the data mean (I’ve done similar things with OpenROV video before). In the .csv file, I have lines like these:

1512474933651 MAVLINK_MSG_ID_SCALED_PRESSURE - time_boot_ms:4325330 press_abs:1030.7413 press_diff:7.6991405 temperature:3952 Tue Dec 05 11:55:33 GMT 2017 29
1512474933651 MAVLINK_MSG_ID_SCALED_PRESSURE2 - time_boot_ms:4325330 press_abs:1031.6 press_diff:33.64 temperature:896 Tue Dec 05 11:55:33 GMT 2017 137

Is one of those things going to give me depth, if I know the salinity of the water I’m in? At the moment I don’t even know the units of the numbers I’m looking at, although I’m sure it will be obvious to someone.

Units/meanings of each of the fields are here: http://mavlink.org/messages/common.

You can derive the depth yourself using the reported absolute pressure, or use the GLOBAL_POSITION_INT.alt field, which is the depth that the autopilot calculates using the specified GND_SPEC_GRAV parameter for the specific gravity of the fluid you are diving in.

Another useful tool for extracting/filtering data from logs is mavlogdump.py, which is included with a pymavlink installation.

ex.

$ mavlogdump.py --types=GLOBAL_POSITION_INT --format=csv 2017-10-25_14-21-23.tlog
timestamp,GLOBAL_POSITION_INT.time_boot_ms,GLOBAL_POSITION_INT.lat,GLOBAL_POSITION_INT.lon,GLOBAL_POSITION_INT.alt,GLOBAL_POSITION_INT.relative_alt,GLOBAL_POSITION_INT.vx,GLOBAL_POSITION_INT.vy,GLOBAL_POSITION_INT.vz,GLOBAL_POSITION_INT.hdg
1508933673.10899997,1294872,0,0,-2590,-2590,26,-47,62,9595
1508933674.00099993,1295863,0,0,-2410,-2410,41,-64,59,9522
1508933674.22399998,1296103,0,0,-2420,-2420,44,-72,53,9469
1508933674.46199989,1296343,0,0,-2440,-2440,46,-77,48,9401
1508933674.71099997,1296583,0,0,-2460,-2460,49,-80,45,9348
...

Thank you. That looks like exactly what we need.

One more question: to synchronize the depth information with the Gopro video, I need to set the system time on the ROV. Is there a way to do that through QGroundControl?

Currently the only way to set the system time of the ROV is to aquire a GPS lock. We should have another way.
https://github.com/bluerobotics/ardusub/issues/131

Hey Jacob, just following up on this. The github link is a 404 now, which makes me think you fixed that issue. Could you update? Thanks heaps! Ben

Hi @bjcresswell,

The 404 there is because the old bluerobotics/ardusub repository ended up merged into the mainstream ardupilot/ardupilot repository, and the old repo no longer stores issues.

From a practical standpoint, it’s now possible to use MAVLink’s SYSTEM_TIME message, which needs to be enabled as a clock source in the autopilot using the BRD_RTC_TYPES parameter (e.g. set it to 2 if you aren’t planning to use a GPS, and don’t have a hardware clock - the default BlueROV2 parameters set it to 3 (0b011), which is MAVLink / GPS).

If you want to read through the full history/discussion then here’s the initial fix PR :slight_smile: