Skip to content

ROS 2 system to control a robot for the RoboSub Competition.

Notifications You must be signed in to change notification settings

DukeRobotics/robosub-ros2

Repository files navigation

Duke Robotics Club - RoboSub ROS 2

The Duke Robotics Club is a student organization of Duke University that develops Autonomous Underwater Vehicles (AUVs) for the RoboSub competition. Check out our website for more information about our club and projects.

This repository contains all code required for running and testing our AUVs. The code is built on the Robot Operating System (ROS) 2 framework. We use the Jazzy Jalisco distribution of ROS 2.

We are currently in the process of migrating our codebase from ROS 1 to ROS 2. The ROS 1 codebase can be found in the robosub-ros repository.

Set Up the Repository and Development Environment

Setting up the repository and development enviornment is an involved process. The full process is documented in the SETUP.md file.

Build Packages

  1. Open a terminal in the Docker container.
  2. Navigate to the root of the repository /root/dev/robosub-ros2.
  3. Run the following command to build all packages:
    source build.sh
    • This command builds all packages in the core and onboard workspaces.
  4. You are now ready to run the code!

See SCRIPTS.md for more information about how to use build.sh and other scripts at the root of the repository.

Foxglove

We use Foxglove Studio for visualizing and debugging our code. Foxglove Studio is a web-based tool that allows you to visualize ROS 2 topics and services in real-time.

To use Foxglove Studio:

  1. Open a terminal in the Docker container.
  2. Run the following command to start the Foxglove bridge:
    fg-ws
    • This is an alias that starts the Foxglove bridge, which enables Foxglove Studio to connect to the ROS 2 network.
    • The bridge opens a WebSocket on port 28765. This port is mapped to port 28765 on the host machine, so you can connect to the WebSocket from your host machine.
  3. Open Foxglove Studio and connect to the WebSocket at ws://IP_ADDRESS:28765.
    • Replace IP_ADDRESS with the IP address of the host machine. If you are running the Docker container locally, you can use localhost as the IP address.

Linting

To ensure code quality and consistent formatting, we use the following linters:

The linters can be accessed via the CLI provided by lint.py. This CLI is also used by the GitHub Actions build-and-lint workflow.

To lint all code in the repository:

  1. Open a terminal in the Docker container.
  2. Navigate to the root of the repository /root/dev/robosub-ros2.
  3. Run the following command:
    ./lint.py
    • This command lints all Python, C++, and Bash code in the repository.
    • Any linting errors or warnings will be displayed in the terminal. See lint.py in SCRIPTS.md for more information about the CLI provided by lint.py.