Skip to content

3.7 Unity Simulation

Majd Khalife edited this page Sep 7, 2024 · 7 revisions

Sim binaries

here

Source code

Unity simulation source code can be found here

How to launch the sim

Build files can be found in catkin_ws/src/sim/builds. To launch the sim, enter the build folder that corresponds to your operating system, and run the executable.

How the sim communicates with Docker

ROS communicates uses TCP/IP which is a communication protocol used in networks. The unity sim can publish and subscribe to rostopics using a bridge facilitated by the ros tcp connector unity package. The ros side can communicate with unity via the ros tcp endpoint package. The ros tcp endpoint runs a server on port 10000 while the ros tcp connector (unity) accesses it as a client. The Docker container does not have direct access to port 10000 on the host machine so a port forward is established in the compose.yml file.

Docker-sim-setup

How to run a mission with the sim.

Run roslaunch sim sim.launch to launch the ros tcp endpoint package as well as all necessary packages (controls, state estimation, vision, propulsion, etc.). In another tab, run rosrun planner [your missions file].py.

Common MacOS error when running the sim

If you get the following error: “sim” is damaged and can’t be opened. You should move it to the Trash.

Do not immediately move it to the Trash, as sometimes when you download something, mac puts a sort of block(called a quarantine) on it for safety reasons.
You can remove it by running: xattr -rd com.apple.quarantine /path/to/sim (Note: get the /path/to/sim by running pwd in the directory where your sim.app is)

After doing this, make your file executable and it should be good to go.