Error running sim_vehicle.py

Hey folks,

I’m new to ardupilot, and I’m running into some issues.
I followed these instructions for how to setup ardupilot on Windows Subsystem for Linux (ubuntu 18.04):
https://ardupilot.org/dev/docs/building-setup-linux.html#building-setup-linux

except I don’t see a file called sim_vehicle.py in the ardupilot/ArduCopter directory. I found a file of the same name in ardupilot/Tools/autotest/ and tried running that but I get the following:

[Run MavProxy] An exception has occurred with command: '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'
[Errno 2] No such file or directory 
SIM_VEHICLE: Killing tasks
RiTW: Window access not found, logging to /tmp/ArduCopter.log
/home/pmweeks/drone_task/ardupilot/Tools/autotest/run_in_terminal_window.sh: line 54: 17445 
Terminated              "$cmd" $* &> "$filename" < /dev/null

Anybody have any ideas?

There is a install script that installs all the tools you need for developing. Just take a look in the tools directory.

Yes, I ran that install script. From ardupilot directory, run
./Tools/environment_install/install-prereqs-ubuntu.sh -y

Try using a real linux PC. It works a lot better.

Hello.
Execute the following under [ardupilot/Tools/autotest/].

sim_vehicle.py --vehicle=ArduCopter

I’ve tried that, and that’s where I’m getting this error. I’ve tried the following:
from ardupilot directory:
./Tools/autotest/sim_vehicle.py --map --console -v ArduCopter

from ardupilot directory:
./Tools/autotest/sim_vehicle.py --vehicle=ArduCopter

from ardupilot/Tools/autotest directory
./sim_vehicle.py --vehicle=ArduCopter

all give me the same error as above:
[Run MavProxy] An exception has occurred with command: ‘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’
[Errno 2] No such file or directory
SIM_VEHICLE: Killing tasks
RiTW: Window access not found, logging to /tmp/ArduCopter.log
/home/pmweeks/drone_task/ardupilot/Tools/autotest/run_in_terminal_window.sh: line 54: 17946
Terminated “$cmd” $* &> “$filename” < /dev/null

Seems that mavproxy is not installed, or not found.

I have simulator running on WSL, on a system somewhere and if I remember correctly there is no .profile so you have to set path manually
You need a X11 driver running before launch

Maybe we need to make big red warning if something when wrong on install script !
I will open an issue on that point…
@Peter_Weeks could you use again ./Tools/environment_install/install-prereqs-ubuntu.sh -y and double check that nothing fails ? thanks

1 Like

The following is the output from running (from ardupilot directory): ./Tools/environment_install/install-prereqs-ubuntu.sh -y

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

  • ‘[’ 1000 == 0 ‘]’
  • OPT=/opt
    ++ lsb_release -c -s
  • RELEASE_CODENAME=bionic
  • ‘[’ bionic == xenial ‘]’
  • ‘[’ bionic == disco ‘]’
  • ‘[’ bionic == eoan ‘]’
  • SITLFML_VERSION=2.4
  • SITLCFML_VERSION=2.4
  • BASE_PKGS=‘build-essential ccache g++ gawk git make wget’
  • PYTHON_PKGS=‘future lxml pymavlink MAVProxy pexpect’
  • PYTHON_PKGS=‘future lxml pymavlink MAVProxy pexpect pygame intelhex’
  • PX4_PKGS=‘python-argparse openocd flex bison libncurses5-dev autoconf texinfo libftdi-dev zlib1g-dev zip genromfs python-empy cmake cmake-data’
  • ARM_LINUX_PKGS=‘g+±arm-linux-gnueabihf pkg-config-arm-linux-gnueabihf’
  • SITL_PKGS=‘libtool libxml2-dev libxslt1-dev python-dev python-pip python-setuptools python-matplotlib python-serial python-scipy python-opencv python-numpy python-pyparsing xterm lcov gcovr’
  • SITL_PKGS=‘libtool libxml2-dev libxslt1-dev python-dev python-pip python-setuptools python-matplotlib python-serial python-scipy python-opencv python-numpy python-pyparsing xterm lcov gcovr libcsfml-dev libcsfml-audio2.4 libcsfml-dev libcsfml-graphics2.4 libcsfml-network2.4 libcsfml-system2.4 libcsfml-window2.4 libsfml-audio2.4 libsfml-dev libsfml-graphics2.4 libsfml-network2.4 libsfml-system2.4 libsfml-window2.4 python-yaml python3-yaml’
  • ASSUME_YES=false
  • QUIET=false
    ++ uname -m
  • MACHINE_TYPE=x86_64
  • ‘[’ x86_64 == x86_64 ‘]’
  • PX4_PKGS+=’ libc6-i386’
  • ARM_ROOT=gcc-arm-none-eabi-6-2017-q2-update
  • ARM_TARBALL=gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2
  • ARM_TARBALL_URL=https://firmware.ardupilot.org/Tools/STM32-tools/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2
  • ARDUPILOT_TOOLS=Tools/autotest
  • OPTIND=1
  • getopts y opt
  • case “$opt” in
  • ASSUME_YES=true
  • getopts y opt
  • APT_GET=‘sudo apt-get’
  • true
  • APT_GET=‘sudo apt-get --assume-yes’
  • false
  • dpkg-query -l lsb-release
    Desired=Unknown/Install/Remove/Purge/Hold
    | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
    |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
    ||/ Name Version Architecture Description
    ++±========================-=================-=================-=====================================================
    ii lsb-release 9.20170808ubuntu1 all Linux Standard Base version reporting utility
  • read -r UBUNTU_CODENAME
    ++ lsb_release -c -s
  • ‘[’ bionic = precise ‘]’
  • ‘[’ bionic = trusty ‘]’
  • sudo usermod -a -G dialout pmweeks
  • dpkg-query -l modemmanager
    dpkg-query: no packages found matching modemmanager
  • sudo apt-get --assume-yes update
    Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
    Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
    Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
    Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
    Reading package lists… Done
  • apt-cache search python-wxgtk3.0
  • grep wx
    python-wxgtk3.0 - Python interface to the wxWidgets Cross-platform C++ GUI toolkit
    python-wxgtk3.0-dev - Development files for wxPython
  • SITL_PKGS+=’ python-wxgtk3.0 libtool-bin’
    ++ apt-cache search -n ‘^realpath$’
  • RP=
  • ‘[’ -n ‘’ ‘]’
  • sudo apt-get --assume-yes install build-essential ccache g++ gawk git make wget libtool libxml2-dev libxslt1-dev python-dev python-pip python-setuptools python-matplotlib python-serial python-scipy python-opencv python-numpy python-pyparsing xterm lcov gcovr libcsfml-dev libcsfml-audio2.4 libcsfml-dev libcsfml-graphics2.4 libcsfml-network2.4 libcsfml-system2.4 libcsfml-window2.4 libsfml-audio2.4 libsfml-dev libsfml-graphics2.4 libsfml-network2.4 libsfml-system2.4 libsfml-window2.4 python-yaml python3-yaml python-wxgtk3.0 libtool-bin python-argparse openocd flex bison libncurses5-dev autoconf texinfo libftdi-dev zlib1g-dev zip genromfs python-empy cmake cmake-data libc6-i386 g+±arm-linux-gnueabihf pkg-config-arm-linux-gnueabihf
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Note, selecting ‘libpython2.7-stdlib’ instead of ‘python-argparse’
    autoconf is already the newest version (2.69-11).
    bison is already the newest version (2:3.0.4.dfsg-1build1).
    build-essential is already the newest version (12.4ubuntu1).
    ccache is already the newest version (3.4.1-1).
    flex is already the newest version (2.6.4-6).
    gawk is already the newest version (1:4.1.4+dfsg-1build1).
    libc6-i386 is already the newest version (2.27-3ubuntu1).
    libtool is already the newest version (2.4.6-2).
    libtool-bin is already the newest version (2.4.6-2).
    make is already the newest version (4.1-9.1ubuntu1).
    python-dev is already the newest version (2.7.15~rc1-1).
    python-numpy is already the newest version (1:1.13.3-2ubuntu1).
    python-pyparsing is already the newest version (2.2.0+dfsg1-2).
    python-serial is already the newest version (3.4-2).
    python-setuptools is already the newest version (39.0.1-2).
    python-yaml is already the newest version (3.12-1build2).
    python3-yaml is already the newest version (3.12-1build2).
    zip is already the newest version (3.0-11build1).
    zlib1g-dev is already the newest version (1:1.2.11.dfsg-0ubuntu2).
    gcovr is already the newest version (3.4-1).
    genromfs is already the newest version (0.5.2-2build3).
    lcov is already the newest version (1.13-3).
    libcsfml-audio2.4 is already the newest version (2.4-2).
    libcsfml-dev is already the newest version (2.4-2).
    libcsfml-graphics2.4 is already the newest version (2.4-2).
    libcsfml-network2.4 is already the newest version (2.4-2).
    libcsfml-system2.4 is already the newest version (2.4-2).
    libcsfml-window2.4 is already the newest version (2.4-2).
    libftdi-dev is already the newest version (0.20-4build3).
    libsfml-audio2.4 is already the newest version (2.4.2+dfsg-4).
    libsfml-dev is already the newest version (2.4.2+dfsg-4).
    libsfml-graphics2.4 is already the newest version (2.4.2+dfsg-4).
    libsfml-network2.4 is already the newest version (2.4.2+dfsg-4).
    libsfml-system2.4 is already the newest version (2.4.2+dfsg-4).
    libsfml-window2.4 is already the newest version (2.4.2+dfsg-4).
    openocd is already the newest version (0.10.0-4).
    python-empy is already the newest version (3.3.2-1build1).
    python-matplotlib is already the newest version (2.1.1-2ubuntu3).
    python-scipy is already the newest version (0.19.1-2ubuntu1).
    python-wxgtk3.0 is already the newest version (3.0.2.0+dfsg-7).
    texinfo is already the newest version (6.5.0.dfsg.1-2).
    xterm is already the newest version (330-1ubuntu2).
    cmake is already the newest version (3.10.2-1ubuntu2.18.04.1).
    cmake-data is already the newest version (3.10.2-1ubuntu2.18.04.1).
    g++ is already the newest version (4:7.4.0-1ubuntu2.3).
    g+±arm-linux-gnueabihf is already the newest version (4:7.4.0-1ubuntu2.3).
    git is already the newest version (1:2.17.1-1ubuntu0.5).
    libncurses5-dev is already the newest version (6.1-1ubuntu1.18.04).
    libpython2.7-stdlib is already the newest version (2.7.17-1~18.04).
    libxml2-dev is already the newest version (2.9.4+dfsg1-6.1ubuntu1.2).
    libxslt1-dev is already the newest version (1.1.29-5ubuntu0.2).
    wget is already the newest version (1.19.4-1ubuntu2.2).
    pkg-config-arm-linux-gnueabihf is already the newest version (4:7.4.0-1ubuntu2.3).
    python-opencv is already the newest version (3.2.0+dfsg-4ubuntu0.1).
    python-pip is already the newest version (9.0.1-2.3~ubuntu1.18.04.1).
    The following package was automatically installed and is no longer required:
    libdumbnet1
    Use ‘sudo apt autoremove’ to remove it.
    0 upgraded, 0 newly installed, 0 to remove and 17 not upgraded.
  • pip2 -q install --user -U future lxml pymavlink MAVProxy pexpect pygame intelhex
  • ‘[’ ‘!’ -d /opt/gcc-arm-none-eabi-6-2017-q2-update ‘]’
    +++ realpath ./Tools/environment_install/install-prereqs-ubuntu.sh
    ++ dirname /home/pmweeks/drone_task/ardupilot/Tools/environment_install/install-prereqs-ubuntu.sh
  • SCRIPT_DIR=/home/pmweeks/drone_task/ardupilot/Tools/environment_install
    ++ realpath /home/pmweeks/drone_task/ardupilot/Tools/environment_install/…/…/
  • ARDUPILOT_ROOT=/home/pmweeks/drone_task/ardupilot
  • exportline=‘export PATH=/opt/gcc-arm-none-eabi-6-2017-q2-update/bin:$PATH’
  • grep -Fxq ‘export PATH=/opt/gcc-arm-none-eabi-6-2017-q2-update/bin:$PATH’ /home/pmweeks/.profile
  • exportline2=‘export PATH=/home/pmweeks/drone_task/ardupilot/Tools/autotest:$PATH’
  • grep -Fxq ‘export PATH=/home/pmweeks/drone_task/ardupilot/Tools/autotest:$PATH’ /home/pmweeks/.profile
  • apt-cache search arm-none-eabi
    binutils-arm-none-eabi - GNU assembler, linker and binary utilities for ARM Cortex-A/R/M processors
    gcc-arm-none-eabi - GCC cross compiler for ARM Cortex-A/R/M processors
    gcc-arm-none-eabi-source - GCC cross compiler for ARM Cortex-A/R/M processors (source)
    libnewlib-arm-none-eabi - C library and math library compiled for bare metal using Cortex A/R/M
    libstdc+±arm-none-eabi-newlib - GNU Standard C++ Library v3 for ARM Cortex-A/R/M processors (newlib)
    ubertooth-firmware - Firmware for Ubertooth
    ubertooth-firmware-source - Source code for the Ubertooth firmware
  • cd /home/pmweeks/drone_task/ardupilot
  • git submodule update --init --recursive
  • echo ‘---------- ./Tools/environment_install/install-prereqs-ubuntu.sh end ----------’
    ---------- ./Tools/environment_install/install-prereqs-ubuntu.sh end ----------

hello,

The general components seems to be well installed but we get no output for those with pip

could you launch

pip2 -q install --user -U future lxml pymavlink MAVProxy pexpect pygame intelhex

that the same command as on the script, it use pip paquet manager for python2 to install some programs

@khancyr I still get the same error :confused:
@ppoirier I checked my home directory and ~/.profile exists and has the following line:
export PATH=/home/pmweeks/drone_task/ardupilot/Tools/autotest:$PATH

Ok
I will get the disk drive back later on and report back

There is something mixed up with your ubuntu installation. I just tried a fresh install of WSL Ubuntu 18 and did a standard install of SITL. It worked flawlessly.

You should be able to run mavproxy.py from any directory.

What is the output of the pip line?

Nothing, unless you remove the “-q” in which case, I get the following:
Collecting future
Collecting lxml
Using cached ttps://files.pythonhosted.org/packages/03/06/eb9f000882f671a2d494342c1fe93b1c8b18fb04420bb611aeaa3298ef17/lxml-4.5.0-cp27-cp27mu-manylinux1_x86_64.whl
Collecting pymavlink
Collecting MAVProxy
Collecting pexpect
Using cached https://files.pythonhosted.org/packages/39/7b/88dbb785881c28a102619d46423cb853b46dbccc70d3ac362d99773a78ce/pexpect-4.8.0-py2.py3-none-any.whl
Collecting pygame
Using cached https://files.pythonhosted.org/packages/d6/07/115e632437dc28cc624e92da6e1c69e7b3232cfe2f3d7e0aa3c8353cdf18/pygame-1.9.6-cp27-cp27mu-manylinux1_x86_64.whl
Collecting intelhex
Using cached https://files.pythonhosted.org/packages/bf/77/bf670318b3db325c71e2ac6a90b7bcfdf9fc739b7cf6aebb31715721623e/intelhex-2.2.1-py2.py3-none-any.whl
Collecting pyserial>=3.0 (from MAVProxy)
Using cached https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl
Collecting ptyprocess>=0.5 (from pexpect)
Using cached https://files.pythonhosted.org/packages/d1/29/605c2cc68a9992d18dada28206eeada56ea4bd07a239669da41674648b6f/ptyprocess-0.6.0-py2.py3-none-any.whl
Installing collected packages: future, lxml, pymavlink, pyserial, MAVProxy, ptyprocess, pexpect, pygame, intelhex
Successfully installed MAVProxy-1.8.18 future-0.18.2 intelhex-2.2.1 lxml-4.5.0 pexpect-4.8.0 ptyprocess-0.6.0 pygame-1.9.6 pymavlink-2.4.4 pyserial-3.4

Edit: that first link there is missing the ‘h’ in “https” becuase as a new user, I’m apparently only allowed to post five links in a comment

Just retested my WSL setup and all OK.

Here is my build log:
sim_vehicle.py --console --map
SIM_VEHICLE: Start
SIM_VEHICLE: Killing tasks
SIM_VEHICLE: Starting up at SITL location
SIM_VEHICLE: WAF build
SIM_VEHICLE: Configure waf
SIM_VEHICLE: “/home/alien/ardupilot/modules/waf/waf-light” “configure” “–board” “sitl”
Setting top to : /home/alien/ardupilot
Setting out to : /home/alien/ardupilot/build
Autoconfiguration : enabled
Setting board to : sitl
Using toolchain : native
Checking for ‘g++’ (C++ compiler) : /usr/lib/ccache/g++
Checking for ‘gcc’ (C compiler) : /usr/lib/ccache/gcc
Checking for c flags ‘-MMD’ : yes
Checking for cxx flags ‘-MMD’ : yes
Checking for need to link with librt : not necessary
Checking for feenableexcept : yes
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 HAVE_MEMRCHR : yes
Checking for program ‘python’ : /usr/bin/python
Checking for python version >= 2.7.0 : 2.7.15
Checking for program ‘python’ : /usr/bin/python
Checking for python version >= 2.7.0 : 2.7.15
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
Scripting : enabled
Scripting runtime checks : enabled
Checking for program ‘rsync’ : /usr/bin/rsync
‘configure’ finished successfully (2.814s)
SIM_VEHICLE: Building
SIM_VEHICLE: “/home/alien/ardupilot/modules/waf/waf-light” “build” “–target” “bin/arducopter”
Waf: Entering directory /home/alien/ardupilot/build/sitl' Embedding file sandbox.lua:libraries/AP_Scripting/scripts/sandbox.lua Waf: Leaving directory /home/alien/ardupilot/build/sitl’

BUILD SUMMARY
Build directory: /home/alien/ardupilot/build/sitl
Target Text Data BSS Total

bin/arducopter 2443141 101752 73448 2618341

Here is my pip list:

asn1crypto (0.24.0)
backports.functools-lru-cache (1.4)
cryptography (2.1.4)
cycler (0.10.0)
decorator (4.1.2)
empy (3.3.2)
enum34 (1.1.6)
future (0.18.2)
gcovr (3.4)
idna (2.6)
ipaddress (1.0.17)
keyring (10.6.0)
keyrings.alt (3.0)
lxml (4.4.1)
matplotlib (2.1.1)
MAVProxy (1.8.16)
numpy (1.13.3)
olefile (0.45.1)
pexpect (4.7.0)
Pillow (5.1.0)
pip (9.0.1)
ptyprocess (0.6.0)
pycrypto (2.6.1)
pygobject (3.26.1)
pymavlink (2.4.0)
pyparsing (2.2.0)
pyserial (3.4)
python-dateutil (2.6.1)
pytz (2018.3)
pyxdg (0.25)
scipy (0.19.1)
SecretStorage (2.3.1)
setuptools (39.0.1)
six (1.11.0)
subprocess32 (3.2.7)
wheel (0.30.0)
wxPython (3.0.2.0)
wxPython-common (3.0.2.0)

Ok,
So you should have everything correctly installed.
Let’s debug more !

Could you try to just launch mavproxy ?
normally, typing :

mavproxy.py --version

if it doesn’t work, try to reinstall it

sudo pip2 uninstall mavproxy
sudo pip2 install -U mavproxy

“mavproxy.py --version” output:
MAVProxy is a modular ground station using the mavlink protocol
MAVProxy Version: 1.8.18

Ok so now I am sure that you got everything installed and it should be working.

Did you try to reboot and launch
sim_vehicle.py -v ArduCopter --console --map ?

Aha! It worked when I ran that exact command from the ardupilot directory. Alright! Now I just got get x11 set up