-
Notifications
You must be signed in to change notification settings - Fork 308
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
base: indigo-devel
Are you sure you want to change the base?
Conversation
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? |
I can just remove all the changes in |
👍 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; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
@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). |
👍 for making it optional, I'd help a lot when in trouble |
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.