ZeroSim is a robotics simulation engine built on the easy to use Unity 3D development platform and the power of the Robotics Operating System (ROS). ZeroSim is designed for ease of use and rapid development of all sorts of robotics and simulation -- from warehouses and industrial settings, to farming and outdoors -- from robotic arms to ground and drone based mobile robots.
ZeroSim is a project developed over several years by FS Studios for the rapid development of all sorts of robotic simulation projects for various clients, from robotic arms to mobile robots.
We are releasing ZeroSim as open source to support the community of roboticist and software engineers that have supported us over the decades. We are in active development and welcome all feature requests, bug reports, and pull requests.
ZeroSim provides a multitude of tools for building robots and environments in Unity to interface with ROS. We strive to provide the same functionality and ROS interfaces of Gazebo. Including:
-
Dynamics simulation using the latest PhysX 4.x integrated in Unity.
- Hinge, ball, linear and fixed joints.
-
Advanced 3D Rendering, including the latest realtime ray tracing technology.
-
Sensors:
- 2D LIDAR -> ROS LaserScan message.
- 3D LIDAR -> ROS PointCloud2
- Color camera -> ROS Image and ROS CameraInfo message.
- Color + depth camera -> ROS Image and ROS CameraInfo message.
- Stereo camera -> ROS Image and ROS CameraInfo message.
- IMU -> ROS Imu message
- Magnetometer -> ROS MagneticField message.
- Contact switch
- Altimeter
-
Ready to use ROS standard controllers and plugins:
- Differential drive. Controlled via standard ROS Twist message.
- Robotic arm controller via the ROS FollowJointTrajectory Action Controller Interface allowing MoveIt to connect seamlessly with ZeroSim.
- ROS TF publisher.
- ROS JointState publisher.
-
Full ROS messaging communications layers API.
- Many premade standard ROS messages
- Subscribe and publish
- Action Servers
- Fast and efficient message encoding using ROS Bridge and BSON over TCP.
- Parameter server
-
Ready to run prebuilt ROS Docker images available publically on DockerHub: https://hub.docker.com/r/zerodog/zerosim_ros_vnc
-
Machine Learning tools:
- Image Segmentation for training semantic segmentation algorithms.
-
URDF Import & Export
-
ROS2 support via ROS Bridge Suite (https://github.com/RobotWebTools/rosbridge_suite)
-
COMING SOON:
- Configure and run Docker images within Unity Editor.
- Secure communications via WebSockets.
- Drone controller.
- Ubuntu 18.04 or 20.04 (may work on MacOS or Windows but currently untested)
- Unity 2020.x LTS (IMPORTANT: Currnetly Unity 2021.x breaks a lot of things. We hope to support 2021 in the near future.)
- Git LFS
- ROS Melodic (ZeroSim provides a pre-built Docker container for ROS functionality https://hub.docker.com/r/zerodog/zerosim_ros_vnc)
- Note: ROS Melodic is our primary supported development environment, but ZeroSim has reportedly been able to run on Noetic and ROS2.
- In Unity Hub create a new Unity project using Unity 2020.x or later.
- Add ZeroSim via Unity Packages:
- IMPORTANT: Make sure GIT LFS is installed on your system before continuing!
- Unity Menu
Window -> Package Manager
- Select the
+
dropdown:
- Select
Add Package From Git URL...
and enter[email protected]:fsstudio-team/ZeroSimROSUnity.git
. Note this can take upto a few minutes to update but you should see the following:
- Import the ZeroSim Samples by selecting the Samples
Import
button in the Package Manager:
- IMPORTANT the default Unity physics settings do not work well with a lot of simulations. It is very much recommended (required for probably most all simulations) to set the physics settings by opening the Unity menu
Edit -> Project Settings... -> Physics
and set theDefault Solver Iterations
to30
and theDefault Solver Velocity Iterations
to60
. - IMPORTANT the default Unity fixed timestep setting does not work well with a lot of simulions. It is very much recommended to set the
Fixed Timestep
setting byEdit -> Project Settings... -> Time
to0.005
- If running Unity on Linux you want to avoid using OpenGL and use Vulkan, otherwise image based sensors may run slowly or not at all. To change to using Vulkan:
- Available at https://hub.docker.com/r/zerodog/zerosim_ros_vnc or
docker pull zerodog/zerosim_ros_vnc:latest
NOTE: Order of operations is important. Especially starting the Docker before the Unity simulation.
- Make sure that the ZeroSim samples are installed as outlined above.
- Make sure that the ZeroSim Docker container above is installed.
- Open the
Turtlebot3_Waffle_test.scene
- Launch the ZeroSim Docker via:
docker run -it --rm \
--publish=9090:9090 \
--publish=11311:11311 \
--publish=8083:8083 \
--publish=80:80 \
--publish=5678:5678 \
--name my_zerosim_vnc_docker \
zerodog/zerosim_ros_vnc:latest \
roslaunch zero_sim_ros basic_unity_editor.launch
- Run the ROS teleop in a seperate terminal by running:
docker exec -it my_zerosim_vnc_docker \
bash -c "source devel/setup.bash ; rosrun turtlebot3_teleop turtlebot3_teleop_key"
- In the Unity editor press the "Play" button.
- The Turtlebot can now be controlled via the
w a s d
keys in the ROS teleop console window:
This will show visualizing the 2D LIDAR and ROS TF in RViz. This uses a VNC viewer to the ZeroSim ROS Docker container.
- Startup the Turtlebot Test Scene as detailed above.
- Open a noVNC connection by:
- In a browser open http://localhost:8083/vnc.html
- Press the "Connect" button.
- In the VNC window press the LEFT mouse button and select "Terminal".
- In the new terminal run
rviz -d ./src/zero_sim_ros/rviz/turtlebot_viewer.rviz
. RViz will start up with a 3D view with the LIDAR scanner visibile.
NOTE: Order of operations is important. Especially starting the Docker before the Unity simulation.
- Make sure that the ZeroSim samples are installed as outlined above.
- Make sure that the ZeroSim Docker container above is installed.
- Open the
UniversalRobot_UR10_test.scene
- Launch the ZeroSim Docker via:
docker run -it --rm \
--publish=9090:9090 \
--publish=11311:11311 \
--publish=8083:8083 \
--publish=80:80 \
--publish=5678:5678 \
--name my_zerosim_vnc_docker \
zerodog/zerosim_ros_vnc:latest \
roslaunch zero_sim_ros ur10_moveit.launch
- Start the UR10 test Scene by pressing the Play button.
- Open a noVNC connection by:
- In a browser open http://localhost:8083/vnc.html
- Press the "Connect" button.
- In the noVNC window RViz will be setup with MoveIt
- You can now to standard MoveIt! operations in RViz to control the UR10 arm
- Make sure that the ZeroSim samples are installed as outlined above.
- Make sure that the ZeroSim Docker container above is installed.
- Open the
ImageSegmentation_test.scene
- Launch the ZeroSim Docker via:
docker run -it --rm \
--publish=9090:9090 \
--publish=11311:11311 \
--publish=8083:8083 \
--publish=80:80 \
--publish=5678:5678 \
--name my_zerosim_vnc_docker \
zerodog/zerosim_ros_vnc:latest \
roslaunch zero_sim_ros basic_unity_editor.launch
- Start the Image Segmentation Test Scene by pressing the Play button.
- Open a noVNC connection by:
- In a browser open http://localhost:8083/vnc.html
- Press the "Connect" button.
- In the VNC window press the LEFT mouse button and select "Terminal".
- In the new terminal run
rqt_image_view /image/segmentation_image
. - Open up a second terminal and run
rqt_image_view /image/image_raw
- Make sure that the ZeroSim samples are installed as outlined above.
- Open scene the
URDF_test.scene
in the ZeroSim samples. - Select
SimpleRobotArm
in the scene hierarchy.
- Select
Export URDF
in the root properties view. - Select the directory to export to.
- An excellent online URDF viewer is available: https://gkjohnson.github.io/urdf-loaders/javascript/example/index.html Just drag and drop the files exported above.
- Right click and select
ZeroSim --> Import URDF...
- Clone the Leo robot:
git clone --recursive https://github.com/LeoRover/leo_common.git
- Checkout Melodic version.
cd leo_common && git checkout melodic
. - Startup ZeroSim Docker mounting the LEO directory:
# make sure you are in parent directory for `leo_common`
cd ..
# run docker
docker run -it --rm \
--publish=9090:9090 \
--publish=11311:11311 \
--publish=8083:8083 \
--publish=80:80 \
--publish=5678:5678 \
--name my_zerosim_vnc_docker \
--volume=$(pwd)/leo_common/:/catkin_ws/src/leo_common/ \
zerodog/zerosim_ros_vnc:latest \
bash
- In the Docker command prompt build the catkin workspace:
source devel/setup.bash
catkin build
# Make sure to source ROS again to get the new LEO robot
source devel/setup.bash
- In the Docker command prompt Run XAcro on the LEO robot to get the URDF:
rosrun xacro xacro src/leo_common/leo_description/urdf/leo_sim.urdf.xacro > /tmp/leo_sim.urdf
- Convert LEO robot meshes to .obj for Unity. In the Docker command prompt:
/zerosim_tools/convert_meshes_to_obj.sh ./src/leo_common/leo_description/models
- Copy URDF from Docker to host:
# create a directory and a sub-directory to store the URDF and meshes
mkdir -p my_leo_robot/leo_description
# copy the URDF
docker cp my_zerosim_vnc_docker:/tmp/leo_sim.urdf ./my_leo_robot
- Copy Meshes from Docker to host:
# Note we are preserving the path
docker cp my_zerosim_vnc_docker:/catkin_ws/src/leo_common/leo_description/models ./my_leo_robot/leo_description
- Fix the URDF paths to the meshes:
# First fix up the .DAEs to point to the OBJs
sed -i 's#.dae#.obj#g' my_leo_robot/leo_sim.urdf
# The fix up the .STLs to point to the OBJs
sed -i 's#.stl#.obj#g' my_leo_robot/leo_sim.urdf
# Now remove the `package://` because we are using the filesystem
sed -i 's#package://#./#g' my_leo_robot/leo_sim.urdf
- In Unity import URDF by: Right click and select
ZeroSim --> Import URDF...