HITL Simulation without amd64 Ubuntu computer
-
Our situation is a bit tricky. We wish to set up a testing environment for custom avoidance and control algorithms, but do not have a computer capable of both building and running all the components listed in the HITL documentation. We can build and upload custom PX4 firmware using a remote VM, but this is not helpful for our HITL simulation.
Has anybody found dug up a way to run the simulator on an M1 mac and connect the VOXL2 for a simulation? We have previously run SITL simulations for other flight controllers on our mac hardware and had success, but I haven't been able to figure out exactly how the HITL mode on the VOXL2 connects to Gazebo so I am not sure how to go about attempting a HITL simulation.
It would not be as useful, but we were also considering attempting a fully SITL test environment. It does not appear there is any explicit support for that and did not see any way to emulate the VOXL2 in a container or to perform simulation in hardware so we are focusing on trying to get HITL to work.
-
I have an M1 Pro chip in my computer. I can test out running HITL on the voxl2 today. I am unsure what the issue you are having is though as mainline PX4 sitl/hitl are both capable of running gazebo out the box and since the connection for HITL usage to the voxl2 is just a FTDI cable, that should traditionally work in the MacOS as well (might have a different name in /dev).
So correct me if I am wrong, but the biggest issue you are having is not being able to RUN hitl on the macOS? Have you tried opening a terminal window with the i386 arch instead of arm? That will leverage rosetta and build in x86. I would also try installing gazebo11 OR gazebo9 as those are the most stable instances.
Zach
-
@Zachary-Lowell-0 I would be very grateful for a confirmation that HITL does in fact work if set up correctly. I have installed the FTDI drivers and see the FTDI usb device in
/dev/tty*
so if I could run gazebo with the correct plugins and modify the model sdf to use the correct/dev/tty
device I assume it would work. I have gazebo9 installed and can run it, but the problem is that I cannot compile plugins.I am not very familiar with HITL or SITL testing and all instructions list as a step building
px4-firmware
with thepx4_sitl gazebo
target, I assume to build SITL plugins, which fails with multiple errors related to recent changes made to the compiler on macos, even in a terminal with the i386 arch. However, I am able to build and run in an ubuntu docker image.I plan to test an image that is building now, forwarding the device to the image and running the simulator there.
Thank you for your help
Aidan -
@Aidan-Dempster makes sense to me. As long as you share your /dev environment over to the docker image over a volume you should be golden. HOWEVER I do not believe you can run gazebo in hitl in headless mode and as docker is a terminal window in headless - unsure what your success would be. If you are having issue building the plugins in SITL that is the issue you are having as gazebo for PX4 in hitl relies heavily on those plugins. That is why step 1 of running hitl is to do "DONT_RUN=1 make px4_sitl_default gazebo" because that is building all the plugins that HITL will be leveraging when you just run "gazebo WORLDXXXX".
I will test running HITL on my computer at some point over the next two days and let you know how it goes. But yeah if you cannot built the sitl environemnt by default, then hitl will not work at all. Once you build sitl, you will be able to leverage the plugins in hitl.
-
@Aidan-Dempster I got HITL working on my M1 just now - required a bit of massaging to get SITL to build properly. Firstly - I nuked my entire brew environment and started from scratch. Then downloaded PX4 from their git. Checked out v1.13.2 then ran
./Tools/setup/macos.sh
. Once that was done then I had to install a few other brew components such as boost, gazebo11, opencv, and gstreamer. Also had to edit a few lines of PX4 source code to play nice with the cmake flags in place.If you want me to post a tarball of that px4 here just let me know. Anyways - once I got sitl building, hitl built immediately afterwards and I was able to get comms to my voxl2.
Hope this helps.
Zach -
@Zachary-Lowell-0 Ah, good to know that it works. Thank you for checking.
I think I know which cmake flags are necessary, but in case I missed something I would appreciate if you could post a tarball.
To clarify, when you say you built hitl, the make target for that is still
DONT_RUN=1 make px4_sitl_default gazebo
correct? -
@Aidan-Dempster So when you run the
DONT_RUN=1...
comment, you are technically building SITL, but the DONT_RUN flag doesnt run the executable, just builds it and necessayr plugins that HITL will run. In order to run the HITL executable it will look something likegazebo PX4_ROOT_DIR/Tools/sitl_gazebo/worlds/hitl_iris.world
-
@Zachary-Lowell-0 Ah, yes I see what you mean. The secondary steps of updating gazebo's plugin path and loading a world with a model that uses the sitl plugins.
Ok, well in that case my only roadblock is building PX4 on my mac which, as far as I can tell, is a PX4 problem and not a VOXL problem so thank you for your help.