Guided

Introduction

Welcome to step by step tutorials for the users with little or no experience using URSim. The steps will guide you through the most basic usage of URSim. We will run a simple prebuilt scene in Unity and connect it to ROS. You will find the guidelines to so the following tasks ahead:

  1. Downloading and installing ROS, Unity and other required packages.
  2. Setting up URSim on windows and connecting it to ROS running on Ubuntu.
  3. Running your first simulation on URSim.

Downloading and installing ROS, Unity

  1. Ubuntu 16.04LTS
    Instructions for installing Ubuntu 16.04LTS can be found here. Please stick to Ubuntu 16.Xs only.

  2. ROS
    Instructions for installing ROS Kinetic Kame can be found here. Please stick to ROS Kinetic Kame only.

  3. Unity
    You can download Unity3D from here and install it by running the executable file downloaded.

Setting up the repository and URSim

Setting up repository

  1. In your Ubuntu terminal enter the following command to git clone the URSim repository:
    git clone https://github.com/srmauvsoftware/URSim.git
  2. Source your environnment:
    source /opt/ros/kinetic/setup.bash
    Create a new catkin workspace:
    mkdir -p ~/catkin_ws/src
    cd ~/catkin_ws/
    catkin_make
  3. Copy the contents of ros directory to the new workspace:
    cd /path/to/repo/ros ~/catkin_ws/src
  4. Install rosbridge:
    sudo apt-get install ros-kinetic-rosbridge-suite
  5. Port forwarding:
    Open your web browser and enter the url for opening the configuration page of your router somewhat similar to the examples below:
    TP Link Routers: http://192.168.0.1
    Asus Routers: http://192.168.1.1

    Find the option for port forwarding. It could be in security settings or advanced setting. Add a new port and ip address to forward and save the settings then restart the router.

Setting up URSim

  1. On your Windows machine, download the repository from here. Extract the downloaded zip file.
  2. Navigate to /path/to/repo/URSim-master/unity/Assets/Scripts and open the file AUV.cs.
  3. Edit the ip address and the forwarded port of your ubuntu machine in the following line in the file:
    ros = new ROSBridgeWebSocketConnection ("<ip address>", <port>); for example:
    ros = new ROSBridgeWebSocketConnection ("ws://192.168.0.100", 9090);

Runnning simulations and using ROS launch files

  1. Running the simulation
    1. Launch Unity3D and after signing in/skipping, click on ‘open’ icon at the top right of the window.
    2. Navigate to /path/to/repo/URSim-master/unity/ to select the project.
    3. When the project opens, click on file->open scene and navigate to \pathtorepo\URSim-master\unity\Assets\Scenes and select the scene to run.
  2. Using ROS launch files Launch files in ROS are very common to both users and developers. They provide a convenient way to start up multiple nodes and a master, as well as other initialization requirements such as setting up parameters. The launch files are written in xml roslaunch is used to open launch files. This is done by specifying the package the launch files are contained in followed by the name of the launch file. We have placed all the launch files in URSim/ros/src/mission_planner/launch/. You can run these launch files as follows: roslaunch launch <launch_file_name>. Eg. roslaunch launch depth_controller.launch. Make sure you have sourced the repository before running any commands.

    We provide you with the following launch files:

    Launch files for controllers

    1. heave_controller.launch
      launches the ‘controller’ node from package ‘pid’ under the namespace ‘heave_controller’.
      Sets values to the following parameters - kp, ki, kd
      upper_limit, lower_limit, windup_limit
      max_loop_frequency, min_loop_frequency
      Remaps
      ‘setpoint’ to ‘/depth_setpoint’
      ‘state’ to ‘/depth’
      ‘control_effort’ to ‘/heave_controller/control_effort’

    2. yaw_controller.launch
      launches the ‘controller’ node from package ‘pid’ under the namespace ‘yaw_controller’.
      Sets values to the following parameters - kp, ki, kd
      upper_limit, lower_limit, windup_limit
      max_loop_frequency, min_loop_frequency
      Remaps
      ‘setpoint’ to ‘/heading_setpoint’
      ‘state’ to ‘/imu/HeadingTrue_degree/theta’
      ‘control_effort’ to ‘/yaw_controller/control_effort’

    3. sway_controller.launch
      launches the ‘controller’ node from package ‘pid’ under the namespace ‘sway_controller’.
      Sets values to the following parameters - kp, ki, kd
      upper_limit, lower_limit, windup_limit
      max_loop_frequency, min_loop_frequency
      Remaps
      ‘setpoint’ to ‘/sway_scale_setpoint’
      ‘state’ to ‘/sway_scale/’
      ‘control_effort’ to ‘/sway_controller/control_effort’

    4. surge_controller.launch
      launches the ‘controller’ node from package ‘pid’ under the namespace ‘surge_controller’.
      Sets values to the following parameters - kp, ki, kd
      upper_limit, lower_limit, windup_limit
      max_loop_frequency, min_loop_frequency
      Remaps
      ‘setpoint’ to ‘/surge_scale_setpoint’
      ‘state’ to ‘/surge_scale/’
      ‘control_effort’ to ‘/surge_controller/control_effort’

    5. controllers.launch
      launches all four controllers - heave, sway, yaw, surge.

    Launch files for thrusters

    1. depth_thruster.launch Launches the node ‘depthThrusters’ in package ‘thrusters’
    2. vector_thruster.launch Launches the node ‘vectorThrusters’ in package ‘thrusters’
    3. thrusters.launch Launches both the nodes - ‘depth_thrusters’ and ‘vectorThrusters’

Table of contents