ROS

NOTICE: This page has been updated as of March 6 2023 with instructions on how to set up the newer ROS Noetic environment, and this guide can no longer be used with the older ROS Melodic. If you followed the older version of this guide, we recommend going through it once again to ensure ROS Noetic is used.

Teams are not required to use the Robotics Operating System (ROS), but interfaces with ROS Noetic are made available to teams. As such, teams intending to use alternatives should expect some additional work in creating bridges equivalent to the Gemini ros_adapter. This guide is equivalent to the official guide from the ROS wiki, and is added simply for convenience.

After booting Ubuntu in your virtual environment:

1. Ensure your Ubuntu repositories are correctly configured. In the 'Software & Updates' application, under the 'Ubuntu Software' tab, ensure the first four checkboxes under 'Downloadable from the Internet' are checked.

2. Allow your computer to download software from ROS' servers by entering the following in the command prompt:

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

3. Set up your keys:

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

4. Install ROS Noetic. You may want to install the desktop-full version by appending '-full' to the end (ros-noetic-desktop-full) which has 2D and 3D simulators and perception.

sudo apt update
sudo apt install ros-noetic-desktop

5. Automatically add ROS environment variables to new bash sessions.

echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

6. Install package dependencies.

sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
sudo rosdep init
rosdep update

7. Create a catkin workspace, clone the Gemini repos.

mkdir -p catkin_ws/src
cd catkin_ws/src
git clone https://github.com/Njord-The-Autonomous-Ship-Challenge/ros_adapter.git
git clone https://github.com/Njord-The-Autonomous-Ship-Challenge/ros_clients.git
git clone https://github.com/Njord-The-Autonomous-Ship-Challenge/ros_scenario.git

8. Open ~/catkin_ws/src/ros_adapter/requirements.txt and change it to match the following:

protobuf==3.17.0
grpcio==1.41.1
grpcio-tools==1.41.1
PyYAML==5.4.1
rospkg==1.4.0
numpy
opencv-python==4.2.0.32
ipdb==0.13.11

9. Install the dependencies.

pip install -r ros_adapter/requirements.txt

10. Since ROS Noetic is using Python3 by default, we need to update a few of the python files since the Gemini project was originally built with Python2. On the first line of the four following python files, change “python2” to “python3”

  • ~/catkin_ws/src/ros_adapter/scripts/client.py

  • ~/catkin_ws/src/ros_adapter/scripts/server.py

  • ~/catkin_ws/src/ros_clients/scripts/force_controller_example_client.py

  • ~/catkin_ws/src/ros_scenario/scripts/scenario_client.py

11. Additionally, in the three following python files, add “from .” (from dot) to the beginning of the import lines that involve __pb2 modules. Don’t mind the part that says “DO NOT EDIT”.

  • ~/catkin_ws/src/ros_adapter/scripts/navigation/navigation_pb2_grpc.py

  • ~/catkin_ws/src/ros_adapter/scripts/sensor_streaming/sensor_streaming_pb2_grpc.py

  • ~/catkin_ws/src/ros_clients/scripts/force_control/force_control_pb2_grpc.py

12. Configure the ros_adapter's network settings to match your virtual machine. First, open the network settings to find the IPv4 IP address used by your VM. Second, open the file ~/catkin_ws/src/ros_adapter/config/server.yaml and change the IP address to match the IP used by your VM.

13. Configure the ros_client's network settings to match your Windows operating system (not the virtual machine). This can be found by typing 'ipconfig' in a Windows terminal. The IPv4 Address will typically begin with 192.168. Enter this IP-address in the config file ~/catkin_ws/src/ros_clients/config/example_client.yaml

14. Initialize the catkin workspace by running the following.

cd ~/catkin_ws
catkin_make
source devel/setup.bash

Last updated