Keywords: OSDK waypoint v2, hovering actions implementation
Please refer to the following order to set the waypoint actions:
DJIWaypointV2AircraftControlFlyingParam, // stops flying
DJIWaypointV2IntervalTriggerParam, // interval time
DJIWaypointV2AircraftControlFlyingParam, // starts flying
DJIWaypointV2IntervalTriggerParam interval time parameter unit: 0.1s,
the maximum value that can be set is uint8: 255, that is, the maximum interval time is 25.5s
For example, Set hover for 5s:
associateTriggerParam.waitingTime = 50; //5s
(The following code is excerpted from the developer's own implementation code, not original. The implementation of this part of the code is easy to understand, for reference only)
std::vector<DJIWaypointV2Action> WaypointV2MissionSample::generateWaypointActions(uint16_t actionNum)
{
std::vector<DJIWaypointV2Action> actionVector;
#if 0
for(uint16_t i = 0; i < actionNum; i++)
{
DJIWaypointV2SampleReachPointTriggerParam sampleReachPointTriggerParam;
sampleReachPointTriggerParam.waypointIndex = i;
sampleReachPointTriggerParam.terminateNum = 0;
auto *trigger = new DJIWaypointV2Trigger(DJIWaypointV2ActionTriggerTypeSampleReachPoint,&sampleReachPointTriggerParam);
auto *cameraActuatorParam = new DJIWaypointV2CameraActuatorParam(DJIWaypointV2ActionActuatorCameraOperationTypeTakePhoto, nullptr);
auto *actuator = new DJIWaypointV2Actuator(DJIWaypointV2ActionActuatorTypeCamera, 0, cameraActuatorParam);
auto *action = new DJIWaypointV2Action(i, *trigger,*actuator);
actionVector.push_back(*action);
}
#endif
// pause when reach waypoint[1]
sampleReachPointTriggerParam.waypointIndex = 1;
sampleReachPointTriggerParam.terminateNum = 0;
trigger = new DJIWaypointV2Trigger(DJIWaypointV2ActionTriggerTypeSampleReachPoint,&sampleReachPointTriggerParam);
flyControlParam.isStartFlying = 0;
aircraftActuatorParam = new DJIWaypointV2AircraftControlParam(DJIWaypointV2ActionActuatorAircraftControlOperationTypeFlyingControl, &flyControlParam);
actuator = new DJIWaypointV2Actuator(DJIWaypointV2ActionActuatorTypeAircraftControl, 0, aircraftActuatorParam);
s = new DJIWaypointV2Action(action_id, *trigger,*actuator);
actionVector.push_back(*s);
action_id++;
delete trigger;
delete aircraftActuatorParam;
delete actuator;
delete s;
// resume after actions at waypoint[1]
associateTriggerParam.actionAssociatedType = DJIWaypointV2TriggerAssociatedTimingTypeAfterFinised;
associateTriggerParam.waitingTime = 50; //5s
associateTriggerParam.actionIdAssociated = action_id - 1;
trigger = new DJIWaypointV2Trigger(DJIWaypointV2ActionTriggerTypeActionAssociated,&associateTriggerParam);
flyControlParam.isStartFlying = 1;
aircraftActuatorParam = new DJIWaypointV2AircraftControlParam(DJIWaypointV2ActionActuatorAircraftControlOperationTypeFlyingControl, &flyControlParam);
actuator = new DJIWaypointV2Actuator(DJIWaypointV2ActionActuatorTypeAircraftControl, 0, aircraftActuatorParam);
s = new DJIWaypointV2Action(action_id, *trigger,*actuator);
actionVector.push_back(*s);
action_id++;
delete trigger;
delete aircraftActuatorParam;
delete actuator;
delete s;
return actionVector;
}
Note: This article is from Chinese and is translated by machine. If there is any suggestions, please point it out and we will correct it in time
Comments
0 comments
Please sign in to leave a comment.