AVR Autonomous Code Flight Path Not Working

The sandbox connects to the MQTT broker just fine, and is able to log and run some setup code. It also is able to detect autonomous enable/disable just fine, but does not execute the flight path. Here is my code:

    def path(self) -> None:
        logger.info("CAPTURING HOME & ARM")
        self.send_message("avr/fcm/capture_home", {})
        self.send_message("avr/fcm/arm", {})

        logger.info("UPLOADING MISSION")
        self.send_message("avr/fcm/upload_mission", {
            "waypoints": [
                { # takeoff
                    "type": "takeoff"
                    "type": "land"
        logger.info("STARTING MISSION")
        self.send_message("avr/fcm/start_mission", {})

I was considering replacing it with the following code which I will test on the drone tomorrow instead of using the missions:

        box.send_message("avr/fcm/takeoff", {})
        box.send_message("avr/fcm/land", {})

Any insight? I think it’s possible I may be using the wrong MQTT topic or message formatting.


You might be sending messages to the FCM too quickly.

I’m testing this in the sim right now, it connects just fine and starts running code but when it executes send_message(“avr/fcm/takeoff”, {}) nothing happens even though there are no errors. I also added some pauses like you said. Anyone know how to get it to actually takeoff autonomously?

For some reason it’s not in the documentation, but you need to put the altitude that you want to take off in the payload.
{“avr/fcm/actions”, {“action”: “takeoff”, “alt”: }

Sorry but sometimes I have trouble trying to get it into the right python code form. Is this correct?

self.send_message("avr/fcm/takeoff", {"alt": 3.12})

(Not sure if I should do it like that or send_message(“avr/fcm/actions”, {“action”: “takeoff”, “alt”:3})
Thanks so much for your help.

I realize this is a bit tricky. Not sure if you watched my video describing some of the fundamentals:

The topic should be avr/fcm/actions and the message is in JSON format like this:

{"action": "takeoff", "payload": { "alt": 1.5 }}

I’m going to update the documentation but one thing to keep in mind is that for any navigation commands I believe the default speed is 5m/s which is WAY TOO FAST for the AVR game court. This is a PX4 parameter that you should update to slow it down:


For all my testing I had it set to 0.25 m/s.

Good luck and let us know how it goes.

1 Like