Pan-Tilt-Controller: Keyboard input to serial motor commands
This archived pan-tilt controller connects a desktop interface to a serial-controlled positioning unit. The implementation mixes a Qt event loop with pyserial commands and keeps the requested pan and tilt positions in global state.
Repository languagesPython 100%1
Shares calculated from GitHub Linguist bytes.
| Language | % | Bytes |
|---|---|---|
| Python | 9,538 |
Overview
Why it exists
Serial interface and motion control daemon for Directed Perception PTU-46 precision pan-tilt robotic camera units.
Best fit
Automated camera positioning for computer vision experiments.
Getting started
These commands come from the repository documentation. They were not run during this review.
Repository references
Excerpts from the repository’s guides, in their original language. Links open the inspected source revision.
Prerequisites and first run
Requirement libary
README.md
Features and components 2
- Interface events
- pantiltcontroller.py imports PyQt5 and installs a key event filter. Arrow keys and buttons adjust a position variable, then build a pp or tp command. This differs from the older framework description in the README.
- Device initialization
- The module opens COM3 at 9600 baud and writes initialization commands at import time. The UI therefore has an immediate hardware dependency, before a user selects a port or confirms movement.
Architecture
The components and their connections remain available as text. The diagram adds an interactive view.
- Qt key or button event
- Requested position state
- Serial command string
- pyserial connection
- Pan-tilt hardware
Links verified in the repository.
Mermaid Interactive diagram (loads on open)
System overview of the components and connections verified in the repository.

flowchart LR
n0["Qt key or button event"]
n1["Requested position state"]
n2["Serial command string"]
n3["pyserial connection"]
n4["Pan-tilt hardware"]
n0 --> n1
n1 --> n2
n2 --> n3
n3 --> n4
Text version of the diagram
- Qt key or button event → Requested position state
- Requested position state → Serial command string
- Serial command string → pyserial connection
- pyserial connection → Pan-tilt hardware
Follow one path through the code
Follow one arrow-key branch from positionPan or positionTilt to ser.write. The variable records the command target, not independently measured physical position.
Types and file structure
5 declared types, with 5 in the base-relationship overview.
Type diagram
classDiagram
direction TB
class t8cae8612b927["DialogControl"] {
__init__()
eventFilter()
Control()
buttonClick()
}
class tdb265aef05cf["MenuFile"] {
__init__()
Menu()
}
class t087f3f225d99["FormWidget"] {
__init__()
UI()
textBox()
buttonClick()
}
class t3ad2e1e58327["Controller"] {
do_move()
do_reset()
}
class t3c914b206877["PTC"] {
build()
}
class b909aa1bfe7bf["QDialog"] {
<<unresolved_base>>
}
b909aa1bfe7bf <|-- t8cae8612b927
class b368405a93f17["QWidget"] {
<<unresolved_base>>
}
b368405a93f17 <|-- t8cae8612b927
class bc4c59610cef7["QMainWindow"] {
<<unresolved_base>>
}
bc4c59610cef7 <|-- tdb265aef05cf
t8cae8612b927 <|-- tdb265aef05cf
b368405a93f17 <|-- t087f3f225d99
class bc742617f043e["Screen"] {
<<unresolved_base>>
}
bc742617f043e <|-- t3ad2e1e58327
class b21d28968c3d5["App"] {
<<unresolved_base>>
}
b21d28968c3d5 <|-- t3c914b206877
Unresolved bases remain labelled; full signatures are not reconstructed.
Type index
DialogControl(class) ·pantiltcontroller.py:43Methods in the overview:
__init__, eventFilter, Control, buttonClick.Declared bases:
QDialog, QWidget.MenuFile(class) ·pantiltcontroller.py:130Methods in the overview:
__init__, Menu.Declared bases:
QMainWindow, DialogControl.FormWidget(class) ·pantiltcontroller.py:154Methods in the overview:
__init__, UI, textBox, buttonClick.Declared bases:
QWidget.Controller(class) ·old/PTC.py:27Methods in the overview:
do_move, do_reset.Declared bases:
Screen.PTC(class) ·old/PTC.py:51Methods in the overview:
build.Declared bases:
App.
Reference
4 / 4 eligible files read (5 in the tree); 0 oversized, 0 failed reads and 0 syntax diagnostics.
What the scan covers
Known dependency/build folders, credential files and binaries are excluded. The scan covers READMEs, recognized manifests and parser-supported source files.
Linguist statistics cover the whole repository and may include other languages.
File map
flowchart TD
root["Pan-Tilt-Controller"]
f0["PTC-command.py"]
root --> f0
f1["README.md"]
root --> f1
f2["pantiltcontroller.py"]
root --> f2
f3["old/PTC.py"]
root --> f3