tf2::toMsg throws Error even if I use the same functions as in tf2_geometry_msgs.h
Hey guys I have a Point A and a Pose B. I want the coordinates of A relative to B, I am working with ros2 galactic. Thats my try:
inline geometry_msgs::msg::Point rel_pos(
geometry_msgs::msg::Point A, geometry_msgs::msg::Pose B)
{
tf2::Transform t;
tf2::fromMsg(B, t);
tf2::Vector3 v_in;
tf2::fromMsg(A, v_in);
tf2::Vector3 v_out = t.inverse() * v_in;
geometry_msgs::msg::Point t_out;
tf2::toMsg(v_out, t_out);
return t_out;
}
An this is the code of
tf2::doTransform
from https://github.com/ros/geometry2/blob...
inline
void doTransform(const geometry_msgs::Point& t_in, geometry_msgs::Point& t_out, const geometry_msgs::TransformStamped& transform)
{
tf2::Transform t;
fromMsg(transform.transform, t);
tf2::Vector3 v_in;
fromMsg(t_in, v_in);
tf2::Vector3 v_out = t * v_in;
toMsg(v_out, t_out);
}
Im getting the following Error:
error: no matching function for call to ‘toMsg(tf2::Vector3&, geometry_msgs::msg::Point&)’ 34 | toMsg(v_out, t_out);