Skip to content

std_msgs/{Duration,Time} field mapping is failing #464

@rgov

Description

@rgov

In #106 support was added to map std_msgs/{Duration,Time} to builtin_interfaces/{Duration,Time}. However, this is not working as expected for me for a field of type std_msgs/Duration.

I cannot follow the metaprogramming easily, but AI has summarized it as:

The Factory-based conversions work for direct topic bridging. But when code is generated for custom messages containing std_msgs/Duration fields, it emits calls to the free-standing ros1_bridge::convert_1_to_2() — which doesn't have a specialization for std_msgs::Duration, only ros::Duration.

I think the argument here is that it is missing specializations like the below, but for std_msgs/{Duration,Time}.

template<>
void
convert_1_to_2(
const ros::Duration & ros1_type,
builtin_interfaces::msg::Duration & ros2_msg)
{
ros2_msg.sec = ros1_type.sec;
ros2_msg.nanosec = ros1_type.nsec;
}

There does seem to be some magic for mapping top-level topic types of std_msgs/{Duration,Time} but I don't think it works for field types?

auto factory = get_factory(ros1_type_name, ros2_type_name);
auto ros2_pub = factory->create_ros2_publisher(
ros2_node, ros2_topic_name, publisher_qos);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions