Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
void geoCallback(const geometry_msgs::TransformStampedConstPtr& pose){
    ROS_INFO(pose->transform.translation.x);
}

There is a version of ROS_INFO(..) that takes only a single argument, but that argument must then be a string, not a single double (float64 is the name of the rosmsg IDL type, not a C++ type).

This is not Python, so you cannot just do print (double(123)).

As mentioned in #q12837, ROS_INFO(..) and the other ROS_*(..) logging macros support printf arguments, so in order to print a single double, you'd do something like:

ROS_INFO("%f", pose->transform.translation.x);

See also wiki/roscpp/Overview/Logging - Log Statements.

void geoCallback(const geometry_msgs::TransformStampedConstPtr& pose){
    ROS_INFO(pose->transform.translation.x);
}

There is a version of ROS_INFO(..) that takes only a single argument, but that argument must then be a string, string (well, a char* I believe, but basically a string), not a single double (float64 is the name of the rosmsg IDL type, not a C++ type).

This is not Python, so you cannot just do print (double(123)).

As mentioned in #q12837, ROS_INFO(..) and the other ROS_*(..) logging macros support printf arguments, so in order to print a single double, you'd do something like:

ROS_INFO("%f", pose->transform.translation.x);

See also wiki/roscpp/Overview/Logging - Log Statements.

void geoCallback(const geometry_msgs::TransformStampedConstPtr& pose){
    ROS_INFO(pose->transform.translation.x);
}

There is a version of ROS_INFO(..) that takes only a single argument, but that argument must then be a string (well, a char* I believe, but basically a string), not a single double (float64 is the name of the rosmsg IDL type, not a C++ type).

This is not Python, so you cannot just do print (double(123))(float(123)).

As mentioned in #q12837, ROS_INFO(..) and the other ROS_*(..) logging macros support printf arguments, so in order to print a single double, you'd do something like:

ROS_INFO("%f", pose->transform.translation.x);

See also wiki/roscpp/Overview/Logging - Log Statements.