Skip to content

Commit

Permalink
Turn lead_time to tracking_interval
Browse files Browse the repository at this point in the history
  • Loading branch information
robotastic committed Mar 25, 2024
1 parent 2fbee23 commit 75a42f1
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions axis-ptz-controller/axis_ptz_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(
loop_interval: float = 0.1,
capture_interval: int = 2,
capture_dir: str = ".",
lead_time: float = 0.5,
tracking_interval: float = 0.5,
tripod_yaw: float = 0.0,
tripod_pitch: float = 0.0,
tripod_roll: float = 0.0,
Expand Down Expand Up @@ -124,7 +124,7 @@ def __init__(
Interval at which the camera image is captured [s]
capture_dir: str
Directory in which to place captured images
lead_time: float
tracking_interval: float
Lead time used when computing camera pointing to the
object [s]
tripod_yaw: float
Expand Down Expand Up @@ -195,7 +195,7 @@ def __init__(
self.loop_interval = loop_interval
self.capture_interval = capture_interval
self.capture_dir = capture_dir
self.lead_time = lead_time
self.tracking_interval = tracking_interval
self.alpha = tripod_yaw
self.beta = tripod_pitch
self.gamma = tripod_roll
Expand Down Expand Up @@ -508,7 +508,7 @@ def _config_callback(
"capture_interval", self.capture_interval
) # [s]
self.capture_dir = config.get("capture_dir", self.capture_dir)
self.lead_time = config.get("lead_time", self.lead_time) # [s]
self.tracking_interval = config.get("tracking_interval", self.tracking_interval) # [s]
# Cannot set tripod yaw, pitch, and roll because of side effects
self.pan_gain = config.get("pan_gain", self.pan_gain) # [1/s]
self.pan_rate_max = config.get("pan_rate_max", self.pan_rate_max)
Expand Down Expand Up @@ -572,7 +572,7 @@ def _log_config(self) -> None:
"loop_interval": self.loop_interval,
"capture_interval": self.capture_interval,
"capture_dir": self.capture_dir,
"lead_time": self.lead_time,
"tracking_interval": self.tracking_interval,
"tripod_yaw": self.alpha,
"tripod_pitch": self.beta,
"tripod_roll": self.gamma,
Expand Down Expand Up @@ -612,12 +612,12 @@ def _compute_object_pointing(self) -> None:

# Assign lead time, computing and adding age of object
# message, if enabled
lead_time = self.lead_time # [s]
tracking_interval = self.tracking_interval # [s]
if self.include_age:
object_msg_age = datetime.utcnow().timestamp() - self.timestamp_o # [s]
logging.debug(f"Object msg age: {object_msg_age} [s]")
lead_time += object_msg_age
logging.info(f"Using lead time: {lead_time} [s]")
tracking_interval += object_msg_age
logging.info(f"Using lead time: {tracking_interval} [s]")

# Compute position and velocity in the topocentric (ENz)
# coordinate system of the object relative to the tripod at
Expand All @@ -631,7 +631,7 @@ def _compute_object_pointing(self) -> None:
self.vertical_rate_o,
]
)
r_ENz_o_1_t = self.r_ENz_o_0_t + self.v_ENz_o_0_t * lead_time
r_ENz_o_1_t = self.r_ENz_o_0_t + self.v_ENz_o_0_t * tracking_interval

# Compute position, at time one, and velocity, at time zero,
# in the geocentric (XYZ) coordinate system of the object
Expand Down Expand Up @@ -1384,7 +1384,7 @@ def main(self) -> None:
capture_job = schedule.every(self.capture_interval).seconds.do(
self._capture_image
)
tracking_interval = self.lead_time #0.25
tracking_interval = self.tracking_interval #0.25
update_tracking_time = time()

# Enter the main loop
Expand Down Expand Up @@ -1485,7 +1485,7 @@ def make_controller() -> AxisPtzController:
loop_interval=float(os.environ.get("LOOP_INTERVAL", 0.1)),
capture_interval=int(os.environ.get("CAPTURE_INTERVAL", 2)),
capture_dir=os.environ.get("CAPTURE_DIR", "."),
lead_time=float(os.environ.get("LEAD_TIME", 0.5)),
tracking_interval=float(os.environ.get("TRACKING_INTERVAL", 0.5)),
tripod_yaw=float(os.environ.get("TRIPOD_YAW", 0.0)),
tripod_pitch=float(os.environ.get("TRIPOD_PITCH", 0.0)),
tripod_roll=float(os.environ.get("TRIPOD_ROLL", 0.0)),
Expand Down

0 comments on commit 75a42f1

Please sign in to comment.