Building on the HelloDrone example, how do we use the default take-off mode? For example, suppose we want the drone to take off right after doing the “hello” nod. I believe the general idea is to insert Where would the message go, and what message should be used? And we would not need to write a new “takeoff” folder under fsup, since we’re using default, correct?
Here is what I’ve tried, which isn’t working:
First, I added transitions to know when “hello” is complete and to enable takeoff from hello complete, so this is my complete list of transitions in mission.py:
TRANSITIONS = [
# "say/hold" messages from the mission UI alternate between "say"
# and "idle" states in the ground stage.
[
msg_id(hello_messages.Command, "say"),
"ground.idle",
"ground.say",
],
[
msg_id(hello_messages.Command, "hold"),
"ground.say",
"ground.idle",
],
[
msg_id(hello_messages.Command, "complete"),
"ground.idle",
"ground.complete",
],
[
msg_id(ui_messages.Command, 'take_off'),
'ground.complete',
'takeoff.normal',
],
]
I added a new guidance mode under ground stage.py, so this is the bottom of that file:
@guidance_modes(_GROUND_MODE_NAME)
class Complete(State):
def enter(self, msg):
self.log.info("entered complete guidance mode")
self.set_guidance_mode(
_GROUND_MODE_NAME, hello_gdnc_mode_messages.Config(complete=True)
)
IDLE_STATE = {
"name": "idle",
"class": Idle,
}
SAY_STATE = {
"name": "say",
"class": Say,
}
COMPLETE_STATE = {
"name": "complete",
"class": Complete,
}
GROUND_STAGE = {
"name": "ground",
"class": DEF_GROUND_STAGE["class"],
"initial": "say",
"children": [
child
for child in DEF_GROUND_STAGE["children"]
if not child["name"] in _STATES_TO_REMOVE
]
+ [IDLE_STATE, SAY_STATE, COMPLETE_STATE],
}
I added the command to the package messages:
// Union of all possible commands of this package.
message Command {
oneof id {
// Ask to start say hello (ground)
google.protobuf.Empty say = 1;
// Ask to stop say hello (ground)
google.protobuf.Empty hold = 2;
// Finished hello
google.protobuf.Empty complete = 3;
}
}
And I added “complete” to the config message:
// Ground mode configuration
message Config {
bool say = 1;
bool complete = 2;
}
But nothing happens. It builds, and I can send it to the drone, and see the hello nod, but no takeoff. I think I must be missing somewhere that a message should be sent. What am I missing?