Capturing photos during a mission

Hi.

I’m having some odd issues when creating and running a custom made photogrammetry mission.
I have created the mission using the Ground SDK for iOS. Running the mission in the Sphinx simulator works fine, the mission uploads and executes as expected. But when running the mission for real, no photos are taken. Looking in the logs where we print the Camera2PhotoCaptureState it shows that the photo capture was stopped with reason errorInternal. No more useful information can be found so I’m at a loss at what could be wrong.

When we run the mission with Sphinx we connect an iPad directly to the drone’s WiFi, but when we run ‘live’ we are connected via the remote controller. Could that be an issue?
Do we need to set up the drone with any special parameters or are we missing a step somewhere?

The steps we take are the following:
Create the mission:

...
var commands = [MavlinkStandard.MavlinkCommand]()

commands.append( // Home point
    MavlinkStandard.NavigateToWaypointCommand(
        latitude: startLat,
        longitude: startLon,
        altitude: 110,
        yaw: 0,
        holdTime: 0,
        acceptanceRadius: 2
    )
)

commands.append( // Mission Start point
    MavlinkStandard.NavigateToWaypointCommand(
        latitude: <coordinate lat>,
        longitude: <coordinate lon>,
        altitude: 110,
        yaw: 0,
        holdTime: 0,
        acceptanceRadius: 2
    )
)

commands.append(
    MavlinkStandard.MountControlCommand(
        tiltAngle: -90,
        yaw: 0,
        mode: .targeting
    )
)

commands.append(
    MavlinkStandard.DelayCommand(delay: 1)
)

commands.append(
    MavlinkStandard.SetViewModeCommand(
        mode: .absolute
    )
)

commands.append(
    MavlinkStandard.ChangeSpeedCommand(
        speedType: .groundSpeed,
        speed: 5,
        relative: false
    )
)

commands.append(
    MavlinkStandard.CameraTriggerDistanceCommand(
        distance: 20, triggerOnceImmediately: true
    )
)

commands.append(
    MavlinkStandard.NavigateToWaypointCommand(
        latitude: <coordinate lat>,
        longitude: <coordinate lon>,
        altitude: 110,
        yaw: 0,
        holdTime: 0,
        acceptanceRadius: 2
    )
)

commands.append( // Last mission waypoint
    MavlinkStandard.NavigateToWaypointCommand(
        latitude: <coordinate lat>,
        longitude: <coordinate lon>,
        altitude: 110,
        yaw: 0,
        holdTime: 0,
        acceptanceRadius: 2
    )
)

commands.append(
    MavlinkStandard.StopPhotoCaptureCommand()
)

commands.append( // Look at home pos to avoid collision
    MavlinkStandard.SetRoiLocationCommand(
        latitude: startLat,
        longitude: startLon,
        altitude: 0
    )
)

commands.append(
    MavlinkStandard.SetViewModeCommand(
        mode: .roi
    )
)

commands.append( // Home point
    MavlinkStandard.NavigateToWaypointCommand(
        latitude: startLat,
        longitude: startLon,
        altitude: 110,
        yaw: 0,
        holdTime: 0,
        acceptanceRadius: 2
    )
)

commands.append(
    MavlinkStandard.ReturnToLaunchCommand()
)

commands.append(
    MavlinkStandard.SetRoiNoneCommand()
)

commands.append(
    MavlinkStandard.MountControlCommand(
        tiltAngle: 0,
        yaw: 0,
        mode: .targeting
    )
)

commands.append(
    MavlinkStandard.LandCommand()
)
...

where coordinate lat and coordinate lon makes up some valid coordinates that are around 40 m apart from each other, startLat and startLon is roughly where the drone starts

Generate and upload the MavLink file:

...
MavlinkStandard.MavlinkFiles.generate(filepath: filePath, commands: commands)
...
flightPlanItf.uploadFlightPlan(filepath: filePath)
... (after a few seconds)
flightPlanItf.activate(restart: false, interpreter: .standard)

During the execution while running the simulator we get state updates that photo capture has started and updates with the remaining distance to the next photo. But as stated earlier when running the mission for real, we log a state like: Photo capture started 0 Optional(removable) 2022-07-19 09:08:21 +0000 and shortly after we get a Photo capture stopping with reason errorInternal.
After the mission we run for real has executed, no flight logs can be found in the FreeFlight app either. Do we have to manually tell the drone that we are starting a new flight or is that handled automatically?

Any help or pointer to what is needed to get this to work would be greatly appreciated!

Thanks,
Adrian.

Seems like this was en easy fix. Adding a SetStillCaptureModeCommand has solved the issue. Though the photos are saved to the SD-card, no flight log is recorded. Is there any way to create a flight log?

@adrianrosen what library did you use to create mavlink commands from your code? Is this pymavlink?

Hi!

I’m using the iOS version of the Ground SDK.

/Adrian

1 Like