Skip to content

IQTLabs/edgetech-axis-ptz-controller

Repository files navigation

Contributors Forks Stargazers Issues MIT License


Logo

Edgetech-Axis-Ptz-Controller

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, 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.

Make Contribution · Report Bug · Request Feature

Built With

Python Poetry Docker

Getting Started

To run this repo, simply run:

docker-compose up

The AXIS PTZ network camera controller is containerized and dependencies are managed using poetry.

Prerequisites

Running this repo requires that you have Docker 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. 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.

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

Roadmap

  • TBA

See the open issues for a full list of proposed features (and known issues).

Contributing

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b dev)
  3. Commit your Changes (git commit -m 'adding some feature')
  4. Run (and make sure they pass):
black --diff --check *.py

pylint --disable=all --enable=unused-import *.py

mypy --allow-untyped-decorators --ignore-missing-imports --no-warn-return-any --strict --allow-subclassing-any *.py

If you do not have them installed, you can install them with pip install "black<23" pylint==v3.0.0a3 mypy==v0.991.

  1. Push to the Branch (git push origin dev)
  2. Open a Pull Request

See CONTRIBUTING.md for more information.

License

Distributed under the Apache 2.0. See LICENSE.txt for more information.

Contact IQTLabs

See our other projects: https://github.com/IQTLabs/

(back to top)