Public Member Functions | Private Member Functions | Private Attributes | List of all members
ptu_free::PTUFree Class Reference

#include <PTUFree.h>

Public Member Functions

bool awaitPositionCommandCompletion ()
 awaitPositionCommandCompletion Method to wait for the completion of the last issued pan and tilt position command (waits until ptu stops). More...
 
bool clearPreset ()
 clearPreset Method to delete all existing presets. WARNING: Does not work on older PTUs and is not tested. More...
 
void closeSerialConnection ()
 closeSerialConnection Closes currently used serial port More...
 
std::string communicate (std::string request)
 communicate Method to send a command 'request' to the serial port (and the device) and recieve the answer More...
 
std::vector< std::string > evaluateResponse (std::string response)
 evaluateResponse Method that preprocesses the answer of the PTU. Splits the PTU to a maximum of 3 parts. At position 0 is '*' or '!' (successfull or failed command), at position 1 is the full return message without the qualifier at start (might be "", for example if a set command only was performed) and at 2 (optional) there is the number only if the response contained one (e.g. for casts) More...
 
long getCurrentPanPosition ()
 getCurrentPanPosition Method that queries the current pan position More...
 
long getCurrentPanSpeed ()
 getCurrentPanSpeed Method that queries the current pan speed More...
 
long getCurrentTiltPosition ()
 getCurrentTiltPosition Method that queries the current tilt position More...
 
long getCurrentTiltSpeed ()
 getCurrentTiltSpeed Method that queries the current tilt speed More...
 
long getCurrentUsedMaximumPanPositionLimit ()
 getCurrentUsedMaximumPanPositionLimit Method to get the currently used maximum pan position. More...
 
long getCurrentUsedMaximumTiltPositionLimit ()
 getCurrentUsedMaximumTiltPositionLimit Method to get the currently used maximum tilt position. More...
 
long getCurrentUsedMinimumPanPositionLimit ()
 getCurrentUsedMinimumPanPositionLimit Method to get the currently used minimum pan position. More...
 
long getCurrentUsedMinimumTiltPositionLimit ()
 getCurrentUsedMinimumTiltPositionLimit Method to get the currently used minimum tilt position. More...
 
long getDesiredPanPosition ()
 getDesiredPanPosition Method that queries the desired pan position More...
 
long getDesiredPanSpeed ()
 getDesiredPanSpeed Method that queries the desired pan speed More...
 
long getDesiredTiltPosition ()
 getDesiredTiltPosition Method that queries the desired tilt position More...
 
long getDesiredTiltSpeed ()
 getDesiredTiltSpeed Method that queries the desired tilt speed More...
 
long getFactoryMaximumPanPositionLimit ()
 getFactoryMaximumPanPositionLimit Method to get the factory defined maximum pan position. More...
 
long getFactoryMaximumTiltPositionLimit ()
 getFactoryMaximumTiltPositionLimit Method to get the factory defined maximum tilt position. More...
 
long getFactoryMinimumPanPositionLimit ()
 getFactoryMinimumPanPositionLimit Method to get the factory defined minimum pan position. More...
 
long getFactoryMinimumTiltPositionLimit ()
 getFactoryMinimumTiltPositionLimit Method to get the factory defined minimum tilt position. More...
 
long getPanAcceleartion ()
 getPanAcceleartion Method that queries the pan acceleration (no current or desired here) More...
 
long getPanBaseSpeed ()
 getPanBaseSpeed Returns the current pan base speed More...
 
long getPanInMotionPowerMode ()
 getPanInMotionPowerMode Method to get the move power mode for pan axis. More...
 
long getPanLowerSpeedLimit ()
 getPanLowerSpeedLimit Method that queries the pan lower speed limit. WARNING: This Method consumes either extreme amounts of time to execute or does not work properly with all PTU More...
 
double getPanResolution ()
 getPanResolution Method that queries the pan resolution (seconds/arc per position). Divide by 3600 to get Degree. More...
 
long getPanStationaryPowerMode ()
 getPanStationaryPowerMode Method to get the stationary power mode for pan axis. More...
 
long getPanUpperSpeedLimit ()
 getPanUpperSpeedLimit Method that queries the pan upper speed limit WARNING: This Method consumes either extreme amounts of time to execute or does not work properly with all PTU More...
 
long getPositionExecutionMode ()
 getPositionExecutionMode Method to get the currently used position execution mode. Can return IMMEDIATE_POSITION_EXECUTION_MODE or SLAVED_POSITION_EXECUTION_MODE. More...
 
long getPositionLimitEnforcementMode ()
 getPositionLimitEnforcementMode Method to get the currently used position limit enforcement mode. Can return FACTORY_LIMITS_ENABLED, USER_DEFINED_LIMITS_ENABLED or FACTORY_LIMITS_ENABLED. More...
 
long getSpeedControlMode ()
 getSpeedControlMode Method to get the currently used sped control mode of the ptu. More...
 
long getTiltAcceleartion ()
 getTiltAcceleartion Method that queries the tilt acceleration (no current or desired here) More...
 
long getTiltBaseSpeed ()
 getTiltBaseSpeed Returns the current tilt base speed More...
 
long getTiltInMotionPowerMode ()
 getTiltInMotionPowerMode Method to get the move power mode for tilt axis. More...
 
long getTiltLowerSpeedLimit ()
 getTiltLowerSpeedLimit Method that queries the tilt lower speed limit. WARNING: This Method consumes either extreme amounts of time to execute or does not work properly with all PTU More...
 
double getTiltResolution ()
 getTiltResolution Method that queries the tilt resolution (seconds/arc per position). Divide by 3600 to get Degree. More...
 
long getTiltStationaryPowerMode ()
 getTiltStationaryPowerMode Method to get the stationary power mode for tilt axis. More...
 
long getTiltUpperSpeedLimit ()
 getTiltUpperSpeedLimit Method that queries the tilt upper speed limit WARNING: This Method consumes either extreme amounts of time to execute or does not work properly with all PTU More...
 
long getUserMaximumPanPositionLimit ()
 getUserMaximumPanPositionLimit Method to get the user defined maximum pan position. WARNING: Does not work on older PTUs and is not tested. More...
 
long getUserMaximumTiltPositionLimit ()
 getUserMaximumTiltPositionLimit Method to get the user defined maximum tilt position. WARNING: Does not work on older PTUs and is not tested. More...
 
long getUserMinimumPanPositionLimit ()
 getUserMinimumPanPositionLimit Method to get the user defined minimum pan position. WARNING: Does not work on older PTUs and is not tested. More...
 
long getUserMinimumTiltPositionLimit ()
 getUserMinimumTiltPositionLimit Method to get the user defined minimum tilt position. WARNING: Does not work on older PTUs and is not tested. More...
 
bool gotoPreset (int preset_index)
 gotoPreset Method that moves the ptu to a existing preset of pan and tilt corrdiantes. WARNING: Does not work on older PTUs and is not tested. More...
 
bool halt (long axis)
 halt Method that halts movement on specified axis. More...
 
bool isOpen ()
 isOpen Method to determine if used port is open or closed. More...
 
 PTUFree ()
 PTUFree Constructor for PTUFree object. Not connected to any port. More...
 
 PTUFree (boost::asio::io_service &io)
 PTUFree Constructor for PTUFree object with existing io_service. More...
 
std::string readPTUResponse ()
 readPTUResponse Method that reads from the PTU until delimitor ('
') appears. Then the read data is returned. More...
 
bool reset ()
 reset Method to reset the ptu (pan and/or tilt axis depending on reset mode) More...
 
bool restoreDefault ()
 restoreDefault Method to restore default settings. WARNING: Not tested. More...
 
bool restoreFactoryDefault ()
 restoreFactoryDefault Method to set default settings to factory defaults. Saved to EEPROM, do not use too often. WARNING: Not tested. More...
 
bool saveDefault ()
 saveDefault Method to save the current axis settings as default at power up. Note: This class sets the ptu by invoking setNewSerialConnection to some standard values. To get the values saved by this method invoke restore_defaults after setting the ptu connection. Saved to EEPROM, do not use too often. WARNING: Not tested. More...
 
bool setBaudRate (int baud)
 setBaudRate Sets the baud rate for the serial port that is used. Only use of serial connection is established More...
 
bool setDesiredPanAccelerationAbsolute (short int acceleration)
 setDesiredPanAccelerationAbsolute Method that sets the absolute pan acceleration (position/second^2) More...
 
bool setDesiredPanLowerSpeedLimit (short int lower_speed_limit)
 setDesiredPanLowerSpeedLimit Method that sets the lower speed limit for pan (position/second). WARNING: Takes extremly long or does not work on every ptu More...
 
bool setDesiredPanPositionAbsolute (short int position)
 setDesiredPanPositionAbsolute Method that sets absolute pan position More...
 
bool setDesiredPanPositionRelative (short int position_offset)
 setDesiredPanPositionRelative Method that sets current pan position by offset (current pos + offset = new position) More...
 
bool setDesiredPanSpeedAbsolute (short int speed)
 setDesiredPanSpeedAbsolute Method that sets absolute pan speed (position/second) More...
 
bool setDesiredPanSpeedRelative (short int speed_offset)
 setDesiredPanSpeedRelative Method that sets the desired pan speed relative to the CURRENT (not the desired!) speed with an offset (position/second) More...
 
bool setDesiredPanTiltPositionAbsoluteSlaved (short int pan, short int tilt)
 setDesiredPanTiltPositionAbsoluteSlaved Method that allows a movement of pan and tilt axis to specified absolute position where both start at the same time. This method waits until movement is completed. More...
 
bool setDesiredPanUpperSpeedLimit (short int upper_speed_limit)
 setDesiredPanUpperSpeedLimit Method that sets the upper speed limit for pan (position/second). WARNING: Takes extremly long or does not work on every ptu More...
 
bool setDesiredTiltAccelerationAbsolute (short int acceleration)
 setDesiredTiltAccelerationAbsolute Method that sets the absolute tilt acceleration (position/second^2) More...
 
bool setDesiredTiltLowerSpeedLimit (short int lower_speed_limit)
 setDesiredTiltLowerSpeedLimit Method that sets the lower speed limit for tilt (position/second). WARNING: Takes extremly long or does not work on every ptu More...
 
bool setDesiredTiltPositionAbsolute (short int position)
 setDesiredTiltPositionAbsolute Method that sets absolute tilt position More...
 
bool setDesiredTiltPositionRelative (short int position_offset)
 setDesiredTiltPositionRelative Method that sets current tilt position by offset (current pos + offset = new position) More...
 
bool setDesiredTiltSpeedAbsolute (short int speed)
 setDesiredTiltSpeedAbsolute Method that sets absolute tilt speed (position/second) More...
 
bool setDesiredTiltSpeedRelative (short int speed_offset)
 setDesiredTiltSpeedRelative Method that sets the desired tilt speed relative to the CURRENT (not the desired!) speed with an offset (position/second) More...
 
bool setDesiredTiltUpperSpeedLimit (short int upper_speed_limit)
 setDesiredTiltUpperSpeedLimit Method that sets the upper speed limit for tilt (position/second). WARNING: Takes extremly long or does not work on every ptu More...
 
bool setMaximumPanPositionLimit (short int position)
 setMaximumPanPositionLimit Method that is used to set a user defined maximum pan position limit. WARNING: Does not work on older PTUs and is not tested. More...
 
bool setMaximumTiltPositionLimit (short int position)
 setMaximumTiltPositionLimit Method that is used to set a user defined maximum tilt position limit. WARNING: Does not work on older PTUs and is not tested. More...
 
bool setMinimumPanPositionLimit (short int position)
 setMinimumPanPositionLimit Method that is used to set a user defined minimum pan position limit. WARNING: Does not work on older PTUs and is not tested. More...
 
bool setMinimumTiltPositionLimit (short int position)
 setMinimumTiltPositionLimit Method that is used to set a user defined minimum tilt position limit. WARNING: Does not work on older PTUs and is not tested. More...
 
bool setNewSerialConnection (std::string port, int baud)
 setNewSerialConnection Establishes a new connection via serial port specified by 'port' to a target device using baud rate 'baud'. The ptu is set up with IMMEDIATE_POSITION_EXECUTION_MODE and FACTORY_LIMITS_ENABLED. More...
 
bool setPanBaseSpeed (short int base_speed)
 setPanBaseSpeed Method that sets the base speed for pan (position/second) More...
 
bool setPanInMotionPowerMode (long mode)
 setPanInMotionPowerMode Method to set the move power mode for pan axis. More...
 
bool setPanStationaryPowerMode (long mode)
 setPanStationaryPowerMode Method to set the stationary power mode for pan axis. More...
 
bool setPositionExecutionMode (long mode)
 setPositionExecutionMode Method to set the position execution mode. More...
 
bool setPositionLimitEnforcementMode (long enable)
 setPositionLimitEnforcementMode Method to set the position limit enforcement mode. Warning: USER_DEFINED_LIMITS_ENABLED does not work on older PTUs and setting of this value is not tested. More...
 
bool setPreset (int preset_index, short int pan, short int tilt)
 setPreset Method that allows to associate a pan and tilt position with a preset index. Moves to the pan and tilt position and saves the position as a preset. WARNING: Does not work on older PTUs and is not tested. More...
 
bool setPreset (int preset_index)
 setPreset Method that allows to associate a pan and tilt position with a preset index. Saves the current pan and tilt position as a preset. WARNING: Does not work on older PTUs and is not tested. More...
 
bool setResetMode (long mode)
 setResetMode Method to set the reset mode of the ptu. Saved to EEPROM, do not use too often. WARNING: Not tested. More...
 
bool setSpeedControlMode (long mode)
 setSpeedControlMode Method to set the sped control mode of the ptu. More...
 
bool setTiltBaseSpeed (short int base_speed)
 setTiltBaseSpeed Method that sets the base speed for tilt (position/second) More...
 
bool setTiltInMotionPowerMode (long mode)
 setTiltInMotionPowerMode Method to set the move power mode for tilt axis. More...
 
bool setTiltStationaryPowerMode (long mode)
 setTiltStationaryPowerMode Method to set the stationary power mode for tilt axis. More...
 
void test ()
 test Method to test the methods of this program, for DEBUG/DEVELOPMENT purpose, changes PTU settings for test purpose (restart before normal use) More...
 

Private Member Functions

std::string getErrorString (boost::system::error_code error)
 

Private Attributes

long factory_pan_max
 
long factory_pan_min
 
long factory_tilt_max
 
long factory_tilt_min
 
long position_execution_mode
 
boost::asio::io_service ptu_io_service
 
boost::asio::serial_port ptu_port
 
bool timeout_occured
 
boost::asio::io_service timer_io_service
 

Detailed Description

A class for accessing flir ptu via serial port

Definition at line 46 of file PTUFree.h.

Constructor & Destructor Documentation

ptu_free::PTUFree::PTUFree ( )

PTUFree Constructor for PTUFree object. Not connected to any port.

Definition at line 5 of file PTUFree.cpp.

ptu_free::PTUFree::PTUFree ( boost::asio::io_service &  io)

PTUFree Constructor for PTUFree object with existing io_service.

Parameters
ioExisting io_service object to be used for communication by PTUFree

Definition at line 8 of file PTUFree.cpp.

Member Function Documentation

bool ptu_free::PTUFree::awaitPositionCommandCompletion ( )

awaitPositionCommandCompletion Method to wait for the completion of the last issued pan and tilt position command (waits until ptu stops).

Returns
True if successfull

Definition at line 859 of file PTUFree.cpp.

bool ptu_free::PTUFree::clearPreset ( )

clearPreset Method to delete all existing presets. WARNING: Does not work on older PTUs and is not tested.

Returns
True if successfull

Definition at line 983 of file PTUFree.cpp.

void ptu_free::PTUFree::closeSerialConnection ( )

closeSerialConnection Closes currently used serial port

Definition at line 67 of file PTUFree.cpp.

std::string ptu_free::PTUFree::communicate ( std::string  request)

communicate Method to send a command 'request' to the serial port (and the device) and recieve the answer

Parameters
requestCommand to execute on device connected via serial port
Returns
Execution result message

Definition at line 71 of file PTUFree.cpp.

std::vector< std::string > ptu_free::PTUFree::evaluateResponse ( std::string  response)

evaluateResponse Method that preprocesses the answer of the PTU. Splits the PTU to a maximum of 3 parts. At position 0 is '*' or '!' (successfull or failed command), at position 1 is the full return message without the qualifier at start (might be "", for example if a set command only was performed) and at 2 (optional) there is the number only if the response contained one (e.g. for casts)

Parameters
responsefull ptu response string
Returns
string "split" into 3 parts. [0] is prefix for success('*') or failure ('!'), [1] is the full message without prefix, [2] (optional) is number only if one is contained (e.g. for cast to int/long/...)

Definition at line 99 of file PTUFree.cpp.

long ptu_free::PTUFree::getCurrentPanPosition ( )

getCurrentPanPosition Method that queries the current pan position

Returns
pan position

Definition at line 252 of file PTUFree.cpp.

long ptu_free::PTUFree::getCurrentPanSpeed ( )

getCurrentPanSpeed Method that queries the current pan speed

Returns
pan speed

Definition at line 265 of file PTUFree.cpp.

long ptu_free::PTUFree::getCurrentTiltPosition ( )

getCurrentTiltPosition Method that queries the current tilt position

Returns
tilt position

Definition at line 488 of file PTUFree.cpp.

long ptu_free::PTUFree::getCurrentTiltSpeed ( )

getCurrentTiltSpeed Method that queries the current tilt speed

Returns
tilt speed

Definition at line 501 of file PTUFree.cpp.

long ptu_free::PTUFree::getCurrentUsedMaximumPanPositionLimit ( )

getCurrentUsedMaximumPanPositionLimit Method to get the currently used maximum pan position.

Returns
Maximum pan position being currently used

Definition at line 765 of file PTUFree.cpp.

long ptu_free::PTUFree::getCurrentUsedMaximumTiltPositionLimit ( )

getCurrentUsedMaximumTiltPositionLimit Method to get the currently used maximum tilt position.

Returns
Maximum tilt position being currently used

Definition at line 789 of file PTUFree.cpp.

long ptu_free::PTUFree::getCurrentUsedMinimumPanPositionLimit ( )

getCurrentUsedMinimumPanPositionLimit Method to get the currently used minimum pan position.

Returns
Minimum pan position being currently used

Definition at line 753 of file PTUFree.cpp.

long ptu_free::PTUFree::getCurrentUsedMinimumTiltPositionLimit ( )

getCurrentUsedMinimumTiltPositionLimit Method to get the currently used minimum tilt position.

Returns
Minimum tilt position being currently used

Definition at line 777 of file PTUFree.cpp.

long ptu_free::PTUFree::getDesiredPanPosition ( )

getDesiredPanPosition Method that queries the desired pan position

Returns
desired pan position

Definition at line 320 of file PTUFree.cpp.

long ptu_free::PTUFree::getDesiredPanSpeed ( )

getDesiredPanSpeed Method that queries the desired pan speed

Returns
desired pan speed

Definition at line 333 of file PTUFree.cpp.

long ptu_free::PTUFree::getDesiredTiltPosition ( )

getDesiredTiltPosition Method that queries the desired tilt position

Returns
desired tilt position

Definition at line 556 of file PTUFree.cpp.

long ptu_free::PTUFree::getDesiredTiltSpeed ( )

getDesiredTiltSpeed Method that queries the desired tilt speed

Returns
desired tilt speed

Definition at line 569 of file PTUFree.cpp.

std::string ptu_free::PTUFree::getErrorString ( boost::system::error_code  error)
private

Definition at line 1305 of file PTUFree.cpp.

long ptu_free::PTUFree::getFactoryMaximumPanPositionLimit ( )

getFactoryMaximumPanPositionLimit Method to get the factory defined maximum pan position.

Returns
Maximum pan position defined by factory default

Definition at line 744 of file PTUFree.cpp.

long ptu_free::PTUFree::getFactoryMaximumTiltPositionLimit ( )

getFactoryMaximumTiltPositionLimit Method to get the factory defined maximum tilt position.

Returns
Maximum tilt position defined by factory default

Definition at line 750 of file PTUFree.cpp.

long ptu_free::PTUFree::getFactoryMinimumPanPositionLimit ( )

getFactoryMinimumPanPositionLimit Method to get the factory defined minimum pan position.

Returns
Minimum pan position defined by factory default

Definition at line 741 of file PTUFree.cpp.

long ptu_free::PTUFree::getFactoryMinimumTiltPositionLimit ( )

getFactoryMinimumTiltPositionLimit Method to get the factory defined minimum tilt position.

Returns
Minimum tilt position defined by factory default

Definition at line 747 of file PTUFree.cpp.

long ptu_free::PTUFree::getPanAcceleartion ( )

getPanAcceleartion Method that queries the pan acceleration (no current or desired here)

Returns
pan acceleration

Definition at line 346 of file PTUFree.cpp.

long ptu_free::PTUFree::getPanBaseSpeed ( )

getPanBaseSpeed Returns the current pan base speed

Returns
pan base speed

Definition at line 359 of file PTUFree.cpp.

long ptu_free::PTUFree::getPanInMotionPowerMode ( )

getPanInMotionPowerMode Method to get the move power mode for pan axis.

Returns
Move power mode for pan axis, can be REGULAR_MOVE_POWER_MODE, LOW_MOVE_POWER_MODE or HIGH_MOVE_POWER_MODE

Definition at line 1264 of file PTUFree.cpp.

long ptu_free::PTUFree::getPanLowerSpeedLimit ( )

getPanLowerSpeedLimit Method that queries the pan lower speed limit. WARNING: This Method consumes either extreme amounts of time to execute or does not work properly with all PTU

Returns
pan lower speed limit in position/second

Definition at line 294 of file PTUFree.cpp.

double ptu_free::PTUFree::getPanResolution ( )

getPanResolution Method that queries the pan resolution (seconds/arc per position). Divide by 3600 to get Degree.

Returns
seconds/arc per position of step motor on pan axis

Definition at line 307 of file PTUFree.cpp.

long ptu_free::PTUFree::getPanStationaryPowerMode ( )

getPanStationaryPowerMode Method to get the stationary power mode for pan axis.

Returns
Stationary power mode for pan axis, can be REGULAR_HOLD_POWER_MODE, LOW_HOLD_POWER_MODE or OFF_HOLD_POWER_MODE

Definition at line 1172 of file PTUFree.cpp.

long ptu_free::PTUFree::getPanUpperSpeedLimit ( )

getPanUpperSpeedLimit Method that queries the pan upper speed limit WARNING: This Method consumes either extreme amounts of time to execute or does not work properly with all PTU

Returns
pan upper speed limit in position/second

Definition at line 281 of file PTUFree.cpp.

long ptu_free::PTUFree::getPositionExecutionMode ( )

getPositionExecutionMode Method to get the currently used position execution mode. Can return IMMEDIATE_POSITION_EXECUTION_MODE or SLAVED_POSITION_EXECUTION_MODE.

Returns
current position execution mode, can be IMMEDIATE_POSITION_EXECUTION_MODE or SLAVED_POSITION_EXECUTION_MODE

Definition at line 854 of file PTUFree.cpp.

long ptu_free::PTUFree::getPositionLimitEnforcementMode ( )

getPositionLimitEnforcementMode Method to get the currently used position limit enforcement mode. Can return FACTORY_LIMITS_ENABLED, USER_DEFINED_LIMITS_ENABLED or FACTORY_LIMITS_ENABLED.

Returns
Currently used position limit enforcement mode

Definition at line 804 of file PTUFree.cpp.

long ptu_free::PTUFree::getSpeedControlMode ( )

getSpeedControlMode Method to get the currently used sped control mode of the ptu.

Returns
Used speed control mode. Can be INDEPENDENT_SPEED_MODE or PURE_VELOCITY_CONTROL_MODE.

Definition at line 1020 of file PTUFree.cpp.

long ptu_free::PTUFree::getTiltAcceleartion ( )

getTiltAcceleartion Method that queries the tilt acceleration (no current or desired here)

Returns
tilt acceleration

Definition at line 582 of file PTUFree.cpp.

long ptu_free::PTUFree::getTiltBaseSpeed ( )

getTiltBaseSpeed Returns the current tilt base speed

Returns
tilt base speed

Definition at line 595 of file PTUFree.cpp.

long ptu_free::PTUFree::getTiltInMotionPowerMode ( )

getTiltInMotionPowerMode Method to get the move power mode for tilt axis.

Returns
Move power mode for tilt axis, can be REGULAR_MOVE_POWER_MODE, LOW_MOVE_POWER_MODE or HIGH_MOVE_POWER_MODE

Definition at line 1284 of file PTUFree.cpp.

long ptu_free::PTUFree::getTiltLowerSpeedLimit ( )

getTiltLowerSpeedLimit Method that queries the tilt lower speed limit. WARNING: This Method consumes either extreme amounts of time to execute or does not work properly with all PTU

Returns
tilt lower speed limit in position/second

Definition at line 530 of file PTUFree.cpp.

double ptu_free::PTUFree::getTiltResolution ( )

getTiltResolution Method that queries the tilt resolution (seconds/arc per position). Divide by 3600 to get Degree.

Returns
seconds/arc per position of step motor on tilt axis

Definition at line 543 of file PTUFree.cpp.

long ptu_free::PTUFree::getTiltStationaryPowerMode ( )

getTiltStationaryPowerMode Method to get the stationary power mode for tilt axis.

Returns
Stationary power mode for tilt axis, can be REGULAR_HOLD_POWER_MODE, LOW_HOLD_POWER_MODE or OFF_HOLD_POWER_MODE

Definition at line 1192 of file PTUFree.cpp.

long ptu_free::PTUFree::getTiltUpperSpeedLimit ( )

getTiltUpperSpeedLimit Method that queries the tilt upper speed limit WARNING: This Method consumes either extreme amounts of time to execute or does not work properly with all PTU

Returns
tilt upper speed limit in position/second

Definition at line 517 of file PTUFree.cpp.

long ptu_free::PTUFree::getUserMaximumPanPositionLimit ( )

getUserMaximumPanPositionLimit Method to get the user defined maximum pan position. WARNING: Does not work on older PTUs and is not tested.

Returns
Maximum pan position defined by user

Definition at line 700 of file PTUFree.cpp.

long ptu_free::PTUFree::getUserMaximumTiltPositionLimit ( )

getUserMaximumTiltPositionLimit Method to get the user defined maximum tilt position. WARNING: Does not work on older PTUs and is not tested.

Returns
Maximum tilt position defined by user

Definition at line 728 of file PTUFree.cpp.

long ptu_free::PTUFree::getUserMinimumPanPositionLimit ( )

getUserMinimumPanPositionLimit Method to get the user defined minimum pan position. WARNING: Does not work on older PTUs and is not tested.

Returns
Minimum pan position defined by user

Definition at line 686 of file PTUFree.cpp.

long ptu_free::PTUFree::getUserMinimumTiltPositionLimit ( )

getUserMinimumTiltPositionLimit Method to get the user defined minimum tilt position. WARNING: Does not work on older PTUs and is not tested.

Returns
Minimum tilt position defined by user

Definition at line 714 of file PTUFree.cpp.

bool ptu_free::PTUFree::gotoPreset ( int  preset_index)

gotoPreset Method that moves the ptu to a existing preset of pan and tilt corrdiantes. WARNING: Does not work on older PTUs and is not tested.

Parameters
preset_indexNumber to identify preset. Must be between 1 and 32
Returns
True if successfull

Definition at line 969 of file PTUFree.cpp.

bool ptu_free::PTUFree::halt ( long  axis)

halt Method that halts movement on specified axis.

Parameters
axisAxis to halt, can be PAN or TILT
Returns
True if successfull

Definition at line 872 of file PTUFree.cpp.

bool ptu_free::PTUFree::isOpen ( )

isOpen Method to determine if used port is open or closed.

Returns
True if open

Definition at line 2401 of file PTUFree.cpp.

std::string ptu_free::PTUFree::readPTUResponse ( )

readPTUResponse Method that reads from the PTU until delimitor ('
') appears. Then the read data is returned.

Returns
Data from serial port until next delimitor ('
').

Definition at line 79 of file PTUFree.cpp.

bool ptu_free::PTUFree::reset ( )

reset Method to reset the ptu (pan and/or tilt axis depending on reset mode)

Returns
True if successfull

Definition at line 1038 of file PTUFree.cpp.

bool ptu_free::PTUFree::restoreDefault ( )

restoreDefault Method to restore default settings. WARNING: Not tested.

Returns
True if successfull

Definition at line 1094 of file PTUFree.cpp.

bool ptu_free::PTUFree::restoreFactoryDefault ( )

restoreFactoryDefault Method to set default settings to factory defaults. Saved to EEPROM, do not use too often. WARNING: Not tested.

Returns
True if successfull

Definition at line 1107 of file PTUFree.cpp.

bool ptu_free::PTUFree::saveDefault ( )

saveDefault Method to save the current axis settings as default at power up. Note: This class sets the ptu by invoking setNewSerialConnection to some standard values. To get the values saved by this method invoke restore_defaults after setting the ptu connection. Saved to EEPROM, do not use too often. WARNING: Not tested.

Returns
True if successfull

Definition at line 1081 of file PTUFree.cpp.

bool ptu_free::PTUFree::setBaudRate ( int  baud)

setBaudRate Sets the baud rate for the serial port that is used. Only use of serial connection is established

Parameters
baudBaud rate for serial port
Returns
True if setting was successfull

Definition at line 12 of file PTUFree.cpp.

bool ptu_free::PTUFree::setDesiredPanAccelerationAbsolute ( short int  acceleration)

setDesiredPanAccelerationAbsolute Method that sets the absolute pan acceleration (position/second^2)

Parameters
accelerationvalue in position/second^2 for pan acceleration
Returns
True if successfull

Definition at line 193 of file PTUFree.cpp.

bool ptu_free::PTUFree::setDesiredPanLowerSpeedLimit ( short int  lower_speed_limit)

setDesiredPanLowerSpeedLimit Method that sets the lower speed limit for pan (position/second). WARNING: Takes extremly long or does not work on every ptu

Parameters
lower_speed_limitvalue for pan lower speed limit in position/second. MUST BE 0 or >= 57 (second value depending on used ptu)
Returns
True if successfull

Definition at line 224 of file PTUFree.cpp.

bool ptu_free::PTUFree::setDesiredPanPositionAbsolute ( short int  position)

setDesiredPanPositionAbsolute Method that sets absolute pan position

Parameters
positionabsolute pan position ptu shall move to
Returns
True if successfull

Definition at line 139 of file PTUFree.cpp.

bool ptu_free::PTUFree::setDesiredPanPositionRelative ( short int  position_offset)

setDesiredPanPositionRelative Method that sets current pan position by offset (current pos + offset = new position)

Parameters
position_offsetOffset of current position to be added for new pan position
Returns
True if successfull

Definition at line 152 of file PTUFree.cpp.

bool ptu_free::PTUFree::setDesiredPanSpeedAbsolute ( short int  speed)

setDesiredPanSpeedAbsolute Method that sets absolute pan speed (position/second)

Parameters
speedabsolute value in position/second for pan speed
Returns
True if successfull

Definition at line 165 of file PTUFree.cpp.

bool ptu_free::PTUFree::setDesiredPanSpeedRelative ( short int  speed_offset)

setDesiredPanSpeedRelative Method that sets the desired pan speed relative to the CURRENT (not the desired!) speed with an offset (position/second)

Parameters
speed_offsetoffset in position/second from CURRENT speed to set new desired speed
Returns
True if successfull

Definition at line 180 of file PTUFree.cpp.

bool ptu_free::PTUFree::setDesiredPanTiltPositionAbsoluteSlaved ( short int  pan,
short int  tilt 
)

setDesiredPanTiltPositionAbsoluteSlaved Method that allows a movement of pan and tilt axis to specified absolute position where both start at the same time. This method waits until movement is completed.

Parameters
panAbsolute position for pan
tiltAbsolute position for tilt
Returns
True if successfull

Definition at line 900 of file PTUFree.cpp.

bool ptu_free::PTUFree::setDesiredPanUpperSpeedLimit ( short int  upper_speed_limit)

setDesiredPanUpperSpeedLimit Method that sets the upper speed limit for pan (position/second). WARNING: Takes extremly long or does not work on every ptu

Parameters
upper_speed_limitvalue for pan upper speed limit in position/second
Returns
True if successfull

Definition at line 208 of file PTUFree.cpp.

bool ptu_free::PTUFree::setDesiredTiltAccelerationAbsolute ( short int  acceleration)

setDesiredTiltAccelerationAbsolute Method that sets the absolute tilt acceleration (position/second^2)

Parameters
accelerationvalue in position/second^2 for tilt acceleration
Returns
True if successfull

Definition at line 429 of file PTUFree.cpp.

bool ptu_free::PTUFree::setDesiredTiltLowerSpeedLimit ( short int  lower_speed_limit)

setDesiredTiltLowerSpeedLimit Method that sets the lower speed limit for tilt (position/second). WARNING: Takes extremly long or does not work on every ptu

Parameters
lower_speed_limitvalue for tilt lower speed limit in position/second. MUST BE 0 or >= 57 (second value depending on used ptu)
Returns
True if successfull

Definition at line 460 of file PTUFree.cpp.

bool ptu_free::PTUFree::setDesiredTiltPositionAbsolute ( short int  position)

setDesiredTiltPositionAbsolute Method that sets absolute tilt position

Parameters
positionabsolute tilt position ptu shall move to
Returns
True if successfull

Definition at line 375 of file PTUFree.cpp.

bool ptu_free::PTUFree::setDesiredTiltPositionRelative ( short int  position_offset)

setDesiredTiltPositionRelative Method that sets current tilt position by offset (current pos + offset = new position)

Parameters
position_offsetOffset of current position to be added for new tilt position
Returns
True if successfull

Definition at line 388 of file PTUFree.cpp.

bool ptu_free::PTUFree::setDesiredTiltSpeedAbsolute ( short int  speed)

setDesiredTiltSpeedAbsolute Method that sets absolute tilt speed (position/second)

Parameters
speedabsolute value in position/second for tilt speed
Returns
True if successfull

Definition at line 401 of file PTUFree.cpp.

bool ptu_free::PTUFree::setDesiredTiltSpeedRelative ( short int  speed_offset)

setDesiredTiltSpeedRelative Method that sets the desired tilt speed relative to the CURRENT (not the desired!) speed with an offset (position/second)

Parameters
speed_offsetoffset in position/second from CURRENT speed to set new desired speed
Returns
True if successfull

Definition at line 416 of file PTUFree.cpp.

bool ptu_free::PTUFree::setDesiredTiltUpperSpeedLimit ( short int  upper_speed_limit)

setDesiredTiltUpperSpeedLimit Method that sets the upper speed limit for tilt (position/second). WARNING: Takes extremly long or does not work on every ptu

Parameters
upper_speed_limitvalue for tilt upper speed limit in position/second
Returns
True if successfull

Definition at line 444 of file PTUFree.cpp.

bool ptu_free::PTUFree::setMaximumPanPositionLimit ( short int  position)

setMaximumPanPositionLimit Method that is used to set a user defined maximum pan position limit. WARNING: Does not work on older PTUs and is not tested.

Parameters
positionValue for the maximum pan position allowed
Returns
True if successfull

Definition at line 648 of file PTUFree.cpp.

bool ptu_free::PTUFree::setMaximumTiltPositionLimit ( short int  position)

setMaximumTiltPositionLimit Method that is used to set a user defined maximum tilt position limit. WARNING: Does not work on older PTUs and is not tested.

Parameters
positionValue for the maximum tilt position allowed
Returns
True if successfull

Definition at line 672 of file PTUFree.cpp.

bool ptu_free::PTUFree::setMinimumPanPositionLimit ( short int  position)

setMinimumPanPositionLimit Method that is used to set a user defined minimum pan position limit. WARNING: Does not work on older PTUs and is not tested.

Parameters
positionValue for the minimum pan position allowed
Returns
True if successfull

Definition at line 636 of file PTUFree.cpp.

bool ptu_free::PTUFree::setMinimumTiltPositionLimit ( short int  position)

setMinimumTiltPositionLimit Method that is used to set a user defined minimum tilt position limit. WARNING: Does not work on older PTUs and is not tested.

Parameters
positionValue for the minimum tilt position allowed
Returns
True if successfull

Definition at line 660 of file PTUFree.cpp.

bool ptu_free::PTUFree::setNewSerialConnection ( std::string  port,
int  baud 
)

setNewSerialConnection Establishes a new connection via serial port specified by 'port' to a target device using baud rate 'baud'. The ptu is set up with IMMEDIATE_POSITION_EXECUTION_MODE and FACTORY_LIMITS_ENABLED.

Parameters
portidentifier of serial port that will be used
baudbaud rate for serial port
Returns
True if establishing a connection was successfull

Definition at line 27 of file PTUFree.cpp.

bool ptu_free::PTUFree::setPanBaseSpeed ( short int  base_speed)

setPanBaseSpeed Method that sets the base speed for pan (position/second)

Parameters
base_speedvalue for pan base speed in position/second
Returns
True if successfull

Definition at line 237 of file PTUFree.cpp.

bool ptu_free::PTUFree::setPanInMotionPowerMode ( long  mode)

setPanInMotionPowerMode Method to set the move power mode for pan axis.

Parameters
modeMove power mode for pan axis, can be REGULAR_MOVE_POWER_MODE, LOW_MOVE_POWER_MODE or HIGH_MOVE_POWER_MODE
Returns
True if successfull

Definition at line 1213 of file PTUFree.cpp.

bool ptu_free::PTUFree::setPanStationaryPowerMode ( long  mode)

setPanStationaryPowerMode Method to set the stationary power mode for pan axis.

Parameters
modeStationary power mode for pan axis, can be REGULAR_HOLD_POWER_MODE, LOW_HOLD_POWER_MODE or OFF_HOLD_POWER_MODE
Returns
True if successfull

Definition at line 1120 of file PTUFree.cpp.

bool ptu_free::PTUFree::setPositionExecutionMode ( long  mode)

setPositionExecutionMode Method to set the position execution mode.

Parameters
modePosition execution mode. Can be IMMEDIATE_POSITION_EXECUTION_MODE or SLAVED_POSITION_EXECUTION_MODE.
Returns
True if successfull

Definition at line 825 of file PTUFree.cpp.

bool ptu_free::PTUFree::setPositionLimitEnforcementMode ( long  enable)

setPositionLimitEnforcementMode Method to set the position limit enforcement mode. Warning: USER_DEFINED_LIMITS_ENABLED does not work on older PTUs and setting of this value is not tested.

Parameters
enableType of position limit enforcement to enable. Possible values are FACTORY_LIMITS_ENABLED, USER_DEFINED_LIMITS_ENABLED (warning: does not work on older PTU's) and LIMITS_DISABLED
Returns
True if successfull

Definition at line 610 of file PTUFree.cpp.

bool ptu_free::PTUFree::setPreset ( int  preset_index,
short int  pan,
short int  tilt 
)

setPreset Method that allows to associate a pan and tilt position with a preset index. Moves to the pan and tilt position and saves the position as a preset. WARNING: Does not work on older PTUs and is not tested.

Parameters
preset_indexNumber to identify preset. Must be between 1 and 32
panAbsolute position for pan for preset
tiltAbsolute position for tilt for preset
Returns
True if successfull

Definition at line 936 of file PTUFree.cpp.

bool ptu_free::PTUFree::setPreset ( int  preset_index)

setPreset Method that allows to associate a pan and tilt position with a preset index. Saves the current pan and tilt position as a preset. WARNING: Does not work on older PTUs and is not tested.

Parameters
preset_indexNumber to identify preset. Must be between 1 and 32
Returns
True if successfull

Definition at line 952 of file PTUFree.cpp.

bool ptu_free::PTUFree::setResetMode ( long  mode)

setResetMode Method to set the reset mode of the ptu. Saved to EEPROM, do not use too often. WARNING: Not tested.

Parameters
modePtu reset mode. Possibles Values are NO_RESET_MODE, PAN_ONLY_RESET_MODE, TILT_ONLY_RESET_MODE or BOTH_RESET_MODE
Returns
True if successfull

Definition at line 1052 of file PTUFree.cpp.

bool ptu_free::PTUFree::setSpeedControlMode ( long  mode)

setSpeedControlMode Method to set the sped control mode of the ptu.

Parameters
modeSpeed control mode to set, possible values are INDEPENDENT_SPEED_MODE or PURE_VELOCITY_CONTROL_MODE
Returns
True if successfull

Definition at line 996 of file PTUFree.cpp.

bool ptu_free::PTUFree::setTiltBaseSpeed ( short int  base_speed)

setTiltBaseSpeed Method that sets the base speed for tilt (position/second)

Parameters
base_speedvalue for tilt base speed in position/second
Returns
True if successfull

Definition at line 473 of file PTUFree.cpp.

bool ptu_free::PTUFree::setTiltInMotionPowerMode ( long  mode)

setTiltInMotionPowerMode Method to set the move power mode for tilt axis.

Parameters
modeMove power mode for tilt axis, can be REGULAR_MOVE_POWER_MODE, LOW_MOVE_POWER_MODE or HIGH_MOVE_POWER_MODE
Returns
True if successfull

Definition at line 1238 of file PTUFree.cpp.

bool ptu_free::PTUFree::setTiltStationaryPowerMode ( long  mode)

setTiltStationaryPowerMode Method to set the stationary power mode for tilt axis.

Parameters
modeStationary power mode for tilt axis, can be REGULAR_HOLD_POWER_MODE, LOW_HOLD_POWER_MODE or OFF_HOLD_POWER_MODE
Returns
True if successfull

Definition at line 1146 of file PTUFree.cpp.

void ptu_free::PTUFree::test ( )

test Method to test the methods of this program, for DEBUG/DEVELOPMENT purpose, changes PTU settings for test purpose (restart before normal use)

Definition at line 1633 of file PTUFree.cpp.

Member Data Documentation

long ptu_free::PTUFree::factory_pan_max
private

Definition at line 585 of file PTUFree.h.

long ptu_free::PTUFree::factory_pan_min
private

Definition at line 584 of file PTUFree.h.

long ptu_free::PTUFree::factory_tilt_max
private

Definition at line 587 of file PTUFree.h.

long ptu_free::PTUFree::factory_tilt_min
private

Definition at line 586 of file PTUFree.h.

long ptu_free::PTUFree::position_execution_mode
private

Definition at line 588 of file PTUFree.h.

boost::asio::io_service ptu_free::PTUFree::ptu_io_service
private

Definition at line 580 of file PTUFree.h.

boost::asio::serial_port ptu_free::PTUFree::ptu_port
private

Definition at line 582 of file PTUFree.h.

bool ptu_free::PTUFree::timeout_occured
private

Definition at line 583 of file PTUFree.h.

boost::asio::io_service ptu_free::PTUFree::timer_io_service
private

Definition at line 581 of file PTUFree.h.


The documentation for this class was generated from the following files:


asr_flir_ptu_driver
Author(s): Valerij Wittenbeck, Joachim Gehrung, Pascal Meißner, Patrick Schlosser
autogenerated on Mon Dec 2 2019 03:15:17