Using bluesim on mac. Adding custom levels. Beginner help

Hello
I am using an IMac 2019 with macOS catalina (V10.15.1) installed.
I downloaded bluesim from github for mac. I clicked the download for mac. I have the application file but when I try to launch it it crashes. In the package file there are no levels installed.
My first question is how do I use the sample sunken ship level? I am really knew to this and have no knowledge of tscn files and the like.
In Qgroundcontrol I clicked Application settings and set up a comm link with the settings: TCP at 127.0.0.1 and port 5760. I get an error when I try to connect to it.
Error message: ‘Error on link TCP Link 127.0.0.1:5760. Error on socket: Connection refused’
How should I fix this?
If you could guide me to any resources, that would also be very helpful.
Thanks.

Hi @VioletCheese ,

macOS is probably the worst OS to use it on. IIRC there is not prebuilt SITL binary. So you will have to build and run SITL yourself. Hopeffully @patrickelectric can help you with that.

The first time you run the sim, a “levels” folder should be created in the same directory as the executable. place the “ship.pck” folder in there and re-start the sim.

Hi @VioletCheese, welcome to the forum! :slight_smile:

This seems to be correct. The ArduPilot docs recommend using VirtualBox and Vagrant to set it up in a VM instead of building directly on Mac, as the easiest and most reproducible approach (see here). I’m trying this at the moment and will let you know how it goes :slight_smile:

Following the docs I linked to in my previous comment, I have a couple of extra notes to add.

  1. If you want to install Vagrant using homebrew, the instructions on the Vagrant website are incorrect - you should instead use the instructions directly from the homebrew website (brew install --cask vagrant). I’d expect installing with the binary should be fine from the Vagrant website, but I haven’t tested it.
  2. The default password for the GUI of the Vagrant instance that gets created is vagrant (in case it logs you out)
  3. I believe you’ll need to install the linux version of BlueSim in vagrant (ran out of time to test this properly today) - the Mac one doesn’t seem to work correctly for me at least, likely because it doesn’t know about the SITL build in the linux VM?.

Update:

I tried using running SITL from my mac terminal with vagrant ssh -c "...", which apparently works fine to run and connect to QGC for the normal vehicle simulations (e.g. vagrant ssh -c "sim_vehicle.py"), but not the recommended options for BlueSim.

I managed to get BlueSim running in the linux VM, with a lot of lag (the VM probably needs to be allocated more resources).

In the ArduPilot (bionic64-desktop) VM window, I open Ubuntu’s terminal and run cd /vagrant/ArduSub to get into the ArduSub directory. If I then run sim_vehicle.py -j6 -L RATBeach --frame JSON --out=udpout:0.0.0.0:14550 then open BlueSim (also in the VM) and select pool (or ship.pkg once downloaded in the VM and put in the levels folder), QGC connects and the following shows up repeatedly in the Ubuntu terminal

AP: ArduSub V4.2.0dev (9a538ba1)
AP: 56b55659c3c14c449b760add0ea8268c
AP: Frame: VECTORED

then QCG starts to repeatedly disconnect and reconnect (communication lost … communication regained), with several successful mavlink status updates in the Ubuntu terminal (e.g. AP: EKF3 IMU0 initialised) interspersed with failed command acknowledgements (Got COMMAND_ACK: REQUEST_PROTOCOL_VERSION: UNSUPPORTED).

I’m assuming those failures are related to the very recent ArduSub version (4.2.0dev) mismatching with my QGC being quite old (Blue Robotics’ current recommended download version, v4.0.5). Accordingly, it might be necessary to use either a more recent version of QGC (possibly custom built), or checkout a stable, older branch of the ArduPilot repo before creating the vagrant image.

Hi @VioletCheese,

You can build it fine under mac, you just need to have brew installed and run Tools/environment_install/install-prereqs-mac.sh.
Sadly there is a major rework under this script and is currently broken, what you can do is to edit such file and add/apply the following change:

Or apply this PR or wait to get it merged:

This will install the correct gcc version for the master branch.

You can also install godot and open the project locally to do any necessary change and create your own level.