From bd8f68bd532f11aac1aef40c976e71041b69e343 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Thu, 29 Feb 2024 21:09:14 -0500 Subject: [PATCH] better readme --- README.md | 16 ++++++++++++++-- skyscan-c2/c2_pub_sub.py | 20 +++++++++----------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 538691b..7abd592 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,22 @@

EdgeTech-Template

- This repo is a template of how to build on IQT Labs EdgeTech-Core functionality to instantiate an MQTT client. The philosophy behind EdgeTech-Core is to minimize development requirements for standing up the software stack of an "edge" system. The template includes all of the files and code scaffolds required to build in the EdgeTech framework. All of this functionality is wrapped in a Docker container for cross-platform compatibility. + This repo is designed to be part of a SkyScan system. SkyScan automatically points a Pan Tilt Zoom (PTZ) camera at an aircraft based on the location information broadcast in an ADS-B message. SkyScan C2 ingests a ledger of potentional aircraft and selects one to point the camera at. It is run as a Docker container and messages are passed to it using MQTT.

- You'll need to rename various files and directories as well as customize based on your functional needs, but the EdgeTech framework and scaffolding should minimize the development requirements. If you don't find that to be the case, submit a pull request and help us make this repository better! +

Configuration

+ SkyScan C2 makes it selection based on the distance of aircraft from the camera location. Based on where the camera is located and weather conditions, it may not be able to see all of the surrounding aircrarft. You can have SkyScan C2 ignore these obscured aircraft by configuring the following environment variables: + - **MIN_TILT**: The minimum tilt angle above the horizon for the camera. This is useful for when trees or buildings might obscure the horizon + - **MIN_ALTITUDE**: The minimum altitude of an aircraft. This is useful when there are nearby aircraft that are on the ground and should be ignored. + - **MAX_ALTITUDE**: The maximum altitude of an aircraft. This is useful when there are clouds and you want to ignore any aircrafts that are in the clouds. +
+
+

Docker Compose

+ SkyScan is designed to be stood up as a series of Docker containers. Docker Compose makes it easy to do coordinate all of the containers. The EdgeTech SkyScan repo provides an example of a `docker-compose.yaml` file that can be used to startup an instance. The `docker-compose.yaml` file include in this repo provides a minimal example of how to start and configure a SkyScan C2 container. You can use this Docker Compose file as a starting point if you wish to include the SkyScan C2 container in a custom system. +
+
+

Environment Files

+ Environment files are used to capture the configuration of SkyScan C2.

Make Contribution diff --git a/skyscan-c2/c2_pub_sub.py b/skyscan-c2/c2_pub_sub.py index 2e93aad..321a181 100644 --- a/skyscan-c2/c2_pub_sub.py +++ b/skyscan-c2/c2_pub_sub.py @@ -134,7 +134,7 @@ def __init__( self.rho_c, self.tau_c, ) - logging.info(f"Initial E_XYZ_to_uvw: {self.E_XYZ_to_uvw}") + # create MQTT client connection self.connect_client() @@ -262,7 +262,6 @@ def _calculate_camera_angles(self: Any, data: Any) -> tuple[float, float, float] self.tau_o = math.degrees( math.atan2(r_uvw_o_1_t[2], axis_ptz_utilities.norm(r_uvw_o_1_t[0:2])) ) # [deg] - logging.info(f"Camera pan and tilt to object: {self.rho_o}, {self.tau_o} [deg]") return self.rho_o, self.tau_o, self.distance3d @@ -377,7 +376,6 @@ def _config_callback( def _target_selection_callback( self: Any, _client: mqtt.Client, _userdata: Dict[Any, Any], msg: Any ) -> None: - logging.debug("Ledger recieved") payload_dict = json.loads(str(msg.payload.decode("utf-8"))) if "ObjectLedger" in payload_dict.keys(): @@ -388,7 +386,6 @@ def _target_selection_callback( object_ledger_df["age"] = time() - object_ledger_df["timestamp"] if len(object_ledger_df): - logging.debug("Ledger not empty") ### some logic to select which target target = None @@ -422,10 +419,10 @@ def _target_selection_callback( object_ledger_df["altitude"] > self.max_altitude ) - logging.info(f"Object ledger: {object_ledger_df.to_string()}") + #logging.info(f"Object ledger: {object_ledger_df.to_string()}") if not object_ledger_df.empty and not self.override_object: logging.debug("Standard distance thresholding") - object_ledger_df = object_ledger_df[ + target_ledger_df = object_ledger_df[ ( object_ledger_df["relative_distance"] <= self.object_distance_threshold @@ -434,13 +431,13 @@ def _target_selection_callback( & (object_ledger_df["min_altitude_fail"] == False) & (object_ledger_df["max_altitude_fail"] == False) ] - if not object_ledger_df.empty: + if not target_ledger_df.empty: logging.debug("Object[s] within distance threshold") - target = object_ledger_df.sort_values( + target = target_ledger_df.sort_values( by="relative_distance", ascending=True ).iloc[0] else: - logging.info("No object[s] within distance threshold") + logging.debug("No object[s] within distance threshold") elif self.override_object and not object_ledger_df.empty: logging.debug("Override object selection") selection_df = object_ledger_df[ @@ -550,8 +547,9 @@ def main(self: Any) -> None: ) self.add_subscribe_topic(self.config_topic, self._config_callback) self.add_subscribe_topic(self.ledger_topic, self._target_selection_callback) - self.add_subscribe_topic(self.manual_override_topic, self._target_selection_callback) - + self.add_subscribe_topic( + self.manual_override_topic, self._target_selection_callback + ) while True: try: