Getting state from "moveToChanged"
See original GitHub issueHello, first, thank you for the code! It’s really helping me with my thesis.
I’m working with a Bebop 2 and have a question about moving the drone to GPS coordinates. I’ve made some code that uses the “moveTo” command to make the drone reach a specific coordinate. I was wondering if I could ask the bebop whether it has reached its destination coordinate. I currently have no way of knowing when the drone actually reaches that point. Since I noticed in the code that you ask for “AllStates” (in common.xml, common class, AllStates cmd), I thought you might know how to go about this.
I’ve figured out there is a command that seems to poll for a “moveToChanged” state. Refer to the following code (in ardrone3.xml, PilotingState class, moveToChanged cmd):
<cmd name="moveToChanged" id="12">
<comment
title="Move to changed"
desc="The drone moves or moved to a given location."
support="090c:4.3.0"
triggered="by [MoveTo](#1-0-10) or when the drone did reach the given position."/>
<arg name="latitude" type="double">
Latitude of the location (in degrees) to reach
</arg>
<arg name="longitude" type="double">
Longitude of the location (in degrees) to reach
</arg>
<arg name="altitude" type="double">
Altitude above sea level (in m) to reach
</arg>
<arg name="orientation_mode" type="enum">
Orientation mode of the move to
<enum name="NONE">
The drone won't change its orientation
</enum>
<enum name="TO_TARGET">
The drone will make a rotation to look in direction of the given location
</enum>
<enum name="HEADING_START">
The drone will orientate itself to the given heading before moving to the location
</enum>
<enum name="HEADING_DURING">
The drone will orientate itself to the given heading while moving to the location
</enum>
</arg>
<arg name="heading" type="float">
Heading (relative to the North in degrees).
This value is only used if the orientation mode is HEADING_START or HEADING_DURING
</arg>
<arg name="status" type="enum">
Status of the move to
<enum name="RUNNING">
The drone is actually flying to the given position
</enum>
<enum name="DONE">
The drone has reached the target
</enum>
<enum name="CANCELED">
The move to has been canceled, either by a CancelMoveTo command
or when a disconnection appears.
</enum>
<enum name="ERROR">
The move to has not been finished or started because of an error.
</enum>
</arg>
</cmd>
However, in contrast to the AllStates cmd, this cmd seems to require arguments (refer the the snippet below).
<cmd name="AllStates" id="0" timeout="RETRY">
<comment
title="Ask for all states"
desc="Ask for all states.\n\n
**Please note that you should not send this command if you are using the\n
libARController API as this library is handling the connection process for you.**"
support="drones"
result="The product will trigger all states events (such as [FlyingState](#1-4-1) for the Bebop).\n
Then, it will trigger [AllStatesEnd](#0-5-0)."/>
</cmd>
I tried to pass no arguments, to see what it gives. In following snippet you can see how I did this.
def ask_for_move_to_status(self):
command_tuple = self.command_parser.get_command_tuple("ardrone3", "PilotingState", "moveToChanged")
return self.drone_connection.send_noparam_command_packet_ack(command_tuple)
This doesn’t really return anything. I was wondering if you know whether the “moveToChanged” cmd is a valid way for retrieving the state. If so, then should I pass parameters and what should I pass? Or how would I go about this? Any help or advice would be much appreciated! Thanks in advance.
Issue Analytics
- State:
- Created 5 years ago
- Comments:16 (4 by maintainers)
@Cozmo25 I wrote this function (and it worked for me):
First I let the drone take off (by using
bebop.safe_takeoff()
), then I could usemove_to_coord()
along with some coordinates. Please don’t ask me anything specific about the code, as it has been a while since I’ve played around with it 😅The sensors dictionary has everything the drone sends back! I save it EVERY time it sends stuff. I only made special variables for the ones I used a lot. I may well add more this summer as we are moving to a bebop project from a mambo only project.