I have tried following every guide and ardupilot document I can find and i jsut cant get sitl working. I was able to get px4 and gazebo working with no issues. can someone give me an order of operations here. what am I to do first/second/third.
Need a little more info. What have you done and what specific errors are you encountering?
well im not even sure. I have gazebo working, and Im using this doc,
i get to the point where it said “stil and mavproxy should be working” and then im lost because I have no clue how to do that. That took me to this page.
https://ardupilot.org/dev/docs/setting-up-sitl-on-linux.html
when i run the sim_vehicle.py it errors.
--------------:/ardupilot$ sim_vehicle.py -v copter --console --map -w
SIM_VEHICLE: Start
SIM_VEHICLE: Killing tasks
SIM_VEHICLE: Starting up at SITL location
SIM_VEHICLE: WAF build
SIM_VEHICLE: Configure waf
SIM_VEHICLE: "/ardupilot/modules/waf/waf-light" "configure" "--board" "sitl"
Traceback (most recent call last):
File "/ardupilot/modules/waf/waflib/Scripting.py", line 159, in waf_entry_point
run_commands()
File "/ardupilot/modules/waf/waflib/Scripting.py", line 252, in run_commands
run_command('init')
File "/ardupilot/modules/waf/waflib/Scripting.py", line 239, in run_command
ctx.execute()
File "/ardupilot/modules/waf/waflib/Context.py", line 214, in execute
self.recurse([os.path.dirname(g_module.root_path)])
File "/ardupilot/modules/waf/waflib/Context.py", line 296, in recurse
user_function(self)
File "/ardupilot/wscript", line 115, in init
generate_tasklist(ctx, False)
File "/ardupilot/wscript", line 671, in generate_tasklist
with open(os.path.join(Context.top_dir, "tasklist.json"), "w") as tlist:
PermissionError: [Errno 13] Permission denied: 'tasklist.json'
SIM_VEHICLE: (Configure waf) exited with code 512
To run SITL from the command line, you need a fully functional development environment. Follow the instructions here, first:
https://ardupilot.org/dev/docs/building-setup-linux.html#building-setup-linux
Or to summarize:
sudo apt-get update
sudo apt-get install git
cd ~
git clone --recurse-submodules https://github.com/ArduPilot/ardupilot.git
cd ardupilot
Tools/environment_install/install-prereqs-ubuntu.sh -y
source ~/.profile
I did that. Every single line I followed step by step
You have a permissions error I’ve not seen before. If you used sudo
in a place where it was not called for, that could be the issue.
Ill try again, but I typed every line exactly as the docs intended. only error i had was with the git clone https address.
On which Linux distro?
wsl2 ubuntu. im in vscode terminal
That should work fairly well and is what I typically use.
this is a fresh install. I installed harmonic seperatly so I could use both px4 and Ardupilot, as my previous attempt was just using px4’s docs. so this is a completely fresh instance. I dont know whats going on. i didnt use sudo for anything other than a couple of mkdir commands (like for the build directory) but I had to otherwise it wouldnt work. Maybe i should just chmod the whole directory
That could very well be your problem. You shouldn’t need to use elevated permissions for anything build related of which I’m aware.
ill start over again.
whats the chances doing any of this in elevated powershell could be the issue?
I wasn’t even aware you could access WSL2 from Powershell, so you may be doing something fundamentally wrong. Your terminal in VS Code should look something like this:
Here’s what it looks like when I open my own AP dev environment in VS Code:
just open powershell and type wsl. but my powershell automatically opens elevated and I forget i set it like that. i just remembered i did a few commands over there so i didn’t lose my place in vs code. i wouldnt think thats the issue. maybe, like we said, the sudo commands. will follow the guides exactly and post issues.
Ok, I understand. The elevated PowerShell instance is not likely the root cause here.
I use Windows Terminal (free from the MS Store), which provides a profile to directly open a WSL2 terminal instance. I find it to be a far better app than the Powershell or cmd.exe tools installed by default. Worth a look.
im 87% sure i missed the “-y” on the end of the script. the only difference i see is it not prompting me for y/n. (that and i place ardupilot in / for easy finding) its running the script now.
Cloning directly to system root is poor practice and might be part of the problem as well.
Why not ~/ardupilot
? That’s equally easy to find and far better practice (expands to /home/username/ardupilot
).
i did ~ this time. to follow precisely. just (bad) habit.
now i get
sim_vehicle.py: command not found