diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/src/ros_message.cpp b/plotjuggler_plugins/ParserROS/rosx_introspection/src/ros_message.cpp index 42b0337fd..f8eb87a29 100644 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/src/ros_message.cpp +++ b/plotjuggler_plugins/ParserROS/rosx_introspection/src/ros_message.cpp @@ -112,25 +112,29 @@ std::vector ParseMessageDefinitions( } } - // adjust types with undefined package type - for (ROSField& field: msg->fields()) + // add to vector + parsed_msgs.push_back( msg ); + known_type.push_back( msg->type() ); + } + + // adjust types with undefined package type + for (auto& msg: parsed_msgs) + { + for (ROSField& field : msg->fields()) { // if package name is missing, try to find msgName in the list of known_type - if( field.type().pkgName().empty() ) + if (field.type().pkgName().empty()) { - for (const ROSType& known_type: known_type) + for (const ROSType& known_type : known_type) { - if( field.type().msgName() == known_type.msgName() ) + if (field.type().msgName() == known_type.msgName()) { - field.changeType( known_type ); + field.changeType(known_type); break; } } } } - // add to vector - parsed_msgs.push_back( msg ); - known_type.push_back( msg->type() ); } std::reverse(parsed_msgs.begin(), parsed_msgs.end());