Skip to content

Type mismatch in Blackboard::set() function  #227

@ozgudum

Description

@ozgudum

I am getting this error when I try to set navigation goal in ROS2 navigation2 stack:

Action server failed while executing action callback: "Blackboard::set() failed: once declared, the type of a port shall not change. Declared type [geometry_msgs::msg::PoseStamped_<std::_1::allocator >] != current type [geometry_msgs::msg::PoseStamped<std::__1::allocator >]"

It was weird because it's complaining about port type mismatch but demangled types seems to be identical. Then, I traced the error and it seems to occur in the line below in set() function in blackboard.h

if( locked_type && locked_type != &typeid(T) && locked_type != &temp.type() )

I found out that both returned types are same as locked_type:

demangle(locked_type) -> geometry_msgs::msg::PoseStamped_<std::_1::allocator >
demangle(typeid(T)) -> geometry_msgs::msg::PoseStamped
<std::_1::allocator >
demangle(temp.type()) -> geometry_msgs::msg::PoseStamped
<std::__1::allocator >

but pointers to types are different:

locked_type -> 0x101489060
&typeid(T) -> 0x120fdc3a0
&temp.type()-> 0x120fdc3a0

Interestingly, address mismatch doesn't occur for all types. I wonder why comparison of type addresses was preferred over comparison of type values directly?

If I change the line as below to compare type values directly, I no longer get type mismatch error.

if( locked_type && *locked_type != typeid(T) && *locked_type != temp.type() )

If this change makes sense, I can create a pull request for this fix.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions