class NodeSetDestinationGUI(NodeGUI):
    def __init__(self):
        super(NodeSetDestinationGUI,self).__init__()
        self.location = NamedComboBox('Destination')
        self.robot = NamedComboBox('Robot')
        self.layout_.addWidget(self.robot)
        self.layout_.addWidget(self.location)

        self.robots_list = get_params(id="robot").data
        self.locations_list = get_params(id="location").data

        self.robot.add_items(self.robots_list)
        self.location.add_items(self.locations_list)

    def generate(self,parent=None):

        if len(self.robots_list) < 1:
            return 'ERROR: no robots defined!'
        elif len(self.locations_list) < 1:
            return 'ERROR: no locations defined!'

        robot = self.robots_list[int(self.robot.get())]
        location = self.locations_list[int(self.robot.get())]

        if all([self.name.full(),self.label.full()]):
            return NodeSetDestination(parent,self.get_name(),self.get_label(),
                    robot, location)
        else:
            return 'ERROR: node not properly defined'
class NodeMoveToDestinationGUI(NodeGUI):
    def __init__(self):
        super(NodeMoveToDestinationGUI,self).__init__()
        self.robot = NamedComboBox('Robot')
        self.layout_.addWidget(self.robot)

        self.robots_list = get_params(id="robot").data

        self.robot.add_items(self.robots_list)

        self.time = NamedField('Time Limit','0.0')
        self.tolerance = NamedField('Tolerance','0.1')
        self.layout_.addWidget(self.time)
        self.layout_.addWidget(self.tolerance)

    def generate(self,parent=None):

        if len(self.robots_list) < 1:
            return 'ERROR: no robots defined!'
        elif len(self.locations_list) < 1:
            return 'ERROR: no locations defined!'

        robot = self.robots_list[int(self.robot.get())]

        if all([self.name.full(),self.label.full(), self.time.full(), self.tolerance.full()]):
            return NodeMoveToDestination(parent,self.get_name(),self.get_label(),
                    robot,self.time.get(),self.tolerance.get())
        else:
            return 'ERROR: node not properly defined'
Example #3
0
class SaveParameterGUI(NodeGUI):
    def __init__(self):
        super(SaveParameterGUI,self).__init__()
        self.type_ = NamedComboBox('Item Type')
        self.file_ = NamedField('Item Name','')
        self.layout_.addWidget(self.type_)
        self.layout_.addWidget(self.file_)
        #self.param_ = NamedComboBox('Parameter')
        self.param_ = NamedField('ROS Parameter','')
        self.layout_.addWidget(self.param_)

        type_list = getList('')
        self.type_.add_items(type_list.entries)

        #self.param_.add_items(rosparam.get_params(''))

    def generate(self):

        if len(self.type_list.entries) > 0:
            tname = self.type_list.entries[int(self.type_.get())]
        else:
            return 'ERROR: no types found!'

        if all([self.name.full(),self.label.full()],self.file_.full()):
            return SaveParameter(self.get_name(),self.get_label(),
                    tname, self.file_.get(), self.param_.get())
        else:
            return 'ERROR: node not properly defined'
Example #4
0
class SaveParameterGUI(NodeGUI):
    def __init__(self):
        super(SaveParameterGUI, self).__init__()
        self.type_ = NamedComboBox('Item Type')
        self.file_ = NamedField('Item Name', '')
        self.layout_.addWidget(self.type_)
        self.layout_.addWidget(self.file_)
        #self.param_ = NamedComboBox('Parameter')
        self.param_ = NamedField('ROS Parameter', '')
        self.layout_.addWidget(self.param_)

        type_list = getList('')
        self.type_.add_items(type_list.entries)

        #self.param_.add_items(rosparam.get_params(''))

    def generate(self):

        if len(self.type_list.entries) > 0:
            tname = self.type_list.entries[int(self.type_.get())]
        else:
            return 'ERROR: no types found!'

        if all([self.name.full(), self.label.full()], self.file_.full()):
            return SaveParameter(self.get_name(), self.get_label(), tname,
                                 self.file_.get(), self.param_.get())
        else:
            return 'ERROR: node not properly defined'
class NodeConditionExistsGUI(NodeGUI):
    def __init__(self):
        super(NodeConditionExistsGUI,self).__init__()
        self.predicate = NamedComboBox('Entity Type')
        self.param1 = NamedComboBox('Identifier')
        self.layout_.addWidget(self.predicate)
        self.layout_.addWidget(self.param1)

        self.predicate.add_items(entity_types)

    def generate(self,parent=None):
        idx = int(self.predicate.get())
        if all([self.name.full(),self.label.full()]):
            return NodeConditionExists(parent,self.get_name(),self.get_label(),self.predicate.get(),
                    self.param1.get())
        else:
            return 'ERROR: node not properly defined'
Example #6
0
class LoadTextFromFileGUI(NodeGUI):
    def __init__(self):
        super(LoadTextFromFileGUI,self).__init__()
        self.type_ = NamedComboBox('Item Type')
        self.file_ = NamedComboBox('Item Name')
        self.layout_.addWidget(self.type_)
        self.layout_.addWidget(self.file_)

        self.type_list = getList('')
        self.type_.add_items(self.type_list.entries)
        self.type_.interface().currentIndexChanged.connect(self.selected)
        self.file_list = []

        if len(self.type_.get()) > 0:
            self.file_list = getList(self.type_list.entries[int(self.type_.get())])
            self.file_.add_items(self.file_list.entries)

    def selected(self,t):
        value = str(t)
        self.file_list = getList(self.type_list.entries[int(self.type_.get())])
        self.file_.interface().clear()
        self.file_.add_items(self.file_list.entries)

    def generate(self):

        if len(self.file_list.entries) > 0:
            fname = self.file_list.entries[int(self.file_.get())]
        else:
            return 'ERROR: no items found!'

        if len(self.type_list.entries) > 0:
            tname = self.type_list.entries[int(self.type_.get())]
        else:
            return 'ERROR: no types found!'

        print fname
        print tname

        if all([self.name.full(),self.label.full()]):
            return LoadText(self.get_name(),self.get_label(),
                    fname, tname)
        else:
            return 'ERROR: node not properly defined'
Example #7
0
class LoadTextFromFileGUI(NodeGUI):
    def __init__(self):
        super(LoadTextFromFileGUI, self).__init__()
        self.type_ = NamedComboBox('Item Type')
        self.file_ = NamedComboBox('Item Name')
        self.layout_.addWidget(self.type_)
        self.layout_.addWidget(self.file_)

        self.type_list = getList('')
        self.type_.add_items(self.type_list.entries)
        self.type_.interface().currentIndexChanged.connect(self.selected)
        self.file_list = []

        if len(self.type_.get()) > 0:
            self.file_list = getList(self.type_list.entries[int(
                self.type_.get())])
            self.file_.add_items(self.file_list.entries)

    def selected(self, t):
        value = str(t)
        self.file_list = getList(self.type_list.entries[int(self.type_.get())])
        self.file_.interface().clear()
        self.file_.add_items(self.file_list.entries)

    def generate(self):

        if len(self.file_list.entries) > 0:
            fname = self.file_list.entries[int(self.file_.get())]
        else:
            return 'ERROR: no items found!'

        if len(self.type_list.entries) > 0:
            tname = self.type_list.entries[int(self.type_.get())]
        else:
            return 'ERROR: no types found!'

        print fname
        print tname

        if all([self.name.full(), self.label.full()]):
            return LoadText(self.get_name(), self.get_label(), fname, tname)
        else:
            return 'ERROR: node not properly defined'