iff-gsc / LADAC

Library for Aircraft Dynamics And Control
GNU General Public License v3.0
80 stars 16 forks source link

ArduPilot interface: generated code contains double data types #5

Open ybeyer opened 2 years ago

ybeyer commented 2 years ago

We updated the ArduPilot interface so that the default data type should be single and that no single data types need to be specified in the code itself. However, at least double parameters from the workspace are generated as doubles in the C++ code in rtwtypes (real_T double ...). As a workaround, the user can manually change "double" to "float" in the generated code if doubles are not desired.

EikeBremers commented 2 years ago

The proposed solution to use the Single Precision Converter does not seem to work. Since the Converter seem to be incompatible with custom simulink library functions.

As a possible solution any constants constants in functions might be initialized by using the superiorfloat function. e.g. x = zeros(size_x,superiorfloat(input_arg)). And thus setting the data type depending on the fuction input (input_arg).