This repository provides the fmi_adapter package for wrapping functional mockup units (FMUs) for co-simulation of physical models into ROS nodes. FMUs are defined in the FMI standard and can be created with a variety of modeling and simulation tools, including Dymola, MATLAB/Simulink, OpenModelica, SimulationX, and Wolfram System Modeler.
fmi_adapter provides a library with convenience functions based on common ROS types to load an FMU during runtime, retrieve the input, output, and parameter names, set timestamped input values, run the FMU's numeric solver, and query the resulting output.
In detail, this repository contains two ROS packages:
- fmi_adapter provides a generic library and ROS node for loading and running FMUs in ROS-based applications.
- fmi_adapter_examples provides small examples for the use of fmi_adapter.
Technical information on the interfaces and use of these packages is given in the README.md files in the corresponding subfolders.
The software is not ready for production use. It has neither been developed nor tested for a specific use case. However, the license conditions of the applicable Open Source licenses allow you to adapt the software to your needs. Before using it in a safety relevant setting, make sure that the software fulfills your requirements and adjust it according to any applicable safety standards (e.g. ISO 26262).
Clone the repository into a ROS workspace and build it using catkin.
fmi_adapter is open-sourced under the Apache-2.0 license. See the LICENSE file for details.
For a list of other open source components included in fmi_adapter, see the file 3rd-party-licenses.txt.
- Coding style:
- Google's C++ coding style is used, with some minor modifications. The conformance is checked using clang-format. The style definition can be found in .clang-format.
- run_clang-format_in-place.bash reformats all C++ files of the local repository in place according to the style definition.
- Linters:
- The cpplint tool is used to detect common flaws and problems in C++ code. The rule configuration is contained in CPPLINT.cfg.
- The CMakeLists.txt and package description files are checked with catkin_lint.
- Unit tests:
- Unit tests based on rostest+gtest are located in the fmi_adapter/test folder.
- The unit tests use an FMU created with the FMU SDK by QTronic GmbH, cf. 3rd-party-licenses.txt.
The pre-commit.hook file provides a client-side commit hook to check the conformance with the coding style and the linters during every commit. In case of a finding by clang-format or one of the linters, the commit will be rejected. To set this client-side commit hook up, please run ln -s ../../pre-commit.hook .git/hooks/pre-commit
from the local repository root.
Please notice the following issues/limitations:
- fmi_adapter only supports FMUs according to the FMI 2.0 standard.
- fmi_adapter treats all inputs, outputs and parameters of a given FMU as floating-point values (ROS message std_msgs/Float64, C++ type double, FMI type fmi2fmi2_real_t).