Skip to content

Commit

Permalink
better values
Browse files Browse the repository at this point in the history
  • Loading branch information
robotastic committed Apr 6, 2024
1 parent e990f75 commit 4f95503
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
16 changes: 8 additions & 8 deletions axis-ptz-controller/axis_ptz_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,16 +584,16 @@ def _track_object(self, time_since_last_update: float) -> None:
)

# Compute slew rate differences
self.delta_rho_dot_c = self.pan_gain * self.delta_rho
self.delta_tau_dot_c = self.tilt_gain * self.delta_tau
self.rho_c_gain = self.pan_gain * self.delta_rho
self.tau_c_gain = self.tilt_gain * self.delta_tau

# Compute position and velocity in the camera fixed (rst)
# coordinate system of the object relative to the tripod at
# time zero after pointing the camera at the object

# Update camera pan and tilt rate
self.rho_dot_c = self.object.rho_rate + self.delta_rho_dot_c
self.tau_dot_c = self.object.tau_rate + self.delta_tau_dot_c
self.rho_dot_c = self.object.rho_rate + self.rho_c_gain
self.tau_dot_c = self.object.tau_rate + self.tau_c_gain

# Get, or compute and set focus, command camera pan and tilt
# rates, and begin capturing images, if needed
Expand Down Expand Up @@ -650,13 +650,13 @@ def _track_object(self, time_since_last_update: float) -> None:
"tau_c": self.camera.tau,
"rho_dot_c": self.rho_dot_c,
"tau_dot_c": self.tau_dot_c,
"rho_c_gain": self.rho_c_gain,
"tau_c_gain": self.tau_c_gain,
"distance": self.object.distance_to_tripod3d,
"focus": _focus,
"zoom": _zoom,
"rho_lead_delta": self.object.rho_lead_delta,
"tau_lead_delta": self.object.tau_lead_delta,
"rho_rate_derivative": self.object.rho_rate_derivative,
"tau_rate_derivative": self.object.tau_rate_derivative,
"rho_derivative": self.object.rho_derivative,
"tau_derivative": self.object.tau_derivative,
"pan_rate_index": self.camera.pan_rate_index,
"tilt_rate_index": self.camera.tilt_rate_index,
"delta_rho_dot_c": self.delta_rho_dot_c,
Expand Down
13 changes: 6 additions & 7 deletions axis-ptz-controller/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,14 @@ def recompute_location(self) -> None:
)
)

time_delta = time() - self.location_update_time
self.location_update_time = time()
self.rho_derivative = (self.rho - self.rho_lead) / time_delta
self.tau_derivative = (self.tau - self.tau_lead) / time_delta

self.rho = self.rho_lead
self.tau = self.tau_lead

self.rho_lead_delta = self.rho_lead - self.rho_now
self.tau_lead_delta = self.tau_lead - self.tau_now

camera_yaw, camera_pitch, camera_roll = self.camera.get_yaw_pitch_roll()
camera_E_XYZ, camera_N_XYZ, camera_z_XYZ = self.camera.get_e_n_z()
# Compute position and velocity in the camera fixed (rst)
Expand Down Expand Up @@ -310,10 +312,7 @@ def recompute_location(self) -> None:
)
/ axis_ptz_utilities.norm(self.rst_point_now_relative_to_tripod) ** 2
)
time_delta = time() - self.location_update_time
self.location_update_time = time()
self.rho_rate_derivative = (self.rho_rate - math.degrees(-omega[2])) / time_delta
self.tau_rate_derivative = (self.tau_rate - math.degrees(omega[0])) / time_delta

self.rho_rate = math.degrees(-omega[2])
self.tau_rate = math.degrees(omega[0])

Expand Down

0 comments on commit 4f95503

Please sign in to comment.