Skip to content

Commit 4dbccc3

Browse files
committed
Update camera.py
1 parent 5e41869 commit 4dbccc3

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

axis-ptz-controller/camera.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -383,23 +383,24 @@ def slew_camera(self, rho_target: float, tau_target: float) -> None:
383383
self.camera_control.absolute_move(rho_target, tau_target, self.zoom, 99)
384384
except Exception as e:
385385
logging.error(f"Error: {e}")
386-
387-
duration = max(
388-
math.fabs(
386+
tilt_delta = math.fabs(
389387
axis_ptz_utilities.compute_angle_delta(
390-
theta_c=self.rho, theta_o=rho_target
388+
theta_c=self.tau, theta_o=tau_target
391389
)
392390
)
393-
/ (self.pan_rate_max),
394-
math.fabs(
391+
pan_delta = math.fabs(
395392
axis_ptz_utilities.compute_angle_delta(
396-
theta_c=self.tau, theta_o=tau_target
393+
theta_c=self.rho, theta_o=rho_target
397394
)
398395
)
396+
duration = max(
397+
pan_delta
398+
/ (self.pan_rate_max),
399+
tilt_delta
399400
/ (self.tilt_rate_max),
400401
)
401402
duration = duration + 0.5
402-
logging.info(f"Sleeping: {duration} [s]")
403+
logging.info(f"Panning {pan_delta} degrees, Tilting {tilt_delta} Sleeping: {duration} [s] = Pan time {pan_delta / self.pan_rate_max} or Tilt time {tilt_delta / self.tilt_rate_max} + 0.5")
403404
sleep(duration)
404405

405406
def _compute_pan_rate_index(self, rho_dot: float) -> None:

0 commit comments

Comments
 (0)