M3DP-Sim

M3DP-sim Instructions

To use this simulation tool (Tested on Ubuntu version 18.04 and 20.04) follow these instructions :

Table of Contents


Install the Required dependencies

From The Gazebo Installation Guide

  1. Setup your computer to accept software from packages.osrfoundation.org
     sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
    
  2. Setup keys and Update:

     wget https://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
     sudo apt-get update
    
  3. Install prerequisites. A clean Ubuntu system will need the following (replace version with the major version of gazebo you intend to build, eg: 7, 8, 9. And if using ROS, replace dummy with your ROS version, eg: indigo, jade, kinetic…):
     wget https://raw.githubusercontent.com/ignition-tooling/release-tools/master/jenkins-scripts/lib/dependencies_archive.sh -O /tmp/dependencies.sh
     GAZEBO_MAJOR_VERSION=version ROS_DISTRO=dummy . /tmp/dependencies.sh
     echo $BASE_DEPENDENCIES $GAZEBO_BASE_DEPENDENCIES | tr -d '\\' | xargs sudo apt-get -y install
    

    We recommend using ROS_DISTRO=meolodic and GAZEBO_MAJOR_VERSION=9

Refer to The Gazebo Installation from Source for optional additional physics engines (not required for the basic functionalities of our tool)

Install build essentials

sudo apt update
sudo apt install build-essentials 

Install Gazebo

  1. clone the repository
      git clone https://bitbucket.org/hbpneurorobotics/gazebo.git
    

    Note that more recent version of Gazebo may not be fully compatible, which is why we are providing this version

  2. Install using the following commands
      cd gazebo
      mkdir build
      cd build
      cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local ..
      make -j8
      make install
    

    You can use make -j4 or another lower number than 8 based on the available memory

## Install Gazebo Fluid Simulation Plugin with SPlisHSPlasH

  1. open your bash nano ~/.bashrc

    1. Add a line to the bottom of the file
       export LD_LIBRARY_PATH=/home/jason2/.local/lib:$LD_LIBRARY_PATH:/home/<your_User_Name>/splisplash/build/lib
      
    2. save changes and exit before runnig: source ~/.bashrc
  2. Clone our repo

      https://github.com/ai4ce/M3DP-Sim.git 
    

## Fluid Engine Dev for meshing simulations

  1. Install fluid-engine_dev plugin

    1. Clone the Fluid Engine Dev - Jet repo
    2. Build it on your machine accordingly as you did with Gazebo mkdir build && cd build && cmake .. && make
  2. Locate the particles2obj executable

    e.g /home/<User_name>/fluid-engine-dev/build/bin/particles2obj

    1. Run the conversion from cartesian coordinates to mesh to verify the installation
       /particles2obj -i ./hybrid_liquid_sim_output/yuewei/frame_14000.xyz -r 700,700,700 -k 0.04 -m anisotropic -o ./hybrid_liquid_sim_output/frame_test
      
      

      The command above specifies the input path, output path for the .obj file and the resolution, meshing method, SPH kernel and grid spacing. For more info on the scope of options, type –help in the end of the command. Refer to Issue#303 for more

    2. This tool uses a system call to connect the simulation results to the tools. In FluidSimulator::RunStep from file GazeboFluidSimulator.cpp the following is used:
       string command = "'/home/uljad1b/fluid-engine-dev/build/bin/particles2obj' -i '" + path + "' -r 100,100,100 -g 0.01 -k 0.2 -m spherical -o '/home/uljad1b/fluid-engine-dev/build/bin/hybrid_liquid_sim_output/" + std::to_string(simulationSteps) + ".obj'";
       system((command).c_str());
      

      Through string command you can specify the path where your mesh will be saved during runtime. Use absolute path!

## ROS to connect the plugin for multi robot simulations

  1. Desktop Full Install ROS

    1. Follow the ROS Installation Instructions. At 1.4 choose Desktop-Full Install
  2. Connect ROS to Gazebo

    1. Install gazebo_ros_pkgs
       git clone https://github.com/ros-simulation/gazebo_ros_pkgs.git -b melodic-devel
      
    2. Use Rosdep to check for missing pckgs (dont install gazebo9 & libgazebo9-dev)
       rosdep check --from-paths . --ignore-src --rosdistro melodic
      
  3. Install moveit

     git clone https://github.com/ros-simulation/gazebo_ros_pkgs.git -b melodic-devel
    
  4. Create a Catkin Workspace
  5. Download catkin_make

Running TurtleBots

  1. Create a Catkin Workspace
  2. cd srcand Download turtlebot3
  3. Download ttbot with open-manipulator (change to melodic)