We are a Duke University club competing in the RoboSub Competition. Check out our website.
Our codebase is split into two repositories:
Our code is Dockerized, making it straightforward to set up and run. See Running Our Docker Images.
Once the containers are up and running, go to Running Our Code.
Our stack is split into two workspaces -- onboard and landside -- each with corresponding Docker containers of the same name. Onboard consists of the code that runs on the robot's internal computer. Landside consists of the code that should be run on your local machine. The corresponding containers are connected via a local network and are configured to share ROS messages. For an in-depth explanation of the containers, see docker.
Our codebase is powered by the Robot Operating System (ROS), and written primarily in Python.
The following components make up our software stack:
The general flow of information between components is shown in the diagram below, from top to bottom:
sensors (IMU, DVL, etc.) cameras
\ / \
\ / \
v / v
Data Pub / Camera View
\ /
Simulation ---> \ Acoustics /
v | v
Sensor Fusion | Computer Vision
\ | /
\ | /
v v v
Task Planning
|
|
v
Joystick ---> Controls
|
| ---> Simulation
v
Offboard Comms
|
|
v
thrusters, actuators, etc.
Download and install the appropriate Docker client.
If you want graphics forwarding over SSH:
Use these instructions when running code on the robot itself.
ssh robot@192.168.1.1
docker run -td --privileged --net=host -e ROBOT_NAME=oogway -v /home/robot/robosub-ros:/root/dev/robosub-ros -v /dev:/dev dukerobotics/robosub-ros:onboard
docker run -td -p 2201:2201 -v ${PWD}:/root/dev/robosub-ros dukerobotics/robosub-ros:landside
robotics
.
ssh -p 2200 root@192.168.1.1
robotics
.
ssh -XY -p 2201 root@localhost
Use these instructions to test code on your computer by simulating the robot's execution. For all docker compose
commands, replace <robot name here>
with the robot name (cthulhu
or oogway
).
To run the containers, clone this repo. In the newly-created directory (robosub-ros
), execute
docker-compose -f docker-compose-<robot name here>.yml up -d
This will pull the images if you don't have them, create a new network that simulates the network we use on our robot, mount the code, and start the containers.
To update the images, or to just pull them without running them, use docker-compose -f docker-compose-<robot name here>.yml pull
.
SSH into the onboard container. Password is robotics
.
ssh -p 2200 root@localhost
In a new tab, SSH into the landside container. Password is robotics
.
ssh -XY -p 2201 root@localhost
Now go to Running Our Code. Also set up our simulation.
To stop and delete both containers and their network, in the robosub-ros
directory, execute
docker-compose -f docker-compose-<robot name here>.yml down
:warning: All commands should be run inside of a Docker container.
The following needs to be done once at the beginning, and then later only when making larger structural changes to the workspace (such as adding a package).
We use a custom build script that simplifies the process of building and overlaying catkin workspaces.
To build our workspaces for ROS, in the ~/dev/robosub-ros
directory, execute
./build.sh <workspace>
where <workspace>
is the workspace to build, either onboard
or landside
.
Once the build script has finished executing, source the setup file using
source <workspace>/catkin_ws/devel/setup.bash
where <workspace>
is the workspace you just built. This will also be the last line that is printed from the build script, so you can also just copy and execute that.
You should now be ready to use our packages and ROS.
Here are some common launch configurations for both pool and local testing.
Test controls using test_state_publisher.py
roslaunch execute motion.launch
rosrun controls test_state_publisher.py
rosservice call /enable_controls true
but change the first line for local testing in the simulation
roslaunch execute motion.launch sim:=true
Pool testing with joystick (see Joystick Documentation)
Useful commands for testing
rosservice call /enable_controls false
rostopic echo /state
Reset state to zero
rosservice call /set_pose # tab complete, then change w from 0.0 to 1.0
or here's the full command for copy-pasting:
rosservice call /set_pose "pose:
header:
seq: 0
stamp:
secs: 0
nsecs: 0
frame_id: ''
pose:
pose:
position: {x: 0.0, y: 0.0, z: 0.0}
orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0}
covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]"
To clean the build outputs from a workspace (build, devel, and logs folders), in the ~/dev/robosub-ros
directory, execute
./build.sh clean <workspace>
where <workspace>
is either onboard or landside. If you would like to clean all workspaces, then you may simply execute
./build.sh clean
To contribute to this repository, see CONTRIBUTING.md.