Пример #1
0
 def test_run_reset(self):
     quad = Quadcopter()
     assert quad.t == 0
     quad.run(t=1)
     assert quad.t == approx(1)
     quad.reset()
     assert quad.t == 0
Пример #2
0
 def test_Quadcopter_yaw(self):
     quad = Quadcopter()
     # only two motors on, to produce a yaw
     quad.set_thrust(0, 10, 0, 10)
     quad.run(t=1)
     assert quad.rpy.yaw > 0
     assert quad.rpy.pitch == 0
     assert quad.rpy.roll == 0
     #
     # now try to yaw in the opposite direction
     quad.reset()
     quad.set_thrust(10, 0, 10, 0)
     quad.run(t=1)
     assert quad.rpy.yaw < 0
     assert quad.rpy.pitch == 0
     assert quad.rpy.roll == 0