ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I realize this is old, but this Python one liner will give you a dict mapping error codes to error strings. I realize it's ugly and possibly not Pythonic, but it works (assuming all error strings are the only uppercase attributes of ArmNavigationErrorCodes).

dict((getattr(ArmNavigationErrorCodes, key), key) for key in filter(lambda x: x==x.upper(), dir(ArmNavigationErrorCodes)))

I realize this is old, but this Python one liner will give you a dict mapping error codes to error strings. I realize it's ugly and possibly not Pythonic, but it works (assuming all error strings are the only uppercase attributes of ArmNavigationErrorCodes).

dict((getattr(ArmNavigationErrorCodes, key), key) for key in filter(lambda x: x==x.upper(), dir(ArmNavigationErrorCodes)))

Figured someone else out there might be using Python with the arm_navigation stack.

I realize this is old, but this Python one liner will give you a dict mapping error codes to error strings. I realize it's ugly and possibly not Pythonic, but it works (assuming all error strings are the only uppercase attributes of ArmNavigationErrorCodes).

dict((getattr(ArmNavigationErrorCodes, key), key) for key in filter(lambda x: x==x.upper(), dir(ArmNavigationErrorCodes)))dir(ArmNavigationErrorCodes)))

Figured someone else out there might be using Python with the arm_navigation stack.