-
Notifications
You must be signed in to change notification settings - Fork 0
Directed Perception Pan–Tilt Unit (PTU)
This page describes how to connect and control the Directed Perception PTU-46-17.5 Pan–Tilt Unit on Ubuntu 22.04 using a USB-to-RS232 adapter.
The PTU is used to position the ZED 2i camera over the workspace.
Plug in the PTU adapter and check which serial device was created:
dmesg | grep ttyUSBExample output:
usb 3-2: ch341-uart converter now attached to ttyUSB0
This means the PTU is available at:
/dev/ttyUSB0
If you unplug and replug the adapter, a new /dev/ttyUSBX device should appear.
If you do not have permission to access /dev/ttyUSB0:
sudo usermod -a -G dialout $USERThen log out and log back in.
Install screen if needed:
sudo apt install screenConnect to the PTU:
screen /dev/ttyUSB0 9600If you cannot see what you type:
Ctrl + A → : → echo
To exit screen:
Ctrl + A → \ → y
After connecting, try typing:
POS
If the PTU responds with:
! Illegal argument
This is actually good — it means the PTU is responding, but the command format is wrong.
The PTU requires axis-specific commands.
| Command | Description |
|---|---|
| PP | Pan position query |
| TP | Tilt position query |
| PP593 | Move pan to +10° |
| TP-297 | Move tilt to -5° |
| PS 1000 | Set pan speed |
| TS 1000 | Set tilt speed |
| R | Reset / Home |
Example commands:
PP
TP
PP593
TP-297
The PTU uses counts, not degrees.
Approximate conversion:
59.3 counts ≈ 1 degree
Examples:
| Degrees | Counts |
|---|---|
| 10° | 593 |
| 30° | 1780 |
| -5° | -297 |
| -10° | -593 |
In the experiment, the PTU tilt is typically set with:
TP-800
This positions the camera correctly over the workspace.
| Setting | Value |
|---|---|
| Baud rate | 9600 |
| Data bits | 8 |
| Parity | None |
| Stop bits | 1 |
| Mode | 8N1 |
Important notes:
- Commands are case-sensitive
- Commands must end with carriage return
- If you see
! Illegal argument, the command format is incorrect -
PPandTPwithout numbers return the current position
Typical PTU workflow:
dmesg | grep ttyUSB
screen /dev/ttyUSB0 9600
TP-800The camera should now be positioned correctly.