Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix] fix parsing of custom types added multiple times in messages #769

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,25 +112,29 @@ std::vector<ROSMessage::Ptr> 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());
Expand Down