def _on_cm_change(self, cm_ns):
     self._cm_ns = cm_ns
     if cm_ns:
         self._list_controllers = ControllerLister(cm_ns)
         self._update_jtc_list()
     else:
         self._list_controllers = None
    def __init__(self, ns="left_arm/"):

        self._ns = ns
        self._prefix = "controller_manager"
        self._cm_ns = self._ns + self._prefix
        self._service_names = [
            "list_controllers", "unload_controller", "load_controller",
            "switch_controller"
        ]

        load_srv_name = self._cm_ns + "/load_controller"
        self._load_srv = rospy.ServiceProxy(load_srv_name,
                                            LoadController,
                                            persistent=True)
        unload_srv_name = self._cm_ns + "/unload_controller"
        self._unload_srv = rospy.ServiceProxy(unload_srv_name,
                                              UnloadController,
                                              persistent=True)
        switch_srv_name = self._cm_ns + "/switch_controller"
        self._switch_srv = rospy.ServiceProxy(switch_srv_name,
                                              SwitchController,
                                              persistent=True)

        list_srv_name = self._cm_ns + "/list_controllers"
        self._list_srv = rospy.ServiceProxy(list_srv_name,
                                            ListControllers,
                                            persistent=True)

        list_types_srv_name = self._cm_ns + "/list_controller_types"
        self._list_types_srv = rospy.ServiceProxy(list_types_srv_name,
                                                  ListControllerTypes,
                                                  persistent=True)

        self._controller_lister = ControllerLister(self._cm_ns)
Esempio n. 3
0
 def _on_cm_change(self, cm_ns):
     self._cm_ns = cm_ns
     if cm_ns:
         self._list_controllers = ControllerLister(cm_ns)
         # NOTE: Clear below is important, as different controller managers
         # might have controllers with the same name but different
         # configurations. Clearing forces controller re-discovery
         self._widget.jtc_combo.clear()
         self._update_jtc_list()
     else:
         self._list_controllers = None
    def __init__(self, ns="franka_ros_interface", synchronous_pub = False, sim = False):

        self._ns = ns if ns[0] == '/' else '/' + ns
        self._prefix = "/controller_manager"
        self._cm_ns = self._prefix
        self._service_names = ["list_controllers",
                             "unload_controller",
                             "load_controller",
                             "switch_controller"]


        load_srv_name = self._cm_ns + "/load_controller"
        self._load_srv = rospy.ServiceProxy(load_srv_name,
                                                LoadController,
                                                persistent=True)
        unload_srv_name = self._cm_ns + "/unload_controller"
        self._unload_srv = rospy.ServiceProxy(unload_srv_name,
                                                  UnloadController,
                                                  persistent=True)
        switch_srv_name = self._cm_ns + "/switch_controller"
        self._switch_srv = rospy.ServiceProxy(switch_srv_name,
                                                  SwitchController,
                                                  persistent=True)

        list_srv_name = self._cm_ns + "/list_controllers"
        self._list_srv = rospy.ServiceProxy(list_srv_name,
                                                  ListControllers,
                                                  persistent=True)

        list_types_srv_name = self._cm_ns + "/list_controller_types"
        self._list_types_srv = rospy.ServiceProxy(list_types_srv_name,
                                                  ListControllerTypes,
                                                  persistent=True)

        self._in_sim = sim

        self._controller_lister = ControllerLister(self._cm_ns)

        if self._in_sim:
            self._non_motion_controllers = [self._ns[1:] + '/custom_franka_state_controller', self._ns[1:] + '/panda_gripper_controller', self._ns[1:] + '/effort_joint_gravity_controller', self._ns[1:] + '/joint_state_controller']
        else:
            self._non_motion_controllers = [self._ns[1:] + '/custom_franka_state_controller',self._ns[1:] + '/franka_state_controller']

        self._assert_one_active_controller()

        self._state_subscriber = rospy.Subscriber("%s/motion_controller/arm/joint_controller_states" %(self._ns),
                                                    JointControllerStates, self._on_controller_state, queue_size = 1,
                                                    tcp_nodelay = True)

        self._param_config_clients = {}
        self._dont_start_config_client = False


        rospy.on_shutdown(self._clean_shutdown)
Esempio n. 5
0
    def _on_cm_change(self, cm_ns):
        self._cm_ns = cm_ns

        # Setup services for communicating with the selected controller manager
        self._set_cm_services(cm_ns)

        # Controller lister for the selected controller manager
        if cm_ns:
            self._controller_lister = ControllerLister(cm_ns)
            self._update_controllers()
        else:
            self._controller_lister = None
Esempio n. 6
0
 def _on_cm_change(self, cm_ns):
     self._cm_ns = cm_ns
     self._list_controllers = ControllerLister(cm_ns) if cm_ns else (
         lambda: [])
     self._update_controllers_list()