SITL the 'easy'(?) way.

457 views
Skip to first unread message

TheJNJO1000

unread,
Jul 16, 2014, 4:11:59 PM7/16/14
to drones-...@googlegroups.com
Hi all,

I've long been royally frustrated by my own inability to get SITL installed and running in a reliable, repeatable way.
When I manage to follow the Wiki, it usually works, but only usually, mostly since I excel at missing vital steps, or forget basic Linux operations.

SITL is a really wonderful tool for me as a regular user.
I use it to test fly my missions, test new functions in the Beta releases and "play" with parameters, etc, before using them live, on my planes and 'copters.

With the help of a few guys at RCGroups, I've put together a series of guides on how to to install SITL using a script, connect MissionPlanner, run FlightGear, change location, etc.
The RCGroup thread is here -> http://www.rcgroups.com/forums/showthread.php?t=2190616

I'll also upload all guides and and the installation script on GoogleDrive in a 13Mb zip-file. -> https://drive.google.com/file/d/0B7AP3ZsINgXtclJwN0lSVUQ2aWs/edit?usp=sharing

I hope somebody finds it useful, and that I'm not posting this in the wrong place.



BR,
/J



Craig Elder

unread,
Jul 16, 2014, 4:39:40 PM7/16/14
to drones-discuss
Thank you very much for the information.  Would you be interested in adding it to our wiki?


--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TheJNJO1000

unread,
Jul 16, 2014, 5:22:47 PM7/16/14
to drones-...@googlegroups.com
Craig, Thanks.:)

I'd be honored to have it added to the wiki. At the moment, I can't do it myself though. If I'm bad at Linux, I'm even worse with WordPress.
I'm willing to learn though.

IMHO, I think it would be good if it was reviewed and evaluated by a few more 'beta-testers' first, to iron out any wrinkles, before adding to the wiki.

Rick Std

unread,
Jul 16, 2014, 9:29:09 PM7/16/14
to drones-...@googlegroups.com
I'm stuck at the #21 in the MOP.  tmake complain... tmake error: Template file tmake.conf not found
...help1?

Randy Mackay

unread,
Jul 16, 2014, 10:46:18 PM7/16/14
to drones-...@googlegroups.com

 

     I’ve had a bit of a look at the SITL set-up wiki page which starts here:

1.       http://dev.ardupilot.com/wiki/setting-up-sitl-on-windows/

    I think this page is all fine right?

 

     Maybe the problems start after Step #5 when the user is asked to go to this page:

2.       http://dev.ardupilot.com/wiki/setting-up-sitl-on-linux/

      which then diverts them over to the “Building for APM2.x on Linux with Make”.

3.       http://dev.ardupilot.com/wiki/building-the-code-onlinux/

     the problem with #3 is that it asks the user to make for PX4 which is obviously weird ‘cuz this page is only for APM2.

 

     To be honest, I’d rather identify and fix what’s wrong with the current wiki page before we accept a set of parallel instructions.  I’m happy to add a link to the rcg instructions of course.

 

Daniel,

     I strongly suspect you’re the issue you’re facing with crazy altitudes is because the computer you’re using isn’t powerful enough.  Maybe you can make a video of what you’re seeing?

 

-Randy

--

Arthur Benemann

unread,
Jul 16, 2014, 10:57:50 PM7/16/14
to drones-...@googlegroups.com
Recently I made a pull that improved the install_pre_requesites.sh script. It's already merged on master by Tridge.

I also took care of recording all the steps to get a SILT setup in the air. Today I asked Alex@3dr to update the wiki with the instructions. These are the pages which where updated
http://dev.ardupilot.com/wiki/building-the-code-onlinux/ (the make line is wrong on this one, it should be just "make")
http://dev.ardupilot.com/wiki/building-px4-for-linux-with-make/

All the previous info was moved to the Advanced header, because those take you step by step on the process.


--
Arthur Benemann
Engineer
3D Robotics

Randy Mackay

unread,
Jul 16, 2014, 11:39:18 PM7/16/14
to drones-...@googlegroups.com

Arthur,

 

     Ok, great.  So after that’s updated we just need some people to try it again.

 

-Randy

TheJNJO1000

unread,
Jul 17, 2014, 4:09:59 AM7/17/14
to drones-...@googlegroups.com


Den torsdagen den 17:e juli 2014 kl. 03:29:09 UTC+2 skrev Rick Std:
I'm stuck at the #21 in the MOP.  tmake complain... tmake error: Template file tmake.conf not found
...help1?

Rick, is this using any of the guides I wrote? If so, can you specify exactly what #21 is. Also, I don't understand what "MOP" is.

Randy and Arthur,
I'm looking forward to test the updated wiki, and I agree that fixing any problems is better than adding a parallel set.
Where would I report any problems found?

Randy Mackay

unread,
Jul 17, 2014, 7:22:31 AM7/17/14
to drones-...@googlegroups.com

 

>>> Where would I report any problems found?

     Re the question above, I think for the moment, just reporting the issues here in the drones-discuss list is best.

 

-Randy

 

From: drones-...@googlegroups.com [mailto:drones-...@googlegroups.com] On Behalf Of TheJNJO1000
Sent: July 17, 2014 5:10 PM
To: drones-...@googlegroups.com
Subject: [Bulk] Re: [drones-discuss] SITL the 'easy'(?) way.

 

--

Svein Alexander Frotjold

unread,
Jul 17, 2014, 11:21:19 AM7/17/14
to drones-...@googlegroups.com
I have written a draft for setting up sitl with virtual box that uses install scripts.

The reason for doing this was that i had some problems following the original guide due to missing information.
the install scripts are located on my dropbox and works on ubuntu and linux mint.

i have not gotten arduplane/jsbsim up and running but everything else works.

i suggest a complete virtual machine download. that would make everything consistent except the ardupilot shared folder.

Arthur Benemann

unread,
Jul 17, 2014, 12:16:40 PM7/17/14
to drones-...@googlegroups.com
@Svein: I updated the install_pre_resquesites_script a couple of days ago. The wiki already has the new info at:

It`s very simple, and was tested with clean VMs on Ubuntu 14.014 and 12.04.

TheJNJO1000

unread,
Jul 18, 2014, 4:43:33 AM7/18/14
to drones-...@googlegroups.com
Svein,
I'd love to run your scripts.
Can you share your dropbox link? I don't have permissions to view your draft.

/J

Svein Alexander Frotjold

unread,
Jul 18, 2014, 5:35:12 AM7/18/14
to drones-...@googlegroups.com

TheJNJO1000

unread,
Jul 18, 2014, 11:30:08 AM7/18/14
to drones-...@googlegroups.com
Thanks,
I'll run it a few times and let you know how it goes.

/J

Den fredagen den 18:e juli 2014 kl. 11:35:12 UTC+2 skrev Svein Alexander Frotjold:

TheJNJO1000

unread,
Jul 19, 2014, 7:40:11 PM7/19/14
to drones-...@googlegroups.com
Svein,
I've run through your script a number of times now. I'm using Ubuntu14.04 in VMware, set up as described in http://dev.ardupilot.com/wiki/setting-up-sitl-on-windows/#Setting_up_SITL_on_Windows Steps #1 and #2.

I tested on a fresh Ubuntu install. No other updates or installations were made prior to running the script.

I've made a few small changes and add-ons, including running 'install-prereqs-ubuntu.sh', as well as cloning ArduPilot master in Ubuntu, bypassing the shared folder and building in Windows. (Why is that done, anyway??)

I've tried to comment what I did, and why, and I hope I didn't mess it up to bad.;)
FWIW, it works well for menow , without surprises.
JNJO_instsim.sh

Svein Alexander Frotjold

unread,
Jul 20, 2014, 7:55:16 AM7/20/14
to drones-...@googlegroups.com
Nice work :)

I'm editing the code in windows so having a shared folder makes it easier to test changes on the fly.
i guess that is the way most of the dev's have it set up.

if you're not going to edit the code it's ok to just have it in the vm.

i think the git cloning should be left out of the script for that reason. it's just one line in the terminal anyways.

Other than that the changes look's good.
I think it should be a part of the install-prereqs script it self and make it one complete setup script.

What do you guys think?

This wil make the wiki for SITL a lot simpler.
Windows setup would only be about setting up the vm, shared folder(optional) and ip addresses for mavproxy/mission planner.

TheJNJO1000

unread,
Jul 20, 2014, 1:16:00 PM7/20/14
to drones-...@googlegroups.com
Thanks. :)

OK, now i understand the reason for the shared folder.

Maybe replace line 48 and 49 with:
#
read -p "Do you want to clone ArduPilot Master from git?
Do this only if you did NOT build the code in Windows, and set up a shared folder (y/n)" RESP1
if [ "$RESP1" = "y" ]; then
    cd
    git clone git://github.com/diydrones/ardupilot.git
fi
#

+1 on having a complete script.

/J

Neat things to have in the wiki for regular users would be: FlightGear installation, Customize start-up location and adding joystick control.

Svein Alexander Frotjold

unread,
Jul 20, 2014, 2:36:35 PM7/20/14
to drones-...@googlegroups.com
If we add the script to the ardupilot repository people already have to download the source some how to get the script.

I think it's better to leave the git clone as a manual thing people need to do before they run the script.

i have added the script to a temporary git repository. https://github.com/svefro/RandomCode

The script needs to run from the /Tools/scripts folder so paths need to change for this to work.

Svein Alexander Frotjold

unread,
Jul 21, 2014, 5:06:42 AM7/21/14
to drones-...@googlegroups.com
Have you gotten ArduPlane to run THEJNJO1000?

I have modified the paths in the scripts now and tested on fresh ubuntu 14.04
Everything works except arduPlane witch i never get to work. JSBSim wont start properly.

im planning on submitting the file sim_sitl.sh to /Tools/scripts and sim_start.sh to /Tools/autotest but everything needs to work before that.
Those scripts do everything to get the SITL up and running. (except GIT Clone or shared folder setup)

The scripts needs some cleanup when everything is working. sim_start.sh is pretty basic for now.

The files are located here for now: https://github.com/svefro/RandomCode

TheJNJO1000

unread,
Jul 21, 2014, 12:06:09 PM7/21/14
to drones-...@googlegroups.com
Svein,

Yes, ArduPlane works fine.
After installation, I restart Terminal, run simrc.sh "Reset Params to Default", and then restart SITL:Plane.
No problems for me.
In fact, the prereq-script solved the issue with having to load working plane parameters in MavProxy on first run.

I'm testing the script on a freshly installed Ubuntu 14.04 in VMware. Following the wiki for SITL Windows steps #1 and #2.(+ Change the keyboard layout to match mine.)
I also clone Ardupilot git in the Ubuntu environment.

I'll run your latest scripts a few times with the same setup, and get back to you tomorrow.

/Jan

Svein Alexander Frotjold

unread,
Jul 21, 2014, 7:06:58 PM7/21/14
to drones-...@googlegroups.com
The attached picture is what i get in the simulator terminal. i guess this is due to some permission setup with the shared folder. im using VirtualBox not VMware.

Anyone have some tips?
SITL Test1.png

John Wiseman

unread,
Jul 21, 2014, 8:16:55 PM7/21/14
to drones-discuss
Please copy & paste text so it can be indexed and searched for, instead of attaching screenshots of pure text.



--

Svein Alexander Frotjold

unread,
Jul 22, 2014, 5:42:10 AM7/22/14
to drones-...@googlegroups.com
Xterm don't support simple copy paste.

Svein Alexander Frotjold

unread,
Jul 22, 2014, 7:00:32 AM7/22/14
to drones-...@googlegroups.com
ArduPlane with JSBSim works like a charm when copying the files from the shared folder to a local folder in linux env.
I have tested with VMWare Player and Virtual box.
Same errors with both when running from the shared folder.

Svein Alexander Frotjold

unread,
Jul 22, 2014, 7:15:54 AM7/22/14
to drones-...@googlegroups.com
I have testet the install scripts several times now with sucsess.

I would like to make and publish these wiki pages:
-SETTING UP VIRTUALBOX FOR SITL WITH UBUNTU 14.04 32BIT (this will give people the option to chose VM platform. i use Virtual box for other stuff also)
-Automated SITL setup with script in ubuntu 14.04

This now basically requires 2 commands in the terminal after shared folder setup or git clone.
run sitl_setyp.sh (from scripts folder)
and then sim_start.sh from autotest folder.

Both scripts asks a range of questions. answer y on all questions in sitl_setyp.sh installs everything needed.
sim_start.sh asks witch vechle to start (Copter/plane/rover) and if to reset parameters. (VM ip defaults to 192.168.1.13)

ill make a pull request for the scripts now so you can take a look at them.
They are going to need some cleanup and fine tuning but they work fine as is.

TheJNJO1000

unread,
Jul 22, 2014, 8:47:54 AM7/22/14
to drones-...@googlegroups.com
Nice job.:)
I have also run the scripts several times. Every time was a success.
This was done on a clean Ubuntu 14.04 in VMware under Windows7
My only deviation was that I ran these two commands first:

sudo apt get install git
git clone https://github.com/diydrones/ardupilot.git (I have no need for a shared folder in my case.)

and then I continued with sitl_setup.sh


Though the scripts work fine as is, in my local setup, I will enable: echo 'ARMING_CHECK 0' >> ~/ardupilot/Tools/autotest/copter_params.parm to sitl_setup.sh

and sim_start.sh will be modified with a choice to enter an alternate IP-adress (requires restart of SITL to stick), and to load the map module:
#!/bin/bash
#################
#New lines below
IP
=10.11.12.13
read
-p "IP-adress is $IP. Change? (y/n) " RESP
   
if [ "$RESP" = "y" ]; then
    read
-p "Type new IP. (x.x.x.x) " NEWIP
    sed
-i -e "4c IP="$NEWIP"" sim_start.sh
fi
#New lines above
#################
read
-p "Which software do you want to simulate? Copter=c, Plane=p, Rover=r (c/p/r) " RESPM
if [ "$RESPM" = "c" ]; then
    cd ardupilot
/ArduCopter
    read
-p "Do you want to reset parameters to default? (y/n) " RESP
   
if [ "$RESP" = "y" ]; then
        sim_vehicle
.sh -v ArduCopter -f X -j 2 -w --console --out=$IP:14550 --out=$IP:14551
   
else
        sim_vehicle
.sh -v ArduCopter -f X -j 2 --console --map --out=$IP:14550 --out=$IP:14551
   
fi
fi


Svein Alexander Frotjold

unread,
Jul 22, 2014, 9:49:26 AM7/22/14
to drones-...@googlegroups.com
Yes we can add all the options in the world here.
Why would you want to change the ip address by the way? 
You can change it in Windows network connection to match the script. this way everyone uses the same script settings.

The sim_start.sh script should also be reworked to avoid repeating lines.
Disabling arming check could be a option in the script also.

We are having a great summer here in norway so ill postpone the fine tuning for now on my part.

When/If the pull request for the scripts goes trough i'll start on the wiki.

John Wiseman

unread,
Jul 22, 2014, 2:24:35 PM7/22/14
to drones-discuss
In xterm you can left-click and drag to select, then middle-click or press shift-insert to paste. http://askubuntu.com/questions/237942/how-does-copy-paste-work-with-xterm

It's a little weird, but not as weird as the idea of a terminal program that doesn't support copy & paste. :)

Svein Alexander Frotjold

unread,
Jul 22, 2014, 2:49:43 PM7/22/14
to drones-...@googlegroups.com
I actually tried the middle click in gedit but it didn't take so i just screengrabbed.
i even tried shift insert. tried again and woallah!! i might have selected the text with the right mouse button.

Anyways here it is :)

Wrote aircraft/Rascal/reset.xml
Wrote jsbsim/fgout.xml
Wrote jsbsim/rascal_test.xml
Traceback (most recent call last):
  File "/media/sf_ardupilot/Tools/autotest/jsbsim/runsim.py", line 199, in <module>
    jsb = pexpect.spawn(cmd, logfile=sys.stdout, timeout=10)
  File "/usr/lib/python2.7/dist-packages/pexpect/__init__.py", line 485, in __init__
    self._spawn(command, args)
  File "/usr/lib/python2.7/dist-packages/pexpect/__init__.py", line 636, in _spawn
    os.execv(self.command, self.args)
OSError: [Errno 13] Permission denied
Traceback (most recent call last):
  File "/media/sf_ardupilot/Tools/autotest/jsbsim/runsim.py", line 203, in <module>
    "Could not bind to socket for input"])
  File "/usr/lib/python2.7/dist-packages/pexpect/__init__.py", line 1418, in expect
    timeout, searchwindowsize)
  File "/usr/lib/python2.7/dist-packages/pexpect/__init__.py", line 1433, in expect_list
    timeout, searchwindowsize)
  File "/usr/lib/python2.7/dist-packages/pexpect/__init__.py", line 1521, in expect_loop
    raise EOF(str(err) + '\n' + str(self))
pexpect.EOF: End Of File (EOF). Exception style platform.
<pexpect.spawn object at 0xb6ee8f4c>
version: 3.1
command: /home/ubuntu/ardupilot/Tools/autotest/JSBSim
args: ['/home/ubuntu/ardupilot/Tools/autotest/JSBSim', '--realtime', '--suspend', '--nice', '--simulation-rate=1000', '--logdirectivefile=jsbsim/fgout.xml', '--script=jsbsim/rascal_test.xml']
searcher: <pexpect.searcher_re object at 0xb6ee8fcc>
buffer (last 100 chars): ''
before (last 100 chars): ' line 636, in _spawn\r\n    os.execv(self.command, self.args)\r\nOSError: [Errno 13] Permission denied\r\n'
after: <class 'pexpect.EOF'>
match: None
match_index: None
exitstatus: None
flag_eof: True
pid: 5147
child_fd: 3
closed: False
timeout: 10
delimiter: <class 'pexpect.EOF'>
logfile: <open file '<stdout>', mode 'w' at 0xb74ad078>
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0
delayafterclose: 0.1
delayafterterminate: 0.1

Svein Alexander Frotjold

unread,
Jul 23, 2014, 5:47:01 AM7/23/14
to drones-...@googlegroups.com

David Pawlak

unread,
Jul 23, 2014, 8:00:57 AM7/23/14
to drones-...@googlegroups.com
Just reading your instructions. Haven't tried anything yet.

What is Guest additions CD and where do you get it?
Reply all
Reply to author
Forward
0 new messages