Ask Your Question

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

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:

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


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

Seen: 745 times

Last updated: May 01 '16