Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.
This repository was archived by the owner on May 31, 2025. It is now read-only.

fromMsg(const PoseWithCovarianceStamped&, tf2::Stamped<tf2::Transform>&) is broken #441

@gleichdick

Description

@gleichdick

While I was trying to do some coverage tests for #433 I noticed that tf2::fromMsg(const geometry_msgs::PoseWithCovarianceStamped&, tf2::Stamped<tf2::Transform>&) (defined in tf2_geometry_msgs.h line 594) calls fromMsg(const geometry_msgs::PoseWithCovariance&, tf2::Transform&) which not defined.

Steps to reproduce:
Compile the snipped

#include <tf2_geometry_msgs/tf2_geometry_msgs.h>

int main() {
   const geometry_msgs::PoseWithCovarianceStamped msg;
   tf2::Stamped<tf2::Transform> t;
   fromMsg(msg, t);
}

with g++ -otest $(pkg-config --cflags tf2_geometry_msgs) snippet.cpp $(pkg-config --libs tf2_geometry_msgs), the error message will be

/tmp/ccCqjqOB.o: In function `tf2::fromMsg(geometry_msgs::PoseWithCovarianceStamped_<std::allocator<void> > const&, tf2::Stamped<tf2::Transform>&)':
test2.cpp:(.text._ZN3tf27fromMsgERKN13geometry_msgs26PoseWithCovarianceStamped_ISaIvEEERNS_7StampedINS_9TransformEEE[_ZN3tf27fromMsgERKN13geometry_msgs26PoseWithCovarianceStamped_ISaIvEEERNS_7StampedINS_9TransformEEE]+0x8c): undefined reference to `void tf2::fromMsg<geometry_msgs::PoseWithCovariance_<std::allocator<void> >, tf2::Transform>(geometry_msgs::PoseWithCovariance_<std::allocator<void> > const&, tf2::Transform&)'
collect2: error: ld returned 1 exit status

When Line 599 is changed to

-  fromMsg(msg.pose, tmp);
+  fromMsg(msg.pose.pose, tmp);

it compiles (but I have no clue whether the conversation is correct).

The methods were introduced with #282, maybe @RobertBlakeAnderson can provide an unit test which verifies the fromMsg method?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions