rqt_joint_trajectory_controller.utils module

class rqt_joint_trajectory_controller.utils.ControllerLister(namespace='/controller_manager')

Bases: object

Convenience functor for querying loaded controller data.

The output of calling this functor can be used as input to the different controller filtering functions available in this module.

Example usage. Get I{running} controllers of type C{bar_base/bar}:
>>> list_controllers = ControllerLister('foo_robot/controller_manager')
>>> all_ctrl = list_controllers()
>>> running_ctrl = filter_by_state(all_ctrl, 'running')
>>> running_bar_ctrl = filter_by_type(running_ctrl, 'bar_base/bar')
class rqt_joint_trajectory_controller.utils.ControllerManagerLister(namespace='/')

Bases: object

Convenience functor for querying the list of active controller managers.

Useful when frequently updating the list, as it internally performs some optimizations that reduce the number of interactions with the ROS master.

Example usage:
>>> list_cm = ControllerManagerLister()
>>> print(list_cm())
rqt_joint_trajectory_controller.utils.filter_by_hardware_interface(ctrl_list, hardware_interface, match_substring=False)

Filter controller state list by controller hardware interface.

@param ctrl_list: Controller state list @type ctrl_list: [controller_manager_msgs/ControllerState] @param hardware_interface: Controller hardware interface @type hardware_interface: str @param match_substring: Set to True to allow substring matching @type match_substring: bool @return: Controllers matching the specified hardware interface @rtype: [controller_manager_msgs/ControllerState]

rqt_joint_trajectory_controller.utils.filter_by_name(ctrl_list, ctrl_name, match_substring=False)

Filter controller state list by controller name.

@param ctrl_list: Controller state list @type ctrl_list: [controller_manager_msgs/ControllerState] @param ctrl_name: Controller name @type ctrl_name: str @param match_substring: Set to True to allow substring matching @type match_substring: bool @return: Controllers matching the specified name @rtype: [controller_manager_msgs/ControllerState]

rqt_joint_trajectory_controller.utils.filter_by_resources(ctrl_list, resources, hardware_interface=None, match_any=False)

Filter controller state list by claimed resources.

@param ctrl_list: Controller state list @type ctrl_list: [controller_manager_msgs/ControllerState] @param resources: Controller resources @type resources: [str] @param hardware_interface Controller hardware interface where to look for resources. If specified, the requested resources will only be searched for in this interface. If unspecified, all controller hardware interfaces will be searched for; i.e., if a controller claims resources from multiple interfaces, the method will succeed if _any_ interface contains the requested resources (any or all, depending on the value of C{match_any}). Specifying this parameter allows finer control over determining which interfaces claim specific resources. @param match_any: If set to False, all elements in C{resources} must be claimed by the interface specified in C{hardware_interface} (or _any_ interface, if C{hardware_interface} is unspecified) for a positive match. Note that a controller’s resources can contain additional entries than those in C{resources}). If set to True, at least one element in C{resources} must be claimed by the interface specified in C{hardware_interface} (or _any_ interface, if C{hardware_interface} is unspecified) for a positive match. @type match_any: bool @return: Controllers matching the specified hardware interface @rtype: [controller_manager_msgs/ControllerState]

rqt_joint_trajectory_controller.utils.filter_by_state(ctrl_list, ctrl_state, match_substring=False)

Filter controller state list by controller state.

@param ctrl_list: Controller state list @type ctrl_list: [controller_manager_msgs/ControllerState] @param ctrl_state: Controller state @type ctrl_state: str @param match_substring: Set to True to allow substring matching @type match_substring: bool @return: Controllers matching the specified state @rtype: [controller_manager_msgs/ControllerState]

rqt_joint_trajectory_controller.utils.filter_by_type(ctrl_list, ctrl_type, match_substring=False)

Filter controller state list by controller type.

@param ctrl_list: Controller state list @type ctrl_list: [controller_manager_msgs/ControllerState] @param ctrl_type: Controller type @type ctrl_type: str @param match_substring: Set to True to allow substring matching @type match_substring: bool @return: Controllers matching the specified type @rtype: [controller_manager_msgs/ControllerState]

rqt_joint_trajectory_controller.utils.get_controller_managers(namespace='/', initial_guess=None)

Get list of active controller manager namespaces.

@param namespace: Namespace where to look for controller managers. @type namespace: str @param initial_guess: Initial guess of the active controller managers. Typically c{initial_guess} is the output of a previous call to this method, and is useful when periodically checking for changes in the list of active controller managers. Elements in this list will go through a lazy validity check (as opposed to a full name+type API verification), so providing a good estimate can significantly reduce the number of ROS master queries incurred by this method. @type initial_guess: [str] @return: Sorted list of active controller manager namespaces. @rtype: [str]

rqt_joint_trajectory_controller.utils.is_controller_manager(node, namespace)

Check if the input namespace exposes the controller_manager ROS interface.

This method has the overhead of several ROS master queries (one per ROS API member).

@param namespace: Namespace to check @type namespace: str @return: True if namespace exposes the controller_manager ROS interface @rtype: bool