Exemple #1
0
 def run(self):
     r = rospy.Rate(100) # 100hz
     tf = 0.1
     while not rospy.is_shutdown():
         t = rospy.get_time()
         msg = MicroPosition()
         msg.posA = int(0)
         msg.posB = int(0)
         msg.laser = self._laser
         self.pub.publish(msg)
         r.sleep()
Exemple #2
0
 def run(self):
     r = rospy.Rate(100)  # 100hz
     tf = 0.1
     while not rospy.is_shutdown():
         t = rospy.get_time()
         msg = MicroPosition()
         msg.posA = int(0)
         msg.posB = int(0)
         msg.laser = self._laser
         self.pub.publish(msg)
         r.sleep()
Exemple #3
0
 def run(self):
     r = rospy.Rate(100) # 100hz
     tf = 0.1
     while not rospy.is_shutdown():
         t = rospy.get_time()
         x = math.sin( tf*2*math.pi*t ) * ((2**14)-1) * self.range
         y = math.cos( tf*2*math.pi*t ) * ((2**14)-1) * self.range
         msg = MicroPosition()
         msg.posA = int(round(x))
         msg.posB = int(round(y))
         msg.laser = self._laser
         self.pub.publish(msg)
         r.sleep()
 def run(self):
     r = rospy.Rate(100)  # 100hz
     tf = 0.1
     while not rospy.is_shutdown():
         t = rospy.get_time()
         x = math.sin(tf * 2 * math.pi * t) * 2**14
         y = math.cos(tf * 2 * math.pi * t) * 2**14
         print x, y
         msg = MicroPosition()
         msg.posA = int(round(x))
         msg.posB = int(round(y))
         self.pub.publish(msg)
         r.sleep()
Exemple #5
0
 def pixels_for_dac( self, dac ):
     two, n_dacs = dac.shape
     pixels = []
     if 1:
         dur = n_dacs*PER_PIXEL_SECONDS
         print 'duration will be %.1f seconds'%dur
     for i in range(n_dacs):
         daca, dacb = dac[:,i]
         msg = MicroPosition()
         msg.posA = daca
         msg.posB = dacb
         self.pub.publish(msg)
         rospy.sleep(PER_PIXEL_SECONDS) # allow msec
         pixels.append(self.get_last_pixel(timeout=WAIT))
     pixels = np.array(pixels).T
     return pixels
Exemple #6
0
    a = int(sys.argv[1], 16)

try:
    b = int(sys.argv[2])
except ValueError:
    print 'input B is hex'
    b = int(sys.argv[2], 16)

try:
    try:
        c = int(sys.argv[3])
    except ValueError:
        print 'input C is hex'
        c = int(sys.argv[3], 16)
except IndexError:
    c = 0

print 'got values', a, b, c
print 'hex', hex(a), hex(b), hex(c)

rospy.init_node('pos')
pub = rospy.Publisher('/flymad_micro/position', MicroPosition)

for i in range(10):
    time.sleep(0.1)
    msg = MicroPosition()
    msg.posA = a
    msg.posB = b
    msg.laser = c
    pub.publish(msg)
Exemple #7
0
    a = int(sys.argv[1],16)

try:
    b = int(sys.argv[2])
except ValueError:
    print 'input B is hex'
    b = int(sys.argv[2],16)

try:
    try:
        c = int(sys.argv[3])
    except ValueError:
        print 'input C is hex'
        c = int(sys.argv[3],16)
except IndexError:
    c = 0

print 'got values',a,b,c
print 'hex',hex(a),hex(b),hex(c)

rospy.init_node('pos')
pub = rospy.Publisher( '/flymad_micro/position', MicroPosition )

for i in range(10):
    time.sleep(0.1)
    msg = MicroPosition()
    msg.posA = a
    msg.posB = b
    msg.laser = c
    pub.publish(msg)