Prev-Talk | Next-Talk | All-Talks | Talks-Sorted | MOOS-DAWG'19

Talk-12: Leveraging the Compiler: Static Analysis in Marine Robotic Systems

Toby Schneider, GobySoft, LLC

Given the complication and cost of fielding marine systems, we are all keen to find and fix bugs as early as possible. The earliest step is often compilation of our code (assuming C++ which is widely used for MOOS and Goby). The new C++ standards (C++11, C++14, C++17) put increasing emphasis on writing generic and statically checkable code. In addition, the modular Clang C++ compiler makes it easier than ever to write tools using parts of the compiler.

Rather than just use compilation to ensure our code is syntatically and grammatically compliant from a standpoint of the core C++ language, we can leverage this system to explore a much richer set of compile time checks. This talk will review a variety of such techniques that I have found useful in building marine robotics software using C++ and deployed in the MOOS, Goby, and ROS middlewares.

Some of these techniques presented are fully implemented and usable now; others are more conceptual and are partially intended to spur discussion and spark new ideas.

The ready to use category includes:

  • static dimensional analysis using Boost Units and DCCL
  • class-based state machines using Boost Statechart
  • the Clang compiler's static analyzer ("scan") and Doxygen comment checking.
  • using Graphviz to produce a visual representation of the IvP behavior mode structure.

For the more conceptual category I will present:

  • using the Clang AST to produce graphs of and assert connections between published and subscribed variables in Goby3
  • ideas on how a similar approach might be applied to a revised implementation of the IvPBehavior superclass to allow static analysis of the behavior domains.

Further NOTE:

The companion examples repo can be found here:



  • ASVs
  • Ocean Sampling