Example #1
0
 def testTwoMotorDriveSystemCreation(self):
     d = DriveSystem(2)
     self.assertEqual(d.get_position(), (0,0))
     self.assertEqual(d.get_bearing(), 0)
     self.assertEqual(d.get_motor_status(DriveSystem.MotorPosition.left), DriveSystem.MotorStatus.ready)
     self.assertEqual(d.get_motor_status(DriveSystem.MotorPosition.right), DriveSystem.MotorStatus.ready)
     self.assertEqual(d.get_motor_status(DriveSystem.MotorPosition.front_left), DriveSystem.MotorStatus.not_present)
     self.assertEqual(d.get_motor_status(DriveSystem.MotorPosition.front_right), DriveSystem.MotorStatus.not_present)
     self.assertEqual(d.get_motor_status(DriveSystem.MotorPosition.rear_right), DriveSystem.MotorStatus.not_present)
     self.assertEqual(d.get_motor_status(DriveSystem.MotorPosition.rear_left), DriveSystem.MotorStatus.not_present)
Example #2
0
 def test720DegreeAntiClock(self):
     d = DriveSystem(2)
     d.spin(-720)
     self.assertEqual(d.get_position(), (0,0))
     self.assertEqual(d.get_bearing(), 0)
Example #3
0
 def test30DegreeClock(self):
     d = DriveSystem(2)
     d.spin(30)
     self.assertEqual(d.get_position(), (0,0))
     self.assertEqual(d.get_bearing(), 30)
Example #4
0
 def testBackwardTwoMetres(self):
     d = DriveSystem(2)
     d.backward(2)
     self.assertEqual(d.get_position(), (0, -2))
     self.assertEqual(d.get_bearing(), 0)
Example #5
0
 def testBackwardHalfMetre(self):
     d = DriveSystem(2)
     d.backward(0.5)
     self.assertEqual(d.get_position(), (0, -0.5))
     self.assertEqual(d.get_bearing(), 0)
Example #6
0
 def testBackwardOneMetre(self):
     d = DriveSystem(2)
     d.backward(1)
     self.assertEqual(d.get_position(), (0, -1))
     self.assertEqual(d.get_bearing(), 0)
Example #7
0
 def test360DegreeTravel(self):
     d = DriveSystem(2)
     d.spin(360)
     d.forward(5)
     self.assertAlmostEqual(d.get_position()[0], 0)
     self.assertAlmostEqual(d.get_position()[1], 5)
Example #8
0
 def test330DegreeTravel(self):
     d = DriveSystem(2)
     d.spin(330)
     d.forward(5)
     self.assertAlmostEqual(d.get_position()[0], -2.5)
     self.assertAlmostEqual(d.get_position()[1], 4.330127)