Skip to content

Commit

Permalink
Update axis_ptz_controller.py
Browse files Browse the repository at this point in the history
  • Loading branch information
robotastic committed Mar 3, 2024
1 parent 7087257 commit 7ee0a7b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions axis-ptz-controller/axis_ptz_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,14 +991,15 @@ def _manual_control_callback(self, _client: Union[mqtt.Client, None],
except Exception as e:
logging.error(f"Error: {e}")
logging.info(f"rho_c: {self.rho_c}, rho_o: {pan}, tau_c: {self.tau_c}, tau_o: {tilt}, pan_rate_max: {self.pan_rate_max}, tilt_rate_max: {self.tilt_rate_max}")
duration = max(
math.fabs(self._compute_angle_delta(self.rho_c, pan))
/ (self.pan_rate_max / 2),
math.fabs(self._compute_angle_delta(self.tau_c, tilt))
/ (self.tilt_rate_max / 2),
)
logging.info(f"Sleeping: {duration} [s]")
sleep(duration)
if tilt > 0 and pan > 0:
duration = max(
math.fabs(self._compute_angle_delta(self.rho_c, pan))
/ (self.pan_rate_max / 2),
math.fabs(self._compute_angle_delta(self.tau_c, tilt))
/ (self.tilt_rate_max / 2),
)
logging.info(f"Sleeping: {duration} [s]")
sleep(duration)

def _send_data(self, data: Dict[str, str]) -> bool:
"""Leverages edgetech-core functionality to publish a JSON
Expand Down

0 comments on commit 7ee0a7b

Please sign in to comment.