Multi Robot Simulator by lge-ros2 - 1

PhysicsSimulators

Unity3D based multi-robot simulator

Unity 2019.3.11f1MIT LicenseUpdated 10 days agoCreated on March 6th, 2020
Go to source

CLOiSim : Multi-Robot Simulator

Happy to announce CLOiSim. It is a new multi-robot simulator to bring-up SDF(www.sdformat.org) file which contains 3d world environemnt and multi-robot descriptions.

It may looks similar to Gazebo simulator, but we had a problems to load multi-robot which equipped multi-sensors in Gazebo. So that is why we initiated to utilize a ‘Unity 3D’. I believe ‘Unity’ can provide a powerful resource handling and can see many possiblity in industrial area by Unity.

So, this project consist of

  • SDF Parser for C#
  • SDF Implementation for Unity -> Visual / Collision / Sensor / Physics for joints
  • SDF Plugins for Unity
  • UI modules -> On screen information
  • Network modules -> transporting sensor data or control data
  • Web service -> control and manipulate simulation

Features

Unfortunately, all sensor models are not fully developed yet. Because first target for simulation was 2-wheeled mobile robot with 2D lidar sensor.

Here are sensor models that already implemented or ongoing.

Plus, SDF implementation only works on essenstial elements like <model>, <link>, <visual>, <collision>, <joint>, etc. For example, kind of optional elmenets <lights>, <audio>, <actor>, <state> and so on are not implemented yet.

How it works

It’s simple. Refer to core codes in ‘Assets/Scripts’.

  • Load SDF file -> Parse SDF(simulation description) -> Implement and realize description

Shaders are also used to get depth buffer information in a few sensor model.

Default physics engine ‘Nvidia PhysX’ is used for physics. and retrieve physics parameters from <ode> in sdf. And ‘SDFPlugins’ help physics tricky handling for jointing <link> ojbects by <joint> element. Because there are quite big constraints in terms of ‘mass’ relationship between rigidbody in PhysX engine.

  • You could find details about these struggling issue with PhysX in unity forums. -> this thread
    • Mass ratio between two joined rigid bodies is limited to less than 1:10 in order to maintain joint stability
    • Motors are soft and cannot deliver enough power to drive multi-level articulated robotics
    • Wheels wobble around their joint axis under heavy load
    • Simulation step size (time interval) has to be reduced to too small to provide the needed accuracy which kills the performance

Inertia factors which retrieved from SDF are NOT USED for rigidbody in Unity. Because it cause unexpected behavior with physX engine.

Build and Run

Tested environement:

  • Linux - Ubuntu 18.04
  • Current editor version is ‘2019.3.11f1’.
    • We are heading to Unity Editor 2019 LTS as a final version.

Release version

If you don’t want to build a project, just USE a release binary(Download linux version). And go to ‘Usage’

Build guide

  1. First, You need a Unity Editor to build a project. Download and install Unity Editor

  2. Open the project folder where you clone the git repository.

  3. You will see popup window if you open it at first time.

    • Don’t forget to import ‘Import TMP Essentials’ when TMP Importer windows popuped.
  4. Select menu, [File] -> [Build Settings]

  5. Choose ‘PC, Mac & Linux Standalone’ in Platform list

    • Target Platform: Linux
    • Architeture: x86_64
    • Uncheck all options below
    • (Optional) Compression Method: LZ4HC
  6. Press the ‘Build’ button.

  7. Last important things! Due to ‘protobuf-net’ plugin issue after build, we need a copy plugin into build output. (We are investigating the issue)

    • Change directory to root project path

      • cd multi-robot-simulator;
    • Copy ‘protobuf-net’ library to output directory. Assume ‘/cloisim_release’.

      • cp Assets/Plugins/protobuf-net.2.4.6/lib/net40/protobuf-net.dll /cloisim_release/CLOiSim_Data/Managed

Usage

Run ‘CLOiSim’

Set environment path like below.

export CLOISIM_MODEL_PATH="/home/Unity/cloisim/sample-resources/models"
export CLOISIM_WORLD_PATH="/home/Unity/cloisim/sample-resources/worlds"

  • ./CLOiSim.x86_64 -worldFile cloisim.world

or you can execute ‘./run.sh’ script in release binary version.

  • ./run.sh cloisim.world

After run ‘CLOiSim’

  • simdevice’ ros2 packages for transporting sensor data are required.

  • Run bringup node in ‘simdevice’ ros2 packages

  • And have fun!!!

Control service

CLOiSim supports web-based simulation control service through websocket as an external interface.

websocket service path: ws://127.0.0.1:8080/{service-name}

Just send a request data as a JSON format.

Supporting Service Name
  • control => url: ws://127.0.0.1:8080/control

    • Reset simulation
      • {"command": "reset"}
  • markers => url: ws://127.0.0.1:8080/markers

    • Markers are consist of ‘group’, ‘id’, ‘type’, ‘color’.

      • ‘id’ must be unique in ‘group’.
      • Check supporing color type in below
        • Red, Green, Blue, Gray, Orange, Lime, Pink, Purple, Navy, Aqua, Cyan, Magenta, Yellow, Black
      • There are four type of ‘type’. Must describe type properties for each type.
        • line
          • "line":{"size":0.03, "point":{"x":1.1, "y":1.1, "z":3.3}, "endpoint":{"x":1.1, "y":1.1, "z":10.0}}}
        • text
          • "text":{"size": 5, "align": "center", "following": null, "text": "Hello!!!!\nCLOiSim!!", "point": {"x": 1.0, "y": 1.0, "z": 4.0}}
        • sphere
          • "sphere":{"size":0.1, "point":{"x": 1.1, "y": 2.2, "z": 4.1}}
        • box
          • "box":{"size": 0.2, "point":{"x": 2.1, "y": 3.2, "z": 4.1}}
    • Add markers

      • {"command":"add", "markers":[{"group":"sample","id":4,"type":"line","color":"red", (type_properties_here)},]}
      • {"command":"add", "markers":[{"group":"sample","id":4,"type":"line","color":"red", "line":{"size":0.03, "point":{"x":1.1, "y":1.1, "z":3.3}, "endpoint":{"x":1.1, "y":1.1, "z":10.0}}},]}
    • Modify markers

      • {"command":"modify", "markers":[{"group":"sample", "id":4, "type":"line", "color":"blue", "line":{"size":0.05, "point":{"x":1.1, "y":1.1, "z":3.3}, "endpoint":{"x":1.1,"y":1.1,"z":5.0}}},]}
    • Remove markers

      • {"command": "remove", "markers":[{"group":"sample","id":5,"type":"line"},]}
    • Get markers list

      • {"command": "list"}
      • {"command": "list", "filter":{"group": "sample"}}
Following object feature in ‘Text’ marker
  • Enable following function
    • Input target object name in simulation on “following” field.
    • "text":{"size": 5, "align": "center", "following": "CLOI_Porter_Robot", "text": "Hello, CLOiSim!!", "point": {"x": 1.0, "y": 3.0, "z": 4.0}}
  • Disable following function
    • "text":{"size": 5, "align": "center", "following": "", "text": "Hello, CLOiSim", "point": {"x": 1.0, "y": 3.0, "z": 4.0}}
    • "text":{"size": 5, "align": "center", "following": null, "text": "Hello, CLOiSim", "point": {"x": 1.0, "y": 3.0, "z": 4.0}}

Future Plan

New features or functions shall be developed on demand.

  • Fully support to keep up with ‘SDF specifiaction version 1.7’

  • Add new sensor models and enhance sensor performance

  • Noise models for sensor model

  • Performance optimization for sensor(Use DOTS by unity?)

  • Upgrade quality of graphical elements

  • Change physics engine (havok or something else…) to find a stable one.

  • If you have any troubles or issues, please don’t hesitate to create a new issue on ‘Issues’. https://github.com/lge-ros2/multi-robot-simulator/issues

감사합니다. Thank you.

Show all projects by lge-ros2