Hello Navin,
From the example model that you were referring to which is compatible with Parrot Mambo drones i.e. https://www.mathworks.com/help/supportpkg/parrot/ref/follow-waypoints-parrot-drone.html, to implement a hover functionality at each waypoint. Some possible ways that this functionality can be achieved in the model referred is by either integrating a timer or state-machine logic in the “Waypoint Follower” subsystem that controls the progression between waypoints. Here is an overview of the steps that can be followed:
- Change the waypoint dataset either by adding another column in the existing vector array or modify its data structure to contain the information of hover duration on each waypoint.
- Implement the state machine using a Stateflow Chart, that creates three states (MovingToWaypoint, Hovering, ProceedToNextWaypoint) satisfying the use case
- For the timer functionality, you can either use a delay block in the model or a counter that updates at every time step and cross-references the hover duration added in the waypoint data for determining the state change.
Here is the pseudocode for the state machine controlling the transition and progression between waypoints:
state = MovingToWaypoint
timer = 0
while flying
switch state
case MovingToWaypoint
if reachedCurrentWaypoint()
state = Hovering
timer = 0
end
case Hovering
maintainCurrentPosition()
timer = timer + timeStep
if timer >= hoverDuration
state = ProceedToNextWaypoint
end
case ProceedToNextWaypoint
goToNextWaypoint()
if startedMovingToNextWaypoint()
state = MovingToWaypoint
end
end
end
Additionally, you can also refer to this video on the MathWorks Help Center to learn more about hovering drones:
Hope this helps!