diff --git a/source/RobotAPI/libraries/aron/codegeneration/codegenerator/codewriter/cpp/generator/ndarray/Matrix.cpp b/source/RobotAPI/libraries/aron/codegeneration/codegenerator/codewriter/cpp/generator/ndarray/Matrix.cpp index 0fe08b1dc89b46bf0943690064c764843979a1b4..404373a0a4b1c64778d597c15304ba8f30c62d49 100644 --- a/source/RobotAPI/libraries/aron/codegeneration/codegenerator/codewriter/cpp/generator/ndarray/Matrix.cpp +++ b/source/RobotAPI/libraries/aron/codegeneration/codegenerator/codewriter/cpp/generator/ndarray/Matrix.cpp @@ -69,7 +69,11 @@ namespace armarx::aron::codegenerator::cpp::generator std::pair<std::vector<std::pair<std::string, std::string>>, bool> Matrix::getCtorInitializers(const std::string& name) const { - if (type.getDefaultValue() == aron::type::matrix::default_value::IDENTITY) + if (type.getCols() == -1 || type.getRows() == -1) + { + return {{}, false}; + } + else if (type.getDefaultValue() == aron::type::matrix::default_value::IDENTITY) { return {{{name, getInstantiatedCppTypename() + "::Identity()"}}, true}; } @@ -94,7 +98,12 @@ namespace armarx::aron::codegenerator::cpp::generator { CppBlockPtr block_if_data = std::make_shared<CppBlock>(); - if (type.getDefaultValue() == aron::type::matrix::default_value::IDENTITY) + if (type.getCols() == -1 || type.getRows() == -1) + { + block_if_data->addLine(cppAccessor + " = " + getInstantiatedCppTypename() + "();"); + } + + else if (type.getDefaultValue() == aron::type::matrix::default_value::IDENTITY) { block_if_data->addLine(cppAccessor + " = " + getInstantiatedCppTypename() + "::Identity();"); }