ptu_directedperception
Public Member Functions | Protected Member Functions | List of all members
ptu::Driver Class Reference

#include <Driver.h>

Inheritance diagram for ptu::Driver:

Public Member Functions

 Driver ()
 
 ~Driver ()
 
float getMinPanRad ()
 
float getMaxPanRad ()
 
float getMinTiltRad ()
 
float getMaxTiltRad ()
 
void initialize ()
 
void write (const std::string &msg)
 
std::string readAns ()
 
template<typename T >
getQuery (const std::string &answer)
 
int getPos (Axis axis, bool offset)
 
float getPosDeg (Axis axis, bool offset)
 
float getPosRad (Axis axis, bool offset)
 
bool setPosDeg (const Axis &axis, const bool &offset, const float &val, const bool &awaitCompletion=false)
 
bool setPosRad (const Axis &axis, const bool &offset, const float &val, const bool &awaitCompletion=false)
 
bool setPos (const Axis &axis, const bool &offset=false, const int &val=0, const bool &awaitCompletion=false)
 
void setSpeed (Axis axis, int speed)
 
void setSpeedDeg (Axis axis, float speed)
 
void setSpeedRad (Axis axis, float speed)
 
void setHalt ()
 

Protected Member Functions

int extractPacket (const uint8_t *buffer, size_t size) const
 

Constructor & Destructor Documentation

◆ Driver()

Driver::Driver ( )

◆ ~Driver()

Driver::~Driver ( )

Member Function Documentation

◆ extractPacket()

int Driver::extractPacket ( const uint8_t *  buffer,
size_t  size 
) const
protected

Find a packet into the currently accumulated data.

◆ getMaxPanRad()

float ptu::Driver::getMaxPanRad ( )
inline

The maximum pan postion in rad.

◆ getMaxTiltRad()

float ptu::Driver::getMaxTiltRad ( )
inline

The maximum tilt postion in rad.

◆ getMinPanRad()

float ptu::Driver::getMinPanRad ( )
inline

The minimum pan postion in rad.

◆ getMinTiltRad()

float ptu::Driver::getMinTiltRad ( )
inline

The minimum tilt postion in rad.

◆ getPos()

int Driver::getPos ( Axis  axis,
bool  offset 
)

Get current pan-tilt position.

Parameters
axisthe axis to be used
offsetif true, the relative value is used
Returns
position

◆ getPosDeg()

float Driver::getPosDeg ( Axis  axis,
bool  offset 
)

Get the position as degree value instead of ticks as given by getPos.

Parameters
axisSelect the axis to be read out. (PAN or TILT)
offsetif true the offset command will be used.
Returns
the position of selected axis as degree value. (0 is front center).

◆ getPosRad()

float Driver::getPosRad ( Axis  axis,
bool  offset 
)

Get the position in radian.

See also
getPos

◆ getQuery()

template<typename T >
T ptu::Driver::getQuery ( const std::string &  answer)
inline

Converts an answer to a value of type T. The answer string is like '* <result><CR>'.

◆ initialize()

void Driver::initialize ( )

Initial communication with the device to set proper modes and query limits.

◆ readAns()

std::string Driver::readAns ( )

Read the answer of a query.

Parameters
timeouttimeout in ms
Returns
answer string

◆ setHalt()

void Driver::setHalt ( )

Stops motion.

◆ setPos()

bool Driver::setPos ( const Axis axis,
const bool &  offset = false,
const int &  val = 0,
const bool &  awaitCompletion = false 
)

Set current pan-tilt position.

Parameters
valthe value to which to set the position
axisthe axis to be used
offsetif true, the relative value is used
awaitCompletionforce the command to be completed before next command will be processed.
Returns
true if successful

◆ setPosDeg()

bool Driver::setPosDeg ( const Axis axis,
const bool &  offset,
const float &  val,
const bool &  awaitCompletion = false 
)

Set the Position for selected axis to given value in degree.

Parameters
axisSpecify the axis which should be set (PAN, TILT).
offsetSelect if the position should be set as an offset from current position or if false it will be set as absolute value (while 0 is front center).
awaitCompletionSet if movement should be completed before processing next command.
Returns
Returns bool value. true if success, false otherwise.

◆ setPosRad()

bool Driver::setPosRad ( const Axis axis,
const bool &  offset,
const float &  val,
const bool &  awaitCompletion = false 
)

Set the position in radian.

See also
setPos

◆ setSpeed()

void Driver::setSpeed ( Axis  axis,
int  speed 
)

Set desired speed for an axis in positions/second.

◆ setSpeedDeg()

void Driver::setSpeedDeg ( Axis  axis,
float  speed 
)

Set desired speed for an axis in degree/second.

◆ setSpeedRad()

void Driver::setSpeedRad ( Axis  axis,
float  speed 
)

Set desired speed for an axis in radian/second.

◆ write()

void Driver::write ( const std::string &  msg)

Sends a message to the device.

Parameters
msgthe message to be sent
timeouttimeout in ms
Exceptions
iodrivers_basewrite errors

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