Sequence of MoveTo Commands

Hi,

I am trying to create a sequence of MoveTo commands in Olympe. I have 6 GPS coordinates and I want the drone to visit each in order before returning to the first point. However, when I run the code, the drone only visits the first point. No matter what I try, I can’t seem to get it to visit a point then visit the next point. Below is how I’m currently structuring my sequence of moveTo commands (I have included 2 of the 6). Any help is greatly appreciated! For reference, I’ve tried adding a FlyingStateChanged hovering check in between commands following the suggestion of another post but it didn’t help.

EDIT: I have run the script through Sphinx and it works perfectly. Yet when I run it on a real drone it still doesn’t work.

import olympe                                           
from olympe.messages.ardrone3.Piloting import TakeOff, Landing, moveTo                                          
import olympe.enums.move as mode                        
from olympe.messages.ardrone3.PilotingState import FlyingStateChanged, moveToChanged                            
from olympe.enums.ardrone3.PilotingState import MoveToChanged_Status as status                                                                                           
drone(                                                      
  moveTo(40.4155755, -79.9494166, 6.0, mode.orientation_mode.to_target, 0.0)                                      
  >> moveToChanged(latitude=40.4155755, longitude=-79.9494166, altitude=6.0, orientation_mode=mode.orientation_mode.to_target, status=status.DONE)
).wait().success()                                                                                              
drone(                                                      
  moveTo(40.4152855, -79.949717, 6.0, mode.orientation_mode.to_target, 0.0)                                       
  >> moveToChanged(latitude=40.4152855, longitude=-79.949717, altitude=6.0, orientation_mode=mode.orientation_mode.to_target, status=status.DONE)
).wait().success()

I had the same problem before. The cause, which I suspect to be same for you, was that the latitude, longitude and altitude values in the moveToChanged event should not match exactly those in the moveTo command because of the lack in precision in floating point comparison.

Please see https://forum.developer.parrot.com/t/moveto-works-in-simulator-but-not-in-drone-field-test/10052/2?u=danielizham

Taking the first command as an example, try this instead:

drone(                                                      
  moveTo(40.4155755, -79.9494166, 6.0, mode.orientation_mode.to_target, 0.0)                                      
  >> moveToChanged(status=status.DONE, _timeout=10)
).wait().success()
1 Like

Hi,

Has this been solved ?

This topic was automatically closed after 30 days. New replies are no longer allowed.