This repository contains the source code for all of UBC Sailbot's Network Systems programs. It is made to work as part of Sailbot Workspace, and is not meant to be built as an independent project.
For comprehensive setup instructions, follow our setup guide.
Option A: With sailbot_workspace open, invoke the VSCode build
or debug
task.
Option B: Run /workspaces/sailbot_workspace/build.sh
For example:
ros2 launch network_systems main_launch.py
This is the best option if multiple modules need to be run at once. Launch configurations are found under the config folder. These configurations define which modules to enable/disable and what parameters to use.
If you just want to run a single module, then this is a direct and easy way to do it.
For example:
ros2 run network_systems example --ros-args -p enabled:=true
Not recommended as you cannot pass ROS parameters, so modules may not work by default. Binaries for each module found
under projects can be found under
/workspaces/sailbot_workspace/build/network_systems/projects/{module_name}/{module_name}
.
For example:
/workspaces/sailbot_workspace/build/network_systems/projects/example/example
Unit tests specific to Network Systems is done using GoogleTest. Unit tests are defined per module. For example, under projects/example/test/.
Option A: With sailbot_workspace open, invoke the VSCode test
task.
Option B: Under the sailbot_workspace directory, run /workspaces/sailbot_workspace/test.sh
Both options will run all of UBC Sailbot's tests, including those from other projects. More often than not, this is unnecessary.
This is the preferred way to run and debug tests. When you open a test source file like
the example's, there will be green arrows next to each TEST_F
macro.
Clicking a double green arrow runs a test suite, while clicking single green arrow runs one unit test. Right clicking
either arrow will open a prompt with a debug test option. When running a test via the debug option, we can set
breakpoints and step through our code line by line to resolve issues.
This convenient testing frontend is thank's to the TestMate extension.
Warning: Large failing tests can crash VSCode. If this happens, either lower the size of the tests (ex. reduce the number of iterations) or run the test binary directly.
Test binaries for each module found under projects can be found under
/workspaces/sailbot_workspace/build/network_systems/projects/{module_name}/test_{module_name}
.
For example:
/workspaces/sailbot_workspace/build/network_systems/projects/example/test_example