Skip to content

Commit

Permalink
Updated Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
robotastic committed Jun 11, 2024
1 parent eac9cf3 commit 9317483
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 91 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright (c) 2020-2023 IQT Labs LLC, All Rights Reserved.
Copyright (c) 2020-2024 IQT Labs LLC, All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
145 changes: 55 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,108 +27,73 @@

<br />
<div align="center">
<a href="https://iqtlabs.org/">
<img src="images/logo.png" alt="Logo" width="331" height="153">
<a href="https://iqt.org">
<img src="images/logo.png" alt="Logo" width="358" height="132">
</a>

<h1 align="center">Edgetech-Axis-Ptz-Controller</h1>

<p align="center">
This project provides a simple pan and tilt rate controller for AXIS
Communications PTZ network cameras, exemplified by the <a
href="https://www.axis.com/dam/public/8d/ba/86/datasheet-axis-m5525%E2%80%93e-ptz-network-camera-en-US-294608.pdf">AXIS
M5525–E PTZ Network Camera</a>, for pointing the camera at an
aircraft. The controller uses the position of the aircraft
reported by aircraft broadcast ADS-B, and pan and tilt of the
camera, to determine pan and tilt rates to follow the aircraft,
adjust camera focus based on range to the aircraft from the
camera, and periodically capture images of the aircraft.
<br/>
<br/>
In more detail, the controller subscribes to an MQTT message topic
for ADS-B, or flight, messages, which provide the aircraft
latitude, longitude, altitude, and ground and vertical speeds at
the message time which are used to compute geocentric, and
topocentric position and velocity at the processing time using
WGS84 and linear extrapolation. Camera housing orientation is
represented by yaw, pitch, and roll, and these rotations are
represented by quaternions which are used to compute direction
cosine matrices for transformation between coordinate systems. The
controller subscribes to an MQTT message topic for orientation
messages, such as those published by the EdgeTech-Auto-Orienter,
to set the yaw, pitch, and roll. The controller computes the pan
and tilt of the camera required to point at the aircraft, queries
the camera for its current pan and tilt, then commands a pan and
tilt rate proportional to the pan and tilt differences. The
controller assumes camera focus varies linearly with range to the
aircraft from the camera, then computes and sets focus whenever a
flight message is received. The controller begins capturing images
whenever a new aircraft is encountered, and stops capturing images
if a flight message has not been received in a specified
interval. All controller parameters can be customized through
environment variables, or using an MQTT message published to a
configuration topic. Units of measure are meters, seconds, and
degrees, and operation of the controller is extensively logged.
<br/>
<br/>
<a href="https://github.com/IQTLabs/edgetech-axis-ptz-controller/pulls">Make Contribution</a>
·
<a href="https://github.com/IQTLabs/edgetech-axis-ptz-controller/issues">Report Bug</a>
·
<a href="https://github.com/IQTLabs/edgetech-axis-ptz-controller/issues">Request Feature</a>
</p>
</div>

### Built With

[![Python][Python]][Python-url]
[![Poetry][Poetry]][Poetry-url]
[![Docker][Docker]][Docker-url]

## Getting Started

To run this repo, simply run:

```
docker-compose up
```
<h1 align="center">Edgetech-Axis-Ptz-Controller</h1>

The AXIS PTZ network camera controller is containerized and
dependencies are managed using [poetry]("https://python-poetry.org").

### Prerequisites
This project provides a simple pan and tilt rate controller for AXIS
Communications PTZ network cameras, exemplified by the [AXIS
M5525–E PTZ Network Camera]("https://www.axis.com/dam/public/8d/ba/86/datasheet-axis-m5525%E2%80%93e-ptz-network-camera-en-US-294608.pdf"), for pointing the camera at an
aircraft. The controller uses the position of the aircraft
reported by aircraft broadcast ADS-B, and pan and tilt of the
camera, to determine pan and tilt rates to follow the aircraft,
adjust camera focus based on range to the aircraft from the
camera, and periodically capture images of the aircraft.

In more detail, the controller subscribes to an MQTT message topic
for ADS-B, or flight, messages, which provide the aircraft
latitude, longitude, altitude, and ground and vertical speeds at
the message time which are used to compute geocentric, and
topocentric position and velocity at the processing time using
WGS84 and linear extrapolation. Camera housing orientation is
represented by yaw, pitch, and roll, and these rotations are
represented by quaternions which are used to compute direction
cosine matrices for transformation between coordinate systems. The
controller subscribes to an MQTT message topic for orientation
messages, such as those published by the EdgeTech-Auto-Orienter,
to set the yaw, pitch, and roll. The controller computes the pan
and tilt of the camera required to point at the aircraft, queries
the camera for its current pan and tilt, then commands a pan and
tilt rate proportional to the pan and tilt differences. The
controller assumes camera focus varies linearly with range to the
aircraft from the camera, then computes and sets focus whenever a
flight message is received. The controller begins capturing images
whenever a new aircraft is encountered, and stops capturing images
if a flight message has not been received in a specified
interval. All controller parameters can be customized through
environment variables, or using an MQTT message published to a
configuration topic. Units of measure are meters, seconds, and
degrees, and operation of the controller is extensively logged.


<a href="https://github.com/IQTLabs/edgetech-axis-ptz-controller/pulls">Make Contribution</a>
·
<a href="https://github.com/IQTLabs/edgetech-axis-ptz-controller/issues">Report Bug</a>
·
<a href="https://github.com/IQTLabs/edgetech-axis-ptz-controller/issues">Request Feature</a>

Running this repo requires that you have
[Docker](https://www.docker.com) installed.

## Usage

This module is designed to be used in concert with other modules to
build a complete tracking system. [SkyScan]() is an example of that.
build a complete tracking system. [SkyScan](https://github.com/IQTLabs/SkyScan),
which tracks aircraft using ADS-B transmissions, is an example of the type of
system that can be built.

Checkout the `docker-compose.yml` in that repo to see how these modules
can be connected together. The configuration for the system is stored in environment files that are loaded
in when it is started up. Examples of the different environment files
are included in the SkyScan repo, configure them to match your setup.

```mermaid
flowchart TD
configdata(Config Data) -- Config Topic --> mqtt{MQTT}
orientationdata(Orientation Data) -- Orientation Topic --> mqtt{MQTT}
flightdata(Flight Data) -- Flight Topic --> mqtt{MQTT}
mqtt{MQTT} -- Config, Orientation, and Flight Topics --> controller(Controller)
controller(Controller) --> capturedata(Capture Data)
capturedata(Capture Data) -- Capture Topic --> mqtt{MQTT}
style mqtt fill:#0072bc,color:#ffffff
style configdata fill:#80c342,color:#ffffff
style orientationdata fill:#80c342,color:#ffffff
style flightdata fill:#80c342,color:#ffffff
style controller fill:#F9D308,color:#ffffff
style capturedata fill:#80c342,color:#ffffff
can be connected together. The configuration for the system is stored in `.env` environment files. Examples of the different environment files
are included in the **SkyScan** repo and can be configured them to match your setup.

```

### Built With

[![Python][Python]][Python-url]
[![Poetry][Poetry]][Poetry-url]
[![Docker][Docker]][Docker-url]


## Roadmap
Expand Down Expand Up @@ -165,7 +130,7 @@ See `CONTRIBUTING.md` for more information.
## License

Distributed under the [Apache
2.0](https://github.com/IQTLabs/edgetech-audio-recorder/blob/main/LICENSE). See
2.0](https://github.com/IQTLabs/edgetech-axis-ptz-controller/blob/main/LICENSE). See
`LICENSE.txt` for more information.

## Contact IQTLabs
Expand Down
5 changes: 5 additions & 0 deletions axis-ptz-controller/axis_ptz_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,11 @@ def _track_object(self, time_since_last_update: float) -> None:
else:
logging.debug(f"Controller pan and tilt: {self.rho_c}, {self.tau_c} [deg]")


if self.object is None:
logging.error(f"Not sure why it is None here, but not earlier")
return

# recompute the object's current location
# we want to do this after getting the camera's current location because that is a network call
# and it there is latency and jitter in how long it takes.
Expand Down
Binary file modified images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9317483

Please sign in to comment.