Ask Your Question
0

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
1

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

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

Stats

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

Seen: 938 times

Last updated: May 01 '16