NEED HELP WITH CHANGING MODES-CANT CHANGE TO GUIDED MODE


#1

NEED HELP WITH CHANGING MODES-CANT CHANGE TO GUIDED MODE

My User Environment
Ubuntu 18.04 LTS
MAVProxy==1.8.22
pymavlink==2.4.11
Copter 3.5.5

Got to Section 3-18 SITL Drone Introduction
Used sim_vehicle.py --map --console with no issue and console and map appeared. I hit enter to get the STABILIZE prompt and typed in ‘mode GUIDED’ and it does nothing and does not change modes. I saw some people have changed versions of ardupilot and resolved this issue but I have tried a couple different versions.
(see screen shot of results)

I tried to run
Tools/environment_install/install-prereqs-ubuntu.sh -y
Got this message
bash: Tools/environment_install/install-prereqs-ubuntu.sh: No such file or directory

Tried
sudo git submodule update --init --recursive
This did not resolve this issue

Saw someone post this code snipet but no explanation of how and where to implement this.
vehicle.mode=VehicleMode(“GUIDED”)
vehicle.armed=True
while not vehicle.armed:
print(“Making flight…”)
time.sleep(1)

Which ardupilot should I be running and where can I get the correct version? Ardupilot 3.5.5 install Ardupilot 3.6.1. ?

I have been stuck on this, any help is greatly appreciated.

-Casey


#2

Hi there Casey, let’s get this figured out!

Please update the ArduCopter version to 4.0.3, then try changing modes. I think there is a pymavlink compatability issue going on here.

git clone -b Copter-4.0.3 https://github.com/ardupilot/ardupilot


#3

Caleb,

Thank you for the quick reply. I updated ArduCopter with the git clone you gave me and it updated fine. I then tried to run sim_vehicle.py --console --map and got this:

casey@casey-desktop:~/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/casey/courseRoot/apm/ardupilot/modules/waf/waf-light” “configure” “–board” “sitl”
Setting top to : /home/casey/courseRoot/apm/ardupilot
Setting out to : /home/casey/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 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
‘configure’ finished successfully (2.557s)
SIM_VEHICLE: Building
SIM_VEHICLE: “/home/casey/courseRoot/apm/ardupilot/modules/waf/waf-light” “build” “–target” “bin/arducopter”
Waf: Entering directory `/home/casey/courseRoot/apm/ardupilot/build/sitl’
Traceback (most recent call last):
File “/home/casey/courseRoot/apm/ardupilot/modules/waf/waflib/Scripting.py”, line 165, in waf_entry_point
run_commands()
File “/home/casey/courseRoot/apm/ardupilot/modules/waf/waflib/Scripting.py”, line 266, in run_commands
ctx = run_command(cmd_name)
File “/home/casey/courseRoot/apm/ardupilot/modules/waf/waflib/Scripting.py”, line 250, in run_command
ctx.execute()
File “/home/casey/courseRoot/apm/ardupilot/modules/waf/waflib/Scripting.py”, line 616, in execute
return execute_method(self)
File “/home/casey/courseRoot/apm/ardupilot/modules/waf/waflib/Build.py”, line 255, in execute
self.execute_build()
File “/home/casey/courseRoot/apm/ardupilot/modules/waf/waflib/Build.py”, line 268, in execute_build
self.recurse([self.run_dir])
File “/home/casey/courseRoot/apm/ardupilot/modules/waf/waflib/Context.py”, line 287, in recurse
user_function(self)
File “/home/casey/courseRoot/apm/ardupilot/wscript”, line 376, in build
_build_recursion(bld)
File “/home/casey/courseRoot/apm/ardupilot/wscript”, line 334, in _build_recursion
bld.recurse(d)
File “/home/casey/courseRoot/apm/ardupilot/modules/waf/waflib/Context.py”, line 281, in recurse
wscript_module = load_module(node.abspath(), encoding=encoding)
File “/home/casey/courseRoot/apm/ardupilot/modules/waf/waflib/Context.py”, line 659, in load_module
exec(compile(code, path, ‘exec’), module.dict)
File “/home/casey/courseRoot/apm/ardupilot/ardupilot/wscript”, line 32, in
Build.BuildContext.execute = ardupilotwaf.ap_autoconfigure(Build.BuildContext.execute)
AttributeError: ‘module’ object has no attribute ‘ap_autoconfigure’
SIM_VEHICLE: Build failed
SIM_VEHICLE: Killing tasks

LOoks like I need to update something else. Any ideas?

-Casey


#4

From my previous working attempts where I was able to get SITL up and running I am noticing from the processes that it is getting hung up at this point:

SIM_VEHICLE: Building
SIM_VEHICLE: “/home/casey/courseRoot/apm/ardupilot/modules/waf/waf-light” “build” “–target” “bin/arducopter”
Waf: Entering directory `/home/casey/courseRoot/apm/ardupilot/build/sitl’

Thats when get the traceback File messages

-Casey


#5

@Ironroad

Just checking, did you run git submodule update --init --recursive after installing AC-4.0.3?


#6

Yes I did and same result.


#7

Caleb,

I started from scratch, uninstalled everything and reinstalled with all updated environment variables. Iam back where I started and can run sim_vehicle.py --map --console

Its still not letting me go any further. I am getting a message on the console saying link 1 down and I dont see STABILIZE in the terminal its just saying MAV>

What am I missing?

-Casey


#8

Hi there @Ironroad

Hmm, so a different problem now?

When you get the ‘link 1 down’ message, that typically means that MAVProxy started up, but your SITL vehicle did not start up, therefore the link is down.

The most common reason this occurs is because there is an ‘orphanced’ SITL isntance running in the background.

You can check this by seeing what ports are active. Type

sudo netstat -ltnup

And see if you see any process on ports 5760, 5762 or 5763, or 14550.

If there is, a simple restart of your VM should do the trick!


#9

Caleb,

When I did sudo netstat -ltnup, I got this:

PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 4102/rpcbind
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 3610/systemd-resolv
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 5312/sshd
tcp 0 0 127.0.0.1:34971 0.0.0.0:* LISTEN 5026/containerd
tcp 0 0 127.0.0.1:2947 0.0.0.0:* LISTEN 1/init
tcp6 0 0 :::111 :::* LISTEN 4102/rpcbind
tcp6 0 0 :::22 :::* LISTEN 5312/sshd
tcp6 0 0 ::1:2947 :::* LISTEN 1/init
udp 0 0 0.0.0.0:33589 0.0.0.0:* 4480/avahi-daemon:
udp 0 0 0.0.0.0:886 0.0.0.0:* 4102/rpcbind
udp 0 0 224.0.0.251:5353 0.0.0.0:* 7732/chromium-brows
udp 0 0 224.0.0.251:5353 0.0.0.0:* 7694/chromium-brows
udp 0 0 224.0.0.251:5353 0.0.0.0:* 7732/chromium-brows
udp 0 0 0.0.0.0:5353 0.0.0.0:* 4480/avahi-daemon:
udp 0 0 127.0.0.53:53 0.0.0.0:* 3610/systemd-resolv
udp 0 0 0.0.0.0:68 0.0.0.0:* 17011/dhclient
udp 0 0 0.0.0.0:111 0.0.0.0:* 4102/rpcbind
udp6 0 0 :::886 :::* 4102/rpcbind
udp6 0 0 :::5353 :::* 4480/avahi-daemon:
udp6 0 0 :::55705 :::* 4480/avahi-daemon:
udp6 0 0 :::111 :::* 4102/rpcbind

Dont see any of those ports you mentioned but maybe you see something else. Also, I am not running this on VM nor am I having any of these issues on the VM. I am running this on my own developer environment of an Nvidia Jetson TX2. I wanted to get ardupilot up and running on this hardware if possible.

-Casey


#11

I ArduCopter update version 4.0.3,

Also encountered the same problem

By looking at which ports, the port did not see 5760,5762 or 5763 or 14550


#12

@Huang

Hmm but you were previously having no issues connecting to the simulated drone, right? When this happens to me and I’ve already proven I can connect to the simulated drone, a simple restart of the VM most often fixes the issue:

@Ironroad

I unfortunately don’t have experience running SITL on the Jetson, and don’t know how much help I can be here.

It should be noted that the Jetson is primarily used as a companion computer, and does not directly run ArduPilot firmware. Thought I should point that out just in case your end goal was to use the Jetson on a real drone.