![]() |
Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
|
Hey there, C++ developer! Ready to dive into debugging your code like a pro? Letâs make this process smooth and (dare I say) fun with CMake and Visual Studio Code. No stressâjust follow along, and youâll be debugging in no time!
CTRL + SHIFT + P
, search for Dev Container: Rebuild Container
, and voilĂ âyouâre good to go!/usr/bin/g++
or /usr/bin/gcc
âthese are your go-to safe options!
|
---|
Kit selection? Easy. Stick to /usr/bin/g++ or /usr/bin/gcc . |
|
---|
Toolbar = your best friend for building and running. |
Now that youâre all set up, letâs get cracking on debugging your C++ code. Ready? Letâs go!
|
---|
Look for the red dot to set breakpoints like a boss. |
|
---|
Flip that switch to Debug mode when hunting bugs. |
|
---|
Hit that debug button and let's get cracking! |
Testing is a crucial part of development. In this section, you'll use CTest, lcov, and gcovr to ensure your code works perfectly. With the Coverage Gutters extension in VSCode, you can even visualize code coverage right in your editor!
Enable Test and Coverage Modes
Update your CMake configuration to include the following options:
These flags ensure your project builds with test and coverage instrumentation.
Build and Run Your Tests
Click the Build button in VSCode to configure and build the project. This process will also build and run all tests if BUILD_TESTS_MODE
is enabled. To run tests manually, execute:
Or run tests through the bottom toolbar:
|
---|
Click to change the run target. |
|
---|
Select your run target. (Unit or Integration tests) |
|
---|
Run your tests with the play button in the bottom toolbar. |
Generate Code Coverage Reports
If BUILD_CODE_COVERAGE
is enabled, lcov and gcovr will be used to collect and visualize coverage data. The Autonomy_Software project can run the necessary commands to do this for you:
Then, you can display test coverage of files from directly within the VSCode editor. Hit CNTL+SHIFT+P
, and select the Coverage Gutters: Display Coverage
:
When you open files that should be covered by a test, you will see **GREEN** highlights for lines that are executed during a test, and **RED** highlights for lines that are currently untested:
Debugging, testing, and ensuring code coverage doesnât have to be painful. With CMake, CTest, lcov, and gcovr (plus the power of VSCode), youâve got everything you need to catch bugs and write rock-solid code.
Happy debugging and testing! đ