ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Use rosconsole with argument of type double

asked 2016-05-01 09:33:30 -0600

user23fj239 gravatar image

updated 2016-05-01 09:50:26 -0600

The wiki does not state which argument type rosconsole takes. How do I get the double printed with %d, the conversion to int is obviously working but not right. mmh

double distance = 0.1;
int tmp1 = int(distance);
ROS_DEBUG_THROTTLE(1,"min:%d", tmp1);

In case I use type double it wount compile

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-05-01 12:36:50 -0600

ahendrix gravatar image

The logging statements in C++ use printf-style formatting. For doubles, you should use the %f format specifier.

There are lots of good documents about the printf format types on the internet; for example:

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-05-01 09:33:30 -0600

Seen: 1,734 times

Last updated: May 01 '16