Cannot set mode in MAVProxy


#1

STABILIZE> mode
STABILIZE> ('Available modes: ', [‘STABILIZE’, ‘LAND’, ‘OF_LOITER’, ‘RTL’, ‘DRIFT’, ‘FLIP’, ‘AUTOTUNE’, ‘BRAKE’, ‘GUIDED_NOGPS’, ‘AVOID_ADSB’, ‘POSITION’, ‘SPORT’, ‘FLOWHOLD’, ‘POSHOLD’, ‘AUTO’, ‘GUIDED’, ‘ZIGZAG’, ‘FOLLOW’, ‘ACRO’, ‘SMART_RTL’, ‘ALT_HOLD’, ‘LOITER’, ‘CIRCLE’, ‘THROW’])

STABILIZE> mode guided
STABILIZE> Got COMMAND_ACK: DO_SET_MODE: UNSUPPORTED


#2

Hi dsetin19,

I think I have the same issue. I started the course on 6/24/2020 and got stuck on this part.

When I try to get into guided mode, the console shows “Got MAVLink msg: COMMANAD_ACK{command :176, resul t: 3}”


#3

https://mavlink.io/en/messages/common.html

shows that MAV_CMD_DO_SET_MODE is number 176. I couldn’t find what result:3 means.

From lecture "Different Methods for Workstation/Environment Creation:

1.5 (Mixture of 1 and 2: RECOMMENDED!)

PROS:

*Access to environment that is confirmed to work to help you

rule out human error in debugging.

*If running into dependency issues, hop on the pre-configured

environment and investigate/note any dependency differences.

==============================================================================

There are a lot of moving parts in this software and all the different versions need to play well together.

After many hours of research to determine exactly what was causing the problem and not having any luck, I just decided, for no reason at all, to install a different version of Copter. Problem solved - go figure.

Below I have included some info on my environment. Hope it helps.

david@hp-office:~$ cat /etc/os-release
NAME=“Linux Mint”
VERSION=“19.3 (Tricia)”
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME=“Linux Mint 19.3”
VERSION_ID=“19.3”
HOME_URL=“https://www.linuxmint.com/
SUPPORT_URL=“https://forums.ubuntu.com/
BUG_REPORT_URL=“http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/
PRIVACY_POLICY_URL=“https://www.linuxmint.com/
VERSION_CODENAME=tricia
UBUNTU_CODENAME=bionic

david@hp-office:~$ pip --version
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)

david@hp-office:~$ pip list | grep MAVProxy
MAVProxy (1.8.19)

david@hp-office:~$ pip list | grep pymavlink
pymavlink (2.4.9)

david@hp-office:~$ python
Python 2.7.17 (default, Apr 15 2020, 17:20:14)
[GCC 7.5.0] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import sys
print ‘\n’.join(sys.path)

/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/home/david/.local/lib/python2.7/site-packages
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/gtk-2.0
/usr/lib/python2.7/dist-packages/wx-3.0-gtk3

quit()

david@hp-office:~/courseRoot/apm$ git clone -b Copter-3.6 https://github.com/ardupilot/ardupilot

david@hp-office:~/courseRoot/apm/ardupilot/ArduCopter$ sim_vehicle.py --console --map
SIM_VEHICLE: Start
SIM_VEHICLE: Killing tasks
SIM_VEHICLE: Starting up at -35.363261,149.165230,584,353 (CMAC)
SIM_VEHICLE: WAF build
SIM_VEHICLE: Configure waf
SIM_VEHICLE: “/home/david/courseRoot/apm/ardupilot/modules/waf/waf-light” “configure” “–board” “sitl”
Setting top to : /home/david/courseRoot/apm/ardupilot
Setting out to : /home/david/courseRoot/apm/ardupilot/build
Autoconfiguration : enabled
Setting board to : sitl
Checking for ‘g++’ (C++ compiler) : /usr/bin/g++
Checking for ‘gcc’ (C compiler) : /usr/bin/gcc
Checking for c flags ‘-MMD’ : yes
Checking for cxx flags ‘-MMD’ : yes
Checking for need to link with librt : not necessary
Checking for HAVE_CMATH_ISFINITE : yes
Checking for HAVE_CMATH_ISINF : yes
Checking for HAVE_CMATH_ISNAN : yes
Checking for NEED_CMATH_ISFINITE_STD_NAMESPACE : yes
Checking for NEED_CMATH_ISINF_STD_NAMESPACE : yes
Checking for NEED_CMATH_ISNAN_STD_NAMESPACE : yes
Checking for header endian.h : yes
Checking for header byteswap.h : yes
Checking for program ‘python’ : /usr/bin/python
Checking for python version >= 2.7.0 : 2.7.17
Checking for program ‘python’ : /usr/bin/python
Checking for python version >= 2.7.0 : 2.7.17
Source is git repository : yes
Update submodules : yes
Checking for program ‘git’ : /usr/bin/git
Checking for program ‘size’ : /usr/bin/size
Benchmarks : disabled
Unit tests : enabled
Checking for program ‘rsync’ : /usr/bin/rsync
‘configure’ finished successfully (1.995s)
SIM_VEHICLE: Building
SIM_VEHICLE: “/home/david/courseRoot/apm/ardupilot/modules/waf/waf-light” “build” “–target” “bin/arducopter”
Waf: Entering directory /home/david/courseRoot/apm/ardupilot/build/sitl' Waf: Leaving directory/home/david/courseRoot/apm/ardupilot/build/sitl’

BUILD SUMMARY
Build directory: /home/david/courseRoot/apm/ardupilot/build/sitl
Target Text Data BSS Total

bin/arducopter 1785216 75974 44032 1905222

Build commands will be stored in build/sitl/compile_commands.json
‘build’ finished successfully (1.573s)
SIM_VEHICLE: Using defaults from (/home/david/courseRoot/apm/ardupilot/Tools/autotest/default_params/copter.parm)
SIM_VEHICLE: Run ArduCopter
SIM_VEHICLE: “/home/david/courseRoot/apm/ardupilot/Tools/autotest/run_in_terminal_window.sh” “ArduCopter” “/home/david/courseRoot/apm/ardupilot/build/sitl/bin/arducopter” “-S” “-I0” “–home” “-35.363261,149.165230,584,353” “–model” “+” “–speedup” “1” “–defaults” “/home/david/courseRoot/apm/ardupilot/Tools/autotest/default_params/copter.parm”
SIM_VEHICLE: Run MavProxy
SIM_VEHICLE: “mavproxy.py” “–master” “tcp:127.0.0.1:5760” “–sitl” “127.0.0.1:5501” “–out” “127.0.0.1:14550” “–out” “127.0.0.1:14551” “–map” “–console”
RiTW: Starting ArduCopter : /home/david/courseRoot/apm/ardupilot/build/sitl/bin/arducopter -S -I0 --home -35.363261,149.165230,584,353 --model + --speedup 1 --defaults /home/david/courseRoot/apm/ardupilot/Tools/autotest/default_params/copter.parm

Option “-e” is deprecated and might be removed in a later version of gnome-terminal.#

Use “-- ” to terminate the options and put the command line to execute after it.#

WARNING: You should uninstall ModemManager as it conflicts with APM and Pixhawk
Connect tcp:127.0.0.1:5760 source_system=255
Loaded module console
Loaded module map
Log Directory:
Telemetry log: mav.tlog
MAV> Waiting for heartbeat from tcp:127.0.0.1:5760
STABILIZE>
STABILIZE> mode guided
STABILIZE> GUIDED>
GUIDED> Received 921 parameters


#4

Thanks for your reply dsetin19.

I also spent several hours and was finally able to get it to work on my own environment. I rebuilt the environment twice without any luck. Then I started looking at https://ardupilot.org/dev/docs/setting-up-sitl-on-linux.html and https://ardupilot.org/dev/docs/building-setup-linux.html#building-setup-linux.

While I wasn’t able to determine the exact cause of the issue, I suspect that it was something to do with the required packages. I found this script useful:

Install some required packages

If you are on a debian based system (such as Ubuntu or Mint), we provide a script that will do it for you. From ardupilot directory :

Tools/environment_install/install-prereqs-ubuntu.sh -y

Reload the path (log-out and log-in to make permanent):

. ~/.profile


#5

I had this same problem, running the installation procedure described by the course.

Simple fix is to follow the steps provided by Ardupilot: https://ardupilot.org/dev/docs/setting-up-sitl-on-linux.html

It’s a shame that the procedure in the course doesn’t work! I suspect that the selected branch of ardupilot is not compatible with the MAVProxy version. I tried to get different versions of MAVProxy and while I got different results for “mode GUIDED” every time, it never properly entered the mode. Getting the latest ardupilot and MAV software fixed it for me.


#6

How do I install this script… I’m a newbie


#7

Hi there Pharns

With an open terminal, you could likely run the referenced script by entering the full path to the script:

/home/$USER/courseRoot/apm/ardupilot/Tools/environment_install/install-prereqs-ubuntu.sh -y

OR

/home/$USER/courseRoot/apm/ardupilot/Tools/scripts/install-prereqs-ubuntu.sh -y


#8

My apologies for the inconveniences everyone! I run through the entire curriculum every ~6-9 months to make sure nothing has broken. Not sure what happened since the last time I checked the installs but rest assured this will be fixed.

In the near future I will also be updating the course to Ubuntu 18.04 and the ArduPilot version to hopefully something in the AC-4.0.*s

Thanks everyone for sharing solutions!


#9

Hey Caleb

For what it’s worth, I successfully built the system and have been sim flying using Ubuntu 20.04 “Focal Fossa”.

Jack


#10

That’s good to know!

Everyone, I just finished upgrading the following software for the Drone Programming Primer:

Ubuntu: 18.04 (was 16.04)
MAVProxy: 1.8.17 (was 1.6.2)
ArduCopter: 4.0.3 (was 3.5.5)
Pymavlink: 2.4.10 (was 2.0.6)
Dronekit: 2.9.2 (was 2.9.1)


These changes should better prevent errors like:

  • Unable to change mode of drone
  • Dronekit-sitl forever waiting for GUIDED mode
  • Incorrect MAP appearing when launch SITL

#11

I spoke too soon though. While running the DK scripts I encountered "ModuleNotFoundError: No module named ‘exceptions’ ". Perhaps there is a work-around.