Class PTU
Defined in File driver.h
Class Documentation
-
class PTU
High-level driver for FLIR Pan-Tilt Units.
Wraps a Transport (serial or TCP) and exposes the PTU’s ASCII command set as typed C++ methods. All angular quantities are in radians and all rates are in radians per second; conversions to/from raw encoder counts use the per-axis resolutions reported by the PTU on initialize().
Pan/tilt axes are selected throughout the API by a single character:
PTU_PAN(‘p’) for the pan axisPTU_TILT(‘t’) for the tilt axis
Public Functions
-
inline explicit PTU(std::unique_ptr<Transport> transport)
Construct a PTU bound to an already-configured transport.
The transport is not opened here; the caller must have called
transport->open()before initialize().- Parameters:
transport – Transport instance ready to communicate with the device.
-
bool initialize()
Query axis resolutions and limits and prepare for commanding.
- Returns:
trueif the PTU responded to all initialization queries.
-
bool disableLimits()
Disable the PTU’s internal soft motion limits.
- Returns:
trueif the command was acknowledged.
-
float getPosition(char type)
Read the current position of an axis.
- Parameters:
type –
PTU_PANorPTU_TILT.- Returns:
Position in radians.
-
float getSpeed(char type)
Read the current commanded speed of an axis.
- Parameters:
type –
PTU_PANorPTU_TILT.- Returns:
Speed in radians/second.
-
inline float getResolution(char type)
Per-count angular resolution of an axis.
- Parameters:
type –
PTU_PANorPTU_TILT.- Returns:
Resolution in radians/count.
-
inline float getMin(char type)
Minimum reachable position of an axis.
- Parameters:
type –
PTU_PANorPTU_TILT.- Returns:
Minimum position in radians.
-
inline float getMax(char type)
Maximum reachable position of an axis.
- Parameters:
type –
PTU_PANorPTU_TILT.- Returns:
Maximum position in radians.
-
inline float getMinSpeed(char type)
Minimum commandable speed of an axis.
- Parameters:
type –
PTU_PANorPTU_TILT.- Returns:
Minimum speed in radians/second.
-
inline float getMaxSpeed(char type)
Maximum commandable speed of an axis.
- Parameters:
type –
PTU_PANorPTU_TILT.- Returns:
Maximum speed in radians/second.
-
bool setPosition(char type, float pos, bool Block = false)
Move an axis to the desired position.
If
Blockistruethe call does not return until the PTU reports that the target has been reached; otherwise it returns as soon as the command is acknowledged.- Parameters:
type –
PTU_PANorPTU_TILT.pos – Desired position in radians.
Block – Wait for the move to complete before returning.
- Returns:
trueif the command was successfully sent.
-
bool setSpeed(char type, float speed)
Set the commanded speed of an axis.
- Parameters:
type –
PTU_PANorPTU_TILT.speed – Desired speed in radians/second.
- Returns:
trueif the command was successfully sent.
-
bool setMode(char type)
Switch the PTU between position and velocity control modes.
- Parameters:
type –
PTU_VELOCITY(‘v’) orPTU_POSITION(‘i’).- Returns:
trueif the command was successfully sent.
-
char getMode()
Query the active control mode.
- Returns:
PTU_VELOCITY(‘v’) orPTU_POSITION(‘i’).
Protected Functions