Please select Into the mobile phone version | Continue to access the computer ver.
Close
You need to log in before you can reply       Login | Register now

[Help] Wait After Sending Nav Command [Python]

Author: mndimuro 2017-6-9 07:45
3 142
Last edited by mndimuro In 2017-6-9 07:48 Editor

Hi I have a development question - could be a bug:

I wrote a client in Python using the ROS libraries. I'm able to arm, disarm, obtain and release control, etc.

However when I do something like:
drone.global_position_navigation_send_request(drone.global_position.latitude, drone.global_position.longitude, 3)
drone.global_position_navigation_send_request(drone.global_position.latitude + 0.0005, drone.global_position.longitude, 3)
# DO SOMETHING ELSE AFTER WE GET HERE
drone.global_position_navigation_send_request(drone.global_position.latitude, drone.global_position.longitude, 1)
drone.global_position_navigation_send_request(drone.global_position.latitude, drone.global_position.longitude, 3)
# DO SOMETHING ELSE AFTER WE GET HERE
drone.global_position_navigation_send_request(drone.global_position.latitude - 0.0005, drone.global_position.longitude, 3)

The application isn't waiting for the drone to arrive at the requested location before executing the next command in line. How can I syncronize these requests. It's extremely similar to Waypoint route but I need to add some other functionality between these navigation requests.
Reply
Replies
c.jagielski
Seems like the drone takes in all of those requests and just reads them in rapid fire.  Maybe you do need to use a waypoint mode, or use the API differently somehow...

This might not be elegant but it could help:

1) query drone's current position
2) send drone to a new position
3) poll on it's position until it arrives at the new location
4) now you can send it to the second location
2017-6-10 06:06
mndimuro
c.jagielski Posted at 2017-6-10 06:06
Seems like the drone takes in all of those requests and just reads them in rapid fire.  Maybe you do ...

I've tried an implementation similar to what you've suggested.

I wrote a function I called bool:atLocation(loc) that returns false until the drones location matches the location I'm looking reach.

Here's what I did:
navToLocation(location)
while(!atLocation(location)) {
time.sleep(4)
}

Still no luck. Regardless, this can't be the proper implementation - which I would like to find.
2017-6-10 12:32
c.jagielski
My best guess is that the proper implementation is to use Waypoints.  Surely the Waypoint API can take in multiple position destinations in succession and create a "flight path" of sorts that executes as you would expect.  I'm no expert but isn't this already a feature in the DJI GO app?  Maybe you can find some help in the Mobile SDK, DJI might only support this feature there.
2017-6-13 01:58
You need to log in before you can reply Login | Register now

Quick Reply Back to top Back to list
Quick Reply Back to top Back to list