示例#1
0
    def test_set(self):
        ms = MotorSet(motors=self.ctrl.motors)
        ms.goal_position_bytes = 150
        time.sleep(0.05)
        self.assertEqual(ms.motors[0].goal_position_bytes, 150)
        self.assertEqual(ms.motors[1].goal_position_bytes, 150)

        ms.position_bytes = (100, 200)
        time.sleep(0.05)
        self.assertEqual(ms.motors[0].goal_position_bytes, 100)
        self.assertEqual(ms.motors[1].goal_position_bytes, 200)

        with self.assertRaises(AttributeError):
            ms.does_not_exist = 100
示例#2
0
    def test_get(self):
        ms = MotorSet(motors=self.ctrl.motors)
        self.assertEqual(len(ms.position), len(self.ctrl.motors))
        self.assertEqual(len(ms.position), 2)

        with self.assertRaises(AttributeError):
            ms.does_not_exist
示例#3
0
 def test_expand_values(self):
     ms = MotorSet(motors=self.ctrl.motors)
     ms.moving_speed = 0
     ms.moving_speed = [0, 10]
     ms.angle_limits = [0, 10]
     ms.angle_limits = [[-100, 100], [-150, 150]]
     ms.angle_limits = (-150, 150)
示例#4
0
    def test_empty(self):
        ms = MotorSet(motors=[])

        ms.pose = []
        with self.assertRaises(AttributeError):
            ms.punch

        with self.assertRaises(AttributeError):
            ms.punch = 50
        ms.punch = []
        ms.does_not_exist = []
示例#5
0
 def test_motor_properties(self):
     ms = MotorSet(motors=self.ctrl.motors)
     ms.moving_speed = 0
     ms.moving_speed
示例#6
0
 def test_properties(self):
     ms = MotorSet(motors=self.ctrl.motors)
     ms.zero_pose = -150
     ms.zero_pose
     ms.pose = 0
     ms.pose
示例#7
0
 def test_iadd(self):
     ms = MotorSet(motors=self.ctrl.motors)
     ms.position += 10
示例#8
0
 def test_dir(self):
     ms = MotorSet(motors=self.ctrl.motors)
     self.assertTrue('compliant' in dir(ms))
     self.assertTrue('present_temperature_bytes' in dir(ms))
     self.assertTrue('request_write' in dir(ms))
示例#9
0
 def test_bundles(self):
     ms = MotorSet(motors=self.ctrl.motors)
     ms.cw_angle_limit = 150
     ms.angle_limits = (-150, 150)
示例#10
0
 def test_error(self):
     ms = MotorSet(motors=self.ctrl.motors)
     ms.cw_angle_limit = 150
     time.sleep(0.1)
     with self.assertRaises(exc.MotorError):
         ms.cw_angle_limit = 100
示例#11
0
 def test_error(self):
     ms = MotorSet(motors=self.ctrl.motors)
     ms.cw_angle_limit = 150
     time.sleep(0.1)
     with self.assertRaises(exc.MotorError):
         ms.cw_angle_limit = 100