Skip to content

ROS 1 and ROS 2

rajat edited this page Oct 5, 2021 · 1 revision

Integration with ROS

This project has been tested on ROS Melodic, Noetic, and ROS 2 Eloquent. This section will deal with the instructions for the ROS side of the project. The RosBridgelibrary used on the ROS side is part of rosbridge_suite. We used a WebSocket to create a connection with Unity. The exchange of information happens over this connection, including all the video feeds and the parameters.

For ROS 1

  1. Install ROSBridge suite on your Linux machine.

    $ sudo apt-get install ros-<rosdistro>-rosbridge-suite
  2. Source your ROS distro and run the WebSocket launch file.

    $ source /opt/ros/<rosdistro>/setup.bash
    $ roslaunch rosbridge_server rosbridge_websocket.launch

    This will also run 'roscore.'

  3. Check the host IP address in a new terminal using -

    $ hostname -I

    Note: If you are running Unity and ROS on the same system, the IP address would be 'ws://localhost:9090'

  4. Open a new terminal and source your ros distro. Then make a workspace with a package inside having rospy as a dependency and run the script in the 'ROS' folder of this repository.

For ROS 2

The rosbridge_suite currently does not support ROS 2 officially. But there is a pull request (https://github.com/RobotWebTools/rosbridge_suite/pull/493) to the repository for ROS 2 support. We use the contents of that pull request to set up the rosbridge connection for ROS 2.

  1. Clone the rosbridge_suite repository to your system.

    $ git clone https://github.com/RobotWebTools/rosbridge_suite.git
  2. Shift to the latest commit of the ROS 2 support pull request using GitHub CLI.

    $ gh pr checkout 493
  3. Build the library on your system and source your ROS 2 distro.

    $ source /opt/ros/eloquent/setup.sh
    $ cd rosbridge_suite
    $ ./rosbridge_suite$ colcon build
  4. Source the setup.bash of the rosbridge library.

    $ ./rosbridge_suite $ source install/setup.bash
  5. Run the WebSocket script.

    $. /rosbridge_suite $ ros2 run rosbridge_server rosbridge_websocket

Clone this wiki locally