def get(self): piarm = PiArm(None) joint = request.query_string print "Joint " + joint input_primitive_joints = joint + " r 20" piarm.parse_joints(input_primitive_joints) return {}
def should_be_call_parser_with_joint(self): Configuration().configure() self._executor = RPiExecutor() waist = Motor(13, 19) shoulder = Motor(23, 24) elbow = Motor(17, 27) wrist = Motor(16, 20) gripper = Motor(5, 6) led = Pin(21) arm = Arm_partial(waist, shoulder, elbow, wrist, gripper, led) self._arm = arm self._led = led control = Control(None, self._executor, self._led) pi_arm = PiArm(control) input_primitive_joints = "g c 10" pi_arm.execute_joint = MagicMock() expected_joint = Joint_partial("g", "c", 10) pi_arm.parse_joints(input_primitive_joints) pi_arm.execute_joint.assert_called_with(expected_joint)
def pi_arm_configuration(self): Configuration().configure() self._executor = RPiExecutor() waist = Motor(13, 19) shoulder = Motor(23, 24) elbow = Motor(17, 27) wrist = Motor(16, 20) gripper = Motor(5, 6) led = Pin(21) arm = Arm_partial(waist, shoulder, elbow, wrist, gripper, led) self._arm = arm self._led = led control = Control(None, self._executor, self._led) pi_arm = PiArm(control) return control, pi_arm
def test_should_configure_arm(self): expected_waist = Motor(13, 19) expected_shoulder = Motor(23, 24) expected_elbow = Motor(17, 27) expected_wrist = Motor(16, 20) expected_gripper = Motor(5, 6) expected_led = Pin(21) expected_arm = Arm_partial(expected_waist, expected_shoulder, expected_elbow, expected_wrist, expected_gripper, expected_led) pi_arm = PiArm(None) current_arm = pi_arm._arm self.assertEquals(current_arm.waist.pin_a.number, expected_arm.waist.pin_a.number) self.assertEquals(current_arm.waist.pin_b.number, expected_arm.waist.pin_b.number) self.assertEquals(current_arm.shoulder.pin_a.number, expected_arm.shoulder.pin_a.number) self.assertEquals(current_arm.shoulder.pin_b.number, expected_arm.shoulder.pin_b.number) self.assertEquals(current_arm.elbow.pin_a.number, expected_arm.elbow.pin_a.number) self.assertEquals(current_arm.elbow.pin_b.number, expected_arm.elbow.pin_b.number) self.assertEquals(current_arm.wrist.pin_a.number, expected_arm.wrist.pin_a.number) self.assertEquals(current_arm.wrist.pin_b.number, expected_arm.wrist.pin_b.number) self.assertEquals(current_arm.gripper.pin_a.number, expected_arm.gripper.pin_a.number) self.assertEquals(current_arm.gripper.pin_b.number, expected_arm.gripper.pin_b.number) self.assertEquals(current_arm.led.number, expected_arm.led.number)
def get(self): piarm = PiArm(None) input_primitive_joints = "g c 20" piarm.parse_joints(input_primitive_joints) return {}