What do I do abou this? FYI, I’ve been following the instructions I’ve found, but I don’t have a great knowledge of how it all works. I’m just trying to run the simulation SW so I can test control algorithms for a drone and this process for getting SITL is very confusing to me.
aha yeah sometime you can feel lonely here !
First I think (because I see “Can’t open display: 0.0”) that you didn’t set your display. You can download vcxsrv. Once it is done, open xlaunch, select multiple windows and enter number 0, start no client, select the “disable access” and unselect “native open gl” and then just before running the sim_vehicle.py script type
$ export DISPLAY=0:0
an other possibility is trying to run the --no-mavproxy command when you try to build your sim_vehicle.py file and then connect to the vehicle using MissionPlanner or QGC. If it works it means that it is mavproxy that isn’t working for you and in this case I would recommand uninstalling everything and starting from scratch.
@A.Larribau It’s been a while since I looked at this since I got stuck, so let me go through the process again and try your suggestion as well. I had vcxsrv installed but removed it so I’ll have to reinstall that.
@Josephjj I’m just running it on my laptop, I didn’t know you could run it on a raspberry pi! What do you mean by “what other programs [I’m] running my sim?” I wish I could afford a raspberry pi now lol, wish I would’ve bought one a few years ago when people weren’t charging $300.
No need for a raspi, my sitl is working just fine on my laptop but @Josephjj is right it might an issue with the port already occupied. Did you try my recommandations ? By running with --no-mavproxy flag you solve the issue of port already occupied because mission planner won’t be able to connect when you’ll try on 127.0.0.1:5760
Well in all the time that has passed since I first had this issue, I had installed visual studio 2022, and now I’m having “powershell not found” issues which is keeping me from building AirSim again, so I’m trying to work back through that, I’m thinking I’ll try the method to just use the binaries so I can avoid that, and currently just double checking that my SITL works fine on cygwin (I’m having to rebaseline since it’s been so long)
So no I haven’t tried your suggestions quite yet, but I’m gettting there.
Is it better to use WSL? And are you using AirSim as well? I think I remember reading that you can only build custom autopilot code (with the intent to actually flash it to the flight controller) using Linux/WSL. I was using cygwin when compiling my SITL code and then executing the SITL.
@A.Larribau hey so I am going the way of WSL now like you, and using WSL2 I tried to run sim_vehcile.py and got the same error I originally posted about. I tried your suggestions with vcxsrv and get this error
I also tried running sim_vehicle.py with the --no-mavproxy command and then I see this
SIM_VEHICLE: Using defaults from (Tools/autotest/default_params/copter.parm)
SIM_VEHICLE: Run ArduCopter
SIM_VEHICLE: "/home/user/GitHub/ardupilot/Tools/autotest/run_in_terminal_window.sh" "ArduCopter" "/home/user/GitHub/ardupilot/build/sitl/bin/arducopter" "-S" "--model" "+" "--speedup" "1" "--slave" "0" "--defaults" "Tools/autotest/default_params/copter.parm" "--sim-address=127.0.0.1" "-I0"
RiTW: Starting ArduCopter : /home/user/GitHub/ardupilot/build/sitl/bin/arducopter -S --model + --speedup 1 --slave 0 --defaults Tools/autotest/default_params/copter.parm --sim-address=127.0.0.1 -I0
xterm: Xt error: Can't open display: 0:0
SIM_VEHICLE: Waiting for SITL to exit
Which makes me think that it is a mavproxy thing and that I may need to reinstall everything. Do I have to reinstall mission planner or just mavproxy if so?
yeah the second error is because of the first one. The launch of vcxsrv didn’t worked properly. I’d suggest that once you’ve downloaded vcxsrv you switch off and restart your pc. then xlaunch, select multiple windows and enter number 0, start no client, select the “disable access” and unselect “native open gl”. Then you should have the following icon in your main windows bar :
and when you put your mouse over it it says “DESKTOP -XXXX0:0 -0 clients”
If you don’t have this uninstall and reinstall vcxsrv.
then type $ export DISPLAY=0:0 and run sim_vehicle.py
Okay so I did turn off my computer and then turned it back on, alright I do see that “DESKTOP -XXXX0:0 -0 clients” text when I hover over that icon, it was on my taskbar hidden in a drop down menu.
I did type “export DISPLAY=0:0” and then ran sim_vehicle.py but still get this
I’m going to see if I can figure out how to check if port5760 is already occupied, since that was suggested earlier. Though I’m not running anything else on my computer at the moment.
only when i don’t set the vc xsrv so I am sorry i don’t know what to tell you except redownload vcxsrv or maybe try an other app to visualize ubuntu app on windows…