コード例 #1
0
 def __init__(self, nb, buggy_nb, dist_per_tick=17.5 / 18):
     self.dist_per_tick = dist_per_tick  # Distance travelled per click
     self.count = 0  # Encoder count
     self._get_message = GetMessage()  # Callback (private)
     topic = "buggy" + str(buggy_nb) + "/encoder" + str(
         nb)  # i.e. buggy0/encoder0
     rospy.Subscriber(topic, Int64, self._get_message)  # Subscribe to topic
コード例 #2
0
 def __init__(self,
              nb,
              buggy_nb,
              pos,
              angle,
              min_dist=10,
              action="None",
              eff_angle=0.17,
              col=colors.lime_green):
     self.col = col
     self.min_dist = min_dist
     self.action = action
     self.local_pos = pos  # Position relative to centre of buggy (cm)
     self.global_pos = pos  # Position of the sensor in the world frame (cm)
     self.local_angle = angle  # Angle relative to the buggy (rad)
     self.global_angle = angle  # Angle of the sensor in the world frame (rad)
     self.eff_angle = eff_angle  # Effective angle of sonar (rad)
     self.data = 0  # Measured value of sensor (cm)
     self.get_message = GetMessage()
     topic = "buggy" + str(buggy_nb) + "/sonar" + str(nb)
     rospy.Subscriber(topic, Int32, self.get_message)
コード例 #3
0
from get_message import GetMessage
from send_email import SendEmail
from database import Database

if __name__ == '__main__':
    # Define variables to connect to MySQL database
    user = '******' # Set username of MySQL server
    password = '' # Set password of MySQL server
    d = Database(user, password)

    n = int(input("Number of queries"))
    for query in range(n):
        email=input("Email address")
        series = input("TV Series").split(',')
        message = "\n"
        #Create an object for Database class
        #Connect to database and insert the data in the table.
        d.write(email,series)
        for i in series:
            #Create an object for GetMessage class which can determine the next episode date of the TV Series.
            m = GetMessage(i)
            #print(a.get_imdb_url())
            message+="Tv series name: "+i+"\n"
            message+="Status: "+m.get_episode_date()+"\n"
            #print(message)
            message+="\n"

        #Send the result to user's email
        e = SendEmail(email,message)
        e.send()
コード例 #4
0
 def __init__(self, nb, buggy_nb, axis=0):
     self.get_message = GetMessage()
     self.axis = axis
     topic = "buggy" + str(buggy_nb) + "/gyroscope" + str(nb)
     rospy.Subscriber(topic, String, self.get_message, queue_size=1)
コード例 #5
0
 def __init__(self, nb, buggy_nb):
     self.get_image = GetMessage()
     topic = "buggy" + str(buggy_nb) + "/camera" + str(nb)
     rospy.Subscriber(topic, CompressedImage, self.get_image, queue_size=1)