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

Joint limits debug helper functionality #215

Open
wants to merge 2 commits into
base: indigo-devel
Choose a base branch
from

Conversation

davetcoleman
Copy link
Member

Currently there is no easy way to tell when the joint_limits_interface is limiting joints, but it can be very helpful in debugging why your trajectory isn't moving the way it should to get feedback during testing. This well documented debug code is disabled by default (not even compiled) but allows one to see information about joint limits and usage of them.

If other maintainers like this addition, we can add the debug to all types of joint_limits_interfaces, not just the position joint limit.

@bmagyar
Copy link
Member

bmagyar commented Apr 19, 2016

This sounds useful but do you think you could change the implementation slightly so that it is more of a runtime feature? I haven't thought of realtime implications, but having to recompile & change the macro is only a small step up from writing the prints by hand.

It could be published on the diagnostics perhaps?

@davetcoleman
Copy link
Member Author

I can just remove all the changes in joint_limits_interface.h, but what do you say to the print() function - IMHO all classes should usually have those

@bmagyar
Copy link
Member

bmagyar commented May 6, 2016

👍 for the print method, it is good to have inspection tools

// Helper function for debuggging, not realtime safe
void print()
{
std::cout << "min_position " << min_position << std::endl;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pedantic: I'd only use std::endl in the last line, and use "\n" instead for all the others, to avoid flushing for each line: http://en.cppreference.com/w/cpp/io/manip/endl

@@ -111,6 +111,27 @@ class PositionJointSaturationHandle
}

const double cmd = internal::saturate(jh_.getCommand(), min_pos, max_pos);

// Optional helper code for debugging, not realtime safe ----------
#define USE_JOINT_LIMIT_DEBUG // Show warnings when joint limits exceeded

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the impression that this #define should be defined in the CMakeLists.txt as a cmake option (https://cmake.org/cmake/help/v3.0/command/option.html):

option(BUILD_WITH_JOINT_LIMIT_DEBUG "Build with Joint Limit Debugging mode" OFF)
if(BUILD_WITH_JOINT_LIMIT_DEBUG)
  add_definitions(-DUSE_JOINT_LIMIT_DEBUG)
endif(BUILD_WITH_JOINT_LIMIT_DEBUG)

@efernandez
Copy link

efernandez commented Oct 30, 2016

@bmagyar Unfortunately, diagnostic publishers aren't RT-safe.

However, I'm of the opinion we should add diagnostics anyway, with a flag to enable them (disabled by default). After all, sometimes is legal to break RT for debugging purposes, or even some people don't even have RT constraints and can benefit from diagnostics.

Either way, IMHO this is probably very low level for a diagnostic message. I don't know, it'd depend on the frequency it gets published, and the level of detail (in terms of the information provided).

@bmagyar
Copy link
Member

bmagyar commented Oct 30, 2016

👍 for making it optional, I'd help a lot when in trouble

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants