Mavros: Problems setting Navio2 Ardupilot to AUTO mode and setting home position

Summary of issues I am having:

  1. Cannot set mode to AUTO in Ardupilot via Mavros
  2. Cannot set a home position in Ardupilot via Mavros


So I’m working with the Navio2 on a Raspberry Pi 3 Model B+, running Ardupilot (set for Ardurover) and running ROS. However, I’ve been having trouble setting the mode to AUTO.

So I can set other modes like HOLD and MANUAL perfectly fine. AUTO is the only mode that’s giving me issues.

I understand that in order for Mavros to allow AUTO mode to be enabled, there needs to be a GPS fix. However, even when I have a GPS fix, Mavros still will not allow me to switch to AUTO mode. (the console text would tell me that the changing of the flight mode failed if I try)

In addition to first waiting for a GPS fix, I have also tried setting a waypoint (which I can successfully do) and then after doing that, tried setting the mode to AUTO. This also failed.

The next thing I tried was setting the home position. However, every time I tried to set a command for setting the home position, I would be told that the command failed and was given an error code of 4. I couldn’t find anything in the Mavros documentation or anywhere else online that explains what this “4” means. Furthermore, I was also told to check the mavros logs, but nothing online seems to help me in finding where these logs are.

There were a few variations of ways to set the home position, and they all seemed to take in the same parameters as described in . All of these ways gave me the error described in the paragraph above.

Hi Kevin,

Have you tried to repeat it via Mission Planner or QGroundControl? It can be useful to understand is the issue caused by ardupilot or is it connected with mavros.

So through Mission Planner, I am able to connect and set the home position (and do all the other things that Mission Planner is able to do). After trying this, I tried using setting the home position through Mavros. It failed in the same way as described above. This leads me to believe that there is something wrong with the way I’m using Mavros to set the home position of Ardupilot.

Is there anything that I’m supposed to do before attempting to set a home position through Mavros other than starting Ardupilot and ROS? Keep in mind that I am able to set Ardupilot to other modes like HOLD and MANUAL perfectly fine. It’s just that setting a home position and changing the mode to AUTO is not working.

Hi Kevin,

Do you have any updates?

Currently, it seems that the problem is not on the Ardupilot side and it’s hard to determine why you have such an issue with mavros.

Hi Tatiana, so it turned that the problem was due to a minor problem in the way I coded things. So it turns out that in setting the waypoints via Mavros, a specific format was required, which I did not originally have.

To resolve the problem I was having, when I set my waypoints in my code, I set the first waypoint as the home position (which the lat, long, and alt were all 0) and then appended new waypoints to the same array that I pushed the home position into.

1 Like

Hi Kevin,

Glad to hear you’ve figured it out :slight_smile:

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.