Esempio n. 1
0
    def __init__(self, config, lang=None):
        """
        Constructor method
        """

        self.config = config
        self.lang = lang
        self.subscribers = Subscribers(config)
        self.index = Index(self.config)
Esempio n. 2
0
    def __init__(self, config, lang=None):
        """
        Constructor method
        
        @param config: configuration
        @param lang: language
        """

        self.config = config
        self.lang = lang
        self.subscribers = Subscribers(config)
        self.index = Index(self.config)
Esempio n. 3
0
	def __init__(self):
		#self.rate = rospy.Rate(10)
		self.subs=Subscribers()	
		self.commands=Commands()	
		self.pose = PoseStamped()
		self.comp=Computations()
		self.setpoint_publisher = rospy.Publisher("/mavros/setpoint_position/local", PoseStamped, queue_size=10)
Esempio n. 4
0
 def __init__(self, config, lang=None):
     """
     Constructor method
     """
     
     self.config = config
     self.lang = lang
     self.subscribers = Subscribers(config)
     self.index = Index(self.config)
Esempio n. 5
0
 def __init__(self, config, lang=None):
     """
     Constructor method
     
     @param config: configuration
     @param lang: language
     """
     
     self.config = config
     self.lang = lang
     self.subscribers = Subscribers(config)
     self.index = Index(self.config)
	def __init__(self):
		rospy.init_node("test_mission",log_level=rospy.INFO)		#initialize the pixhawk node
		print('node initialized')
		self.rate=rospy.Rate(10)
		self.subs=Subscribers()						#initialize streaming of subscribers
		self.comp=Computations()			
		self.commands=Commands()
		self.navigation=Navigation()
		self.arrow=Arrow()						#object for arrow detection class
		self.road_follow=RoadFollow()					#object for road detection class
		#initialize the publishers
		self.setpoint_publisher = rospy.Publisher("/mavros/setpoint_position/local", PoseStamped, queue_size=10)
	    	self.setvel_publisher = rospy.Publisher("/mavros/setpoint_velocity/cmd_vel", TwistStamped, queue_size = 10)
	    	self.setaccel_publisher = rospy.Publisher("/mavros/setpoint_accel/accel",Vector3Stamped,queue_size=10)
		print('Publishers initialized')
Esempio n. 7
0
 def __init__(self, config):
     """Constructor method"""
     
     self.config = config
     self.subscribers = Subscribers(config)
     self.index = Index(self.config.get('dir') + 'index.rdf')
Esempio n. 8
0
class MailingList:
    
    def __init__(self, config, lang=None):
        """
        Constructor method
        """
        
        self.config = config
        self.lang = lang
        self.subscribers = Subscribers(config)
        self.index = Index(self.config)
        
    def __createDir(self):
        if not (os.path.exists(self.config.get('dir'))):
            os.mkdir(self.config.get('dir'))
        
    def __parse(self):
        """
        Parse mailingg list and load all
        indexes into memory
        """
        
        previous = None
        
        mbox = Mbox(self.config.get('mbox'))
        messages = 0
        message = mbox.nextMessage()
        
        while(message != None):
            #fisrt load message
            messages += 1
            msg = Message(message, self.config)
            
            #index it
            self.index.add(msg)
            self.subscribers.add(msg)
            subscriber = self.subscribers.get(msg.getFromMail())
            msg.setSender(subscriber)
            
            #parent message (refactor)
            inReplyTo = msg.getInReplyTo()
            if (inReplyTo != None):
                parent = self.index.get(inReplyTo)
                if (parent != None):
                    msg.setParent(parent) #link child with parent
                    parent.addChild(msg) #and parent with child
                    
            #and previous and next by date
            if (previous != None):
                previous.setNextByDate(msg)
                msg.setPreviousByDate(previous)
            
            previous = msg
            
            #and continue with next message
            message = mbox.nextMessage()

        self.messages = messages
    
    def publish(self):
        """
        Publish the messages
        """
        
        self.__createDir()
        
        #fisrt lap
        self.__parse()
        
        #and second lap
        mbox = Mbox(self.config.get('mbox'))
        messages = 0

        message = mbox.nextMessage()
        
        try: 
            
            while(message != None):
                messages += 1
                id = message['Message-Id']
                msg = self.index.getMessage(messages)
                
                if (msg != None and msg.getMessageId() == id):
                    msg.setBody('FIXME')
                    msg.toRDF()
                    #msg.toHTML()
                    #self.index.delete(id)
                else:
                    print 'Someone was wrong with message ' + str(messages) + ' with ID ' + id + ' ('+msg.getMessageId()+')'

                message = mbox.nextMessage()
                
            self.__toRDF()
    
            self.subscribers.process()
            self.subscribers.export()
            
        except Exception, detail:
            print str(detail)
            
        
        if (self.messages != messages):
            print 'Something was wrong: ' + str(self.messages) + ' parsed, but ' + str(messages) + ' processed'

        return messages
Esempio n. 9
0
class MailingList:
    """
    Mailing List abstraction
    """
    def __init__(self, config, lang=None):
        """
        Constructor method
        
        @param config: configuration
        @param lang: language
        """

        self.config = config
        self.lang = lang
        self.subscribers = Subscribers(config)
        self.index = Index(self.config)

    def __createDir(self):
        """
        Create the necessary directory
        """

        if not (os.path.exists(self.config.get('dir'))):
            os.mkdir(self.config.get('dir'))

    def __parse(self):
        """
        Parse mailingg list and load all indexes into memory
        """

        previous = None

        mbox = Mbox(self.config.get('mbox'))
        messages = 0
        message = mbox.nextMessage()

        while (message != None):
            #fisrt load message
            messages += 1
            msg = Message(message, self.config)

            #index it
            self.index.add(msg)
            self.subscribers.add(msg)
            subscriber = self.subscribers.get(msg.getFromMail())
            msg.setSender(subscriber)

            #parent message (refactor)
            inReplyTo = msg.getInReplyTo()
            if (inReplyTo != None):
                parent = self.index.get(inReplyTo)
                if (parent != None):
                    msg.setParent(parent)  #link child with parent
                    parent.addChild(msg)  #and parent with child

            #and previous and next by date
            if (previous != None):
                previous.setNextByDate(msg)
                msg.setPreviousByDate(previous)

            previous = msg

            #and continue with next message
            message = mbox.nextMessage()

        self.messages = messages

    def publish(self):
        """
        Publish the messages
        """

        self.__createDir()

        #fisrt lap
        self.__parse()

        #and second lap
        mbox = Mbox(self.config.get('mbox'))
        messages = 0

        message = mbox.nextMessage()

        try:

            while (message != None):
                messages += 1
                id = message['Message-Id']
                msg = self.index.getMessage(messages)

                if (msg != None and msg.getMessageId() == id):
                    msg.setBody(message.fp.read())
                    msg.toRDF()
                    #msg.toHTML()
                    #self.index.delete(id)
                else:
                    print 'Someone was wrong with message ' + str(
                        messages) + ' with ID ' + id + ' (' + msg.getMessageId(
                        ) + ')'

                message = mbox.nextMessage()

            self.__toRDF()

            if (self.config.get('foaf')):
                self.subscribers.process()

            self.subscribers.export()

        except Exception, detail:
            print str(detail)

        if (self.messages != messages):
            print 'Something was wrong: ' + str(
                self.messages) + ' parsed, but ' + str(messages) + ' processed'

        return messages
 def __init__(self):
     self.subs = Subscribers()
     self.set_mode_srv = rospy.ServiceProxy('mavros/set_mode', SetMode)
     self.setpoint_publisher = rospy.Publisher(
         "/mavros/setpoint_position/local", PoseStamped, queue_size=10)