def test_animat_no_controller(): for n_animats in range(10): duration = 50.0 DT = 0.02 iterations = int(np.round(duration / DT)) animat = Animat() animat.x = np.random.randn() animat.y = np.random.randn() animat.a = np.random.rand() * np.pi * 2.0 obj = Obj(0, 0, 'default') animat.add_obj(obj) for iteration in range(iterations): animat.calculate_derivative() animat.euler_update(DT=DT) left_sensor = animat.sensors['default'][Sides.LEFT] right_sensor = animat.sensors['default'][Sides.RIGHT] # print(f'l:{left_sensor}\t r:{right_sensor}') # animat.lm = 0.4 # animat.rm = 0.5 animat.lm = left_sensor * 5 animat.rm = right_sensor * 5 plot(animat.x_h, animat.y_h, ',') plot(animat.x_h[-1], animat.y_h[-1], 'ko', ms=3) plot(-999, -999, 'k.', label='Aniamt Final Position') plot(0, 0, ',', label='Animat Trajectory') plot(0, 0, 'rx', label='Object Position') xlim(-3, 3) ylim(-3, 3) legend() gca().set_aspect('equal') show()