GOPRO: Add photo logging output for Solex GCS app

The Solex GCS app has a photo logging function for missions and geo
tagging.  This sends the applicable data from the Solo to the app.
This commit is contained in:
Matt 2017-12-16 11:02:16 -05:00
parent 49b199ea64
commit 19ea16784c
2 changed files with 34 additions and 0 deletions

View File

@ -352,6 +352,11 @@ class GoProManager():
self.queueMsg(msg) self.queueMsg(msg)
if self.captureMode == CAPTURE_MODE_PHOTO:
if command == mavutil.mavlink.GOPRO_COMMAND_SHUTTER:
if value[0] == 1:
self.sendPhotoEvent()
# Follow up with a get request if notification of change is required # Follow up with a get request if notification of change is required
if command in REQUERY_COMMANDS: if command in REQUERY_COMMANDS:
self.sendGoProRequest(command) self.sendGoProRequest(command)
@ -472,6 +477,34 @@ class GoProManager():
(command, value1, value2, value3, value4, ) = struct.unpack("<HBBBB", data) (command, value1, value2, value3, value4, ) = struct.unpack("<HBBBB", data)
self.sendGoProCommand(command, (value1, value2, value3, value4)) self.sendGoProCommand(command, (value1, value2, value3, value4))
# Send a photo event with current time and location.
def sendPhotoEvent(self):
now = monotonic.monotonic()
logger.log("[gopro]: send photo event. now is %d"%now)
if self.shotMgr.vehicle.location.global_relative_frame is not None:
pkt = struct.pack("<IIddfI", app_packet.GOPRO_PHOTO, 24,
self.shotMgr.vehicle.location.global_relative_frame.lat,
self.shotMgr.vehicle.location.global_relative_frame.lon,
self.shotMgr.vehicle.location.global_relative_frame.alt,
monotonic.monotonic())
self.addPhotoLog(
self.shotMgr.vehicle.location.global_relative_frame.lat,
self.shotMgr.vehicle.location.global_relative_frame.lon,
self.shotMgr.vehicle.location.global_relative_frame.alt,
monotonic.monotonic())
else:
pkt = struct.pack("<IIddfI", app_packet.GOPRO_PHOTO, 24, 0, 0, 0, monotonic.monotonic())
self.shotMgr.appMgr.sendPacket(pkt)
# Add an entry to /log/photo.log
def addPhotoLog(self, lat, lon, alt, time):
f = open("/log/photo.log", "a")
f.write("%.6f,%.6f,%.3f,%d\n" % (lat, lon, alt, time))
f.close();
# packages up our entire current state and sends it to the app # packages up our entire current state and sends it to the app
def sendState(self): def sendState(self):

View File

@ -82,6 +82,7 @@ GOPRO_V1_STATE = 5005
GOPRO_V2_STATE = 5006 GOPRO_V2_STATE = 5006
GOPRO_REQUEST_STATE = 5007 GOPRO_REQUEST_STATE = 5007
GOPRO_SET_EXTENDED_REQUEST = 5009 GOPRO_SET_EXTENDED_REQUEST = 5009
GOPRO_PHOTO = 5020 # Added to Open Solo for solex app photo logging
# enums for packet types # enums for packet types