This is the repository for all code used by Stanford RoboSub's AUV.
The main components of the RoboSub tech stack are:
ROS 2 Jazzy: A middleware framework for robotics development, enabling distributed nodes to communicate efficiently. This project leverages ROS 2's enhanced real-time capabilities, especially for underwater navigation and sensor data processing.
Docker: The project runs within Docker containers, ensuring environment consistency and simplifying setup.
Python/C++: ROS nodes are primarily written in Python, though C++ can also used for performance-critical tasks.
Gazebo Harmonic: Gazebo is used to simulate underwater dynamics, allowing developers to test control algorithms and mission planning in a virtual environment before deploying them to the actual RoboSub hardware.
VSCode with Remote SSH: The development workflow relies heavily on Visual Studio Code's Remote SSH feature, enabling developers to work with identical setups. This setup allows for seamless development from local machines while leveraging the computational resources of remote servers and avoiding setup inconsistencies across the team.
When developing with ROS 2 and Gazebo, it's easy to suddenly be reading outdated documentation online concerning past ROS and Gazebo versions. Make sure you are always looking at sources that refer to ROS 2 Jazzy and Gazebo Harmonic.
sudo apt-get update && sudo apt-get install open-vm-tools-desktop
sudo apt-get install openssh-server && sudo apt install net-tools && sudo apt install git-all && service ssh start
.ssh USER@HOST.local
.logout
, and then type ssh-keygen -t ed25519
leaving all fields as default. Finally type ssh-copy-id -i ~/.ssh/id_ed25519.pub USER@HOST.local
, once more replacing USER and HOST with your own credentials.To access the camera directly from within the Docker in the VM, in a Terminal on the VM (not VSCode!), run the following:
sudo udevadm control --reload-rules && sudo udevadm trigger
followed by
echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules
Then, connect the camera to your laptop. Make sure when prompted on the VM that the camera points to Linux and not Mac.
Contact kevinli7@stanford.edu if you encounter any issues.
Control
+ Shift
+ P
.Remote-SSH: Connect to Host
.+ Add New SSH Host
.ssh USER@HOST.local
.Clone Repository
, Clone from GitHub
, enter the repository name Stanford-AUV/RoboSub
, and finally enter a location to clone the repository to (something like ~/GitHub/
).Reopen in Container
.Terminal
> New Terminal
).Ubuntu 24.04
Clone Repository
, Clone from GitHub
, enter the repository name Stanford-AUV/RoboSub
, and finally enter a location to clone the repository to (something like ~/GitHub/
).Reopen in Container
.Terminal
> New Terminal
).To build the project, in the VSCode Terminal, run:
./build.sh && source install/setup.bash
One built, you can proceed to the running section.
Run:
ros2 launch src/launch/LAUNCH_FILE
For example:
ros2 launch src/launch/control.py
To run a ROS node, please run the following:
ros2 run PACKAGE_NAME NODE_NAME
For example:
ros2 run control thrust_generator
Since simulation requires a GUI, we will only run the simulation code from VSCode. The simulation itself will run directly on the VM.
To use the Gazebo simulator, follow these steps:
xhost +local:docker
./sim.sh
Control
+ C
on the VSCode TerminalAfter launching a launch file, you can view the ROS graph of all nodes and topics currently active. To do so, run the following command in another Terminal:
ros2 run rqt_graph rqt_graph
Make sure to create new nodes inside the according package under the nodes
directory. Make sure to also add that file in the setup.py
file of the package.
To run all unit tests, run:
./test.sh
In case a pep257
test fails, run the following to get more details about the error:
ament_pep257
If you have less than 30 GB total on your machine, contact Scott Hickmann for how to resize to at least 30 GB. If you do have a max storage above 30 GB but still ran out of storage, make sure to clean up unused Docker files. You can do so by running the following command from the VM Terminal:
sudo docker system prune -a -f