target.py 633 B

12345678910111213141516
  1. from tracker import Robot
  2. import numpy as np
  3. class Target(Robot):
  4. def __init__(self, simulator, name: str, id: int, position: np.array) -> None:
  5. super().__init__(simulator, name, id, position)
  6. def job(self):
  7. # return 0
  8. if self.waypoint_ctrl():
  9. self.ang = (self.ang + np.deg2rad(15)) % 360
  10. rot_mat = np.asarray([[np.cos(self.ang), -np.sin(self.ang)],
  11. [np.sin(self.ang), np.cos(self.ang)]])
  12. self.waypoint_ctrl(speed=20, desired_pos=(self.position
  13. - np.dot([0, 10], rot_mat)))