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

Use rosconsole with argument of type double

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

user23fj239 gravatar image

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

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
1

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

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: http://www.cplusplus.com/reference/cs...

edit flag offensive delete link more

Question Tools

1 follower

Stats

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

Seen: 1,777 times

Last updated: May 01 '16