Пример #1
0
    def test_middle_pololu_message(self):
        reader = PololuSerialReader('%s/middle_pololu1' % CWD)
        topic = '/han/middle/command'
        pub, msg_class = rostopic.create_publisher(
            topic, 'ros_pololu/MotorCommand', True)

        time.sleep(3) # wait for pololu to be connected

        loop = 100
        for i in range(loop):
            pub.publish(msg_class('Brow_Inner_L', 0.1, 2.0, 2.0)) #1
            pub.publish(msg_class('Inner_Brow_R_UD', 0.1, 2.0, 2.0)) #4

        for i in range(3*2*loop):
            id, cmd, value = reader.read()
            print "set motor %s %s value %s" % (id, cmd, value)
Пример #2
0
    def test_left_pololu_message(self):
        reader = PololuSerialReader('%s/left_pololu1' % CWD)
        topic = '/han/left/command'
        pub, msg_class = rostopic.create_publisher(
            topic, 'ros_pololu/MotorCommand', True)

        time.sleep(3) # wait for pololu to be connected

        loop = 100
        for i in range(loop):
            pub.publish(msg_class('EyeLid_L_L', 0.1, 2.0, 2.0))
            pub.publish(msg_class('EyeLid_U_L', 0.1, 2.0, 2.0))

        for i in range(3*2*loop):
            id, cmd, value = reader.read()
            print "set motor %s %s value %s" % (id, cmd, value)
Пример #3
0
    def test_middle_pololu_message(self):
        reader = PololuSerialReader('%s/middle_pololu1' % CWD)
        topic = '/han/middle/command'
        pub, msg_class = rostopic.create_publisher(topic,
                                                   'ros_pololu/MotorCommand',
                                                   True)

        time.sleep(3)  # wait for pololu to be connected

        loop = 100
        for i in range(loop):
            pub.publish(msg_class('Brow_Inner_L', 0.1, 2.0, 2.0))  #1
            pub.publish(msg_class('Inner_Brow_R_UD', 0.1, 2.0, 2.0))  #4

        for i in range(3 * 2 * loop):
            id, cmd, value = reader.read()
            print "set motor %s %s value %s" % (id, cmd, value)
Пример #4
0
    def test_left_pololu_message(self):
        reader = PololuSerialReader('%s/left_pololu1' % CWD)
        topic = '/han/left/command'
        pub, msg_class = rostopic.create_publisher(topic,
                                                   'ros_pololu/MotorCommand',
                                                   True)

        time.sleep(3)  # wait for pololu to be connected

        loop = 100
        for i in range(loop):
            pub.publish(msg_class('EyeLid_L_L', 0.1, 2.0, 2.0))
            pub.publish(msg_class('EyeLid_U_L', 0.1, 2.0, 2.0))

        for i in range(3 * 2 * loop):
            id, cmd, value = reader.read()
            print "set motor %s %s value %s" % (id, cmd, value)
Пример #5
0
    def test_port_io(self):
        controller = Maestro(self.port0)
        reader = PololuSerialReader(self.port1)
        for i in range(10):
            pulses = [6143, 6122, 5899, 5085, 5352, 5810, 6075, 6143] * 100
            for pulse in pulses:
                controller.setAcceleration(12, 255)
                controller.setSpeed(12, 256)
                controller.setTarget(12, pulse)

            pulses_got = []
            for i in range(3 * len(pulses)):
                id, cmd, value = reader.read()
                if cmd == 'speed':
                    self.assertEqual(value, 256)
                if cmd == 'accelaration':
                    self.assertEqual(value, 255)
                if cmd == 'position':
                    pulses_got.append(value)
            self.assertListEqual(pulses, pulses_got)
Пример #6
0
    def test_port_io(self):
        controller = Maestro(self.port0)
        reader = PololuSerialReader(self.port1)
        for i in range(10):
            pulses = [6143, 6122, 5899, 5085, 5352, 5810, 6075, 6143]*100
            for pulse in pulses:
                controller.setAcceleration(12, 255)
                controller.setSpeed(12, 256)
                controller.setTarget(12, pulse)

            pulses_got = []
            for i in range(3*len(pulses)):
                id, cmd, value = reader.read()
                if cmd == 'speed':
                    self.assertEqual(value, 256)
                if cmd == 'accelaration':
                    self.assertEqual(value, 255)
                if cmd == 'position':
                    pulses_got.append(value)
            self.assertListEqual(pulses, pulses_got)