Ejemplo n.º 1
0
 def _save_data_from_remote(self, get_timeline_response):
     inv = Invalidations()
     if get_timeline_response.success:
         inv.situation_ids_deleted = self.data.reset(
             get_timeline_response.origin.data)
         inv.situation_ids_updated = self.data.update(
             get_timeline_response.situations)
     else:
         #TODO: error ?
         pass
     return inv
Ejemplo n.º 2
0
 def _save_data_from_remote(self, get_scene_response):
     inv = Invalidations()
     if get_scene_response.success:
         inv.node_ids_deleted = self.data.reset(get_scene_response.root_id)
         for node in get_scene_response.nodes:
             for property in node.properties:
                 if property.name == 'meshes' and property.data != '':
                     for mesh_id in property.data.split(','):
                         if self.__meshes.get_mesh_from_remote(mesh_id):
                             inv.mesh_ids_updated.append(mesh_id)
             inv.node_ids_updated.append(self.data.update([node]))
     return inv
Ejemplo n.º 3
0
 def reasoningCallback(self, timer):
     header = Header()
     header.stamp = rospy.Time.now()
     if len(self.input_worlds) > 0:
         world_name = self.input_worlds[0]
         invalidations = Invalidations()
         changes = self.filter(world_name, header, invalidations)
         self.ctx.worlds()[world_name + "_stable"].update(changes, header)
Ejemplo n.º 4
0
 def get_data_from_remote(self, *param):
     returns = Invalidations()
     '''
     try:
         print 'trying'
         returns = self._save_data_from_remote(self.call(*param))
     except Exception as e:
         print 'exeception!!'
         rospy.logerr("[%s::dataProxy] Error occured when saving '%s' data into local data-structure: %s" % (self.client.name, self.service_name, e.message))
     '''
     returns = self._save_data_from_remote(self.call(*param))
     return returns
Ejemplo n.º 5
0
    def changes_callback(self, msg):
        inv = Invalidations()
        inv.node_ids_deleted = self.scene().remove(msg.changes.nodes_to_delete)
        inv.node_ids_updated = self.scene().update(msg.changes.nodes_to_update)

        inv.situation_ids_deleted = self.timeline().remove(
            msg.changes.situations_to_delete)
        inv.situation_ids_updated = self.timeline().update(
            msg.changes.situations_to_update)
        inv.mesh_ids_deleted = msg.changes.meshes_to_delete
        self.meshes().remove(msg.changes.meshes_to_delete)
        u = self.meshes().update(msg.changes.meshes_to_update)
        inv.mesh_ids_updated = u
        if self.__ever_connected:
            self.__on_changes(self.__world_name, msg.header, inv)
Ejemplo n.º 6
0
    def changes_callback(self, msg):
        inv = Invalidations()
        inv.node_ids_deleted = self.scene().remove(msg.changes.nodes_to_delete)
        inv.node_ids_updated = self.scene().update(msg.changes.nodes_to_update)

        inv.situation_ids_updated = self.timeline().update(
            msg.changes.situations_to_update)

        for sit in self.timeline().situations():
            if sit.end.data != rospy.Time(0):
                msg.changes.situations_to_delete.append(sit.id)

        inv.situation_ids_deleted = self.timeline().remove(
            msg.changes.situations_to_delete)

        inv.mesh_ids_deleted = msg.changes.meshes_to_delete
        self.meshes().remove(msg.changes.meshes_to_delete)
        u = self.meshes().update(msg.changes.meshes_to_update)
        inv.mesh_ids_updated = u
        if self.__ever_connected:
            self.__on_changes(self.__world_name, msg.header, inv)
 def reconfigure(self, inputs):
     if len(inputs) > 1 and self.__use_single_input:
         raise RuntimeError("Multiple inputs provided while 'use_single_input' activated.")
     self.ctx.worlds().close()
     self.onReconfigure(inputs)
     for input in inputs:
         self.ctx.worlds()[input].connect(self.onChanges)
         invalidations = Invalidations()
         scene = self.ctx.worlds()[input].scene()
         timeline = self.ctx.worlds()[input].timeline()
         meshes = self.ctx.worlds()[input].meshes()
         for node in scene.nodes():
             invalidations.node_ids_updated.append(node.id)
         for situation in timeline.situations():
             invalidations.situation_ids_updated.append(situation.id)
         for mesh in meshes:
             invalidations.mesh_ids_updated.append(mesh.id)
         header = Header()
         header.stamp = rospy.Time.now()
         self.onChanges(input, header, invalidations)
     self.inputs_worlds = inputs
Ejemplo n.º 8
0
    def apply_changes(self, header, changes):
        invalidations = Invalidations()

        invalidations.node_ids_deleted = self.__scene.remove(
            changes.nodes_to_delete)
        invalidations.node_ids_updated = self.__scene.update(
            changes.nodes_to_update)

        invalidations.situation_ids_deleted = self.__timeline.remove(
            changes.situations_to_delete)
        invalidations.situation_ids_updated = self.__timeline.update(
            changes.situations_to_update)

        for mesh_id in changes.meshes_to_delete:
            del self.__meshes[mesh_id]
            invalidations.mesh_ids_deleted.append(mesh_id)
        for mesh in changes.meshes_to_update:
            self.__meshes[mesh.id] = mesh
            invalidations.mesh_ids_updated.append(mesh.id)
        return invalidations