Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved joint warnings for Single and MultiDofJoints #429

Merged
merged 1 commit into from
Jul 3, 2015

Conversation

mxgrey
Copy link
Member

@mxgrey mxgrey commented Jul 2, 2015

Similar to the previous changes for MultiDofJoints, I've standardized and improved the warnings for SingleDofJoints.

This also fixes a bug that caused warning messages when a zero-valued command was set for passive actuators.

@mxgrey mxgrey mentioned this pull request Jul 2, 2015
@jslee02
Copy link
Member

jslee02 commented Jul 2, 2015

We could consider to use std::endl instead of \n for new line. The difference is that std::endl causes flushing of the output buffer while \n doesn't.

In general, \n would be good for performance by avoiding to flush everytime. However, when we want to know where exactly the message is printed, std::endl would be better. For example, unittest prints warning messages after all the unittests are done so that we don't know which unittest caused which warning messages.

@mxgrey
Copy link
Member Author

mxgrey commented Jul 2, 2015

In general, \n would be good for performance by avoiding to flush everytime.

This is why I prefer \n. I'd rather trust the computer to know when a good time to flush is, or trust the user to flush when it's good for them, instead of assuming that messages should be displayed immediately.

By default, dtwarn and dterr are streaming to std::cerr, and the default behavior of std::cerr is to not do any buffering (i.e. flush immediately), so the only way dtwarn and dterr would not flush right away is if the user intentionally altered that behavior, in which case I don't think we should be forcing it to flush, because the user is probably doing their own flushing management.

@mxgrey
Copy link
Member Author

mxgrey commented Jul 2, 2015

For example, unittest prints warning messages after all the unittests are done so that we don't know which unittest caused which warning messages.

I'm guessing this is the fault of gtest. One thing we could consider is explicitly flushing std::cerr at the end of each test, if gtest is buffering cerr for some reason.

@jslee02
Copy link
Member

jslee02 commented Jul 2, 2015

I see. Maybe it was happened for dtmsg which is streaming to std::cout. I'll double check.

@mxgrey
Copy link
Member Author

mxgrey commented Jul 2, 2015

It's important to note that cerr and cout are completely asynchronous, so messages that are sent out at the same time to each could end up on the terminal in wildly different places. In theory, cerr messages should make it to the terminal before cout messages, but in practice I don't think that's always been the case for me. I'm pretty sure some of the behavior depends on the terminal program itself.

@jslee02 jslee02 added this to the DART 5.0.1 milestone Jul 2, 2015
@jslee02
Copy link
Member

jslee02 commented Jul 3, 2015

The print order of gtest and dtmsg/dtwarn/dterr seems random but mostly in the right order. So let's leave flushing management to the user as you said.

jslee02 added a commit that referenced this pull request Jul 3, 2015
Improved joint warnings for Single and MultiDofJoints
@jslee02 jslee02 merged commit 90d590b into release-5.0 Jul 3, 2015
@jslee02 jslee02 deleted the joint_warning_improvements-5.0 branch August 14, 2015 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants