VCC4 Class Reference

interface with the pan-tilt mechanism of a Canon VC-C4 camera More...

#include <Devices/VCC4.H>

Inheritance diagram for VCC4:
Inheritance graph
[legend]
Collaboration diagram for VCC4:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 VCC4 (OptionManager &mgr, const std::string &descrName="VCC4 Pan/Tilt Camera Driver", const std::string &tagName="VCC4driver")
 constructor. See ModelComponent.H.
 ~VCC4 (void)
 destructor - closes serial connection
int gotoPosition (float pan, float tilt, bool wait=true)
 go to the specified position
int getPosition (float &pan, float &tilt, bool wait=true)
 retrieve the current position
bool IsMoving (void)
 is the pedestal moving?
int PlainCommand (int cmdno, bool wait=true)
 send a command that does not need parameters
int AbsNumCommand (int cmdno, unsigned int value, bool wait=true)
 send a command that needs an integer number as a parameter
int AngleCommand (int cmdno, float angle1, float angle2, bool wait=true)
 send a command that needs two angles as parameters
int StringCommand (int cmdno, char *string, bool wait=true)
 send a command that needs a string as a parameter
int getAbsNum (unsigned int length)
 retrieve an absolute number from the ReplyString
int getOneAngle (float &angle)
 retrieve one angle from the ReplyString
int getTwoAngles (float &angle1, float &angle2)
 retrieve two angle values from ReplyString
int CameraInitialize (bool goHome=false)
 initialize camera
int setUnitNo (int unum)
 set the unit number
int getUnitNo (void)
 get the unit number
float getPulseRatio (void)
 returns the pulse ratio for the pan and tilt mechanism

Public Attributes

char ReplyString [30]
 reply string from last command (i.e. status reports and other replies)

Protected Member Functions

int SendRawCommand (int cmdno, char *param=NULL)
 send a command with parameters to the device
int WaitRawCommand (int cmdno, char *param=NULL)
 send command and keep trying if busy
int getIndex (int cmdno)
 return the index for a command number
int getReply (void)
 attempt to retrieve a reply
int intToHexString (unsigned int value, char *buf, unsigned int length)
 transforms an unsigned int to a string of hex digits
int hexStringToInt (char *buf, unsigned int length)
 transforms a string of hex digits into an int
void start1 ()
 get started (see ModelComponent.H). The serial port gets configured.
void stop1 ()
 get stopped (see ModelComponent.H). We return the unit to home position

Protected Attributes

nub::soft_ref< SerialitsPort
 our serial port
OModelParam< std::stringitsSerialDevice
 our serial device
OModelParam< int > itsUnitNo
 our unit number
OModelParam< float > itsPulseRatio
 our pulse ratio
OModelParam< float > itsMaxAngle
 our max angle

Detailed Description

interface with the pan-tilt mechanism of a Canon VC-C4 camera

Definition at line 76 of file VCC4.H.


Constructor & Destructor Documentation

VCC4::VCC4 ( OptionManager mgr,
const std::string descrName = "VCC4 Pan/Tilt Camera Driver",
const std::string tagName = "VCC4driver" 
)

constructor. See ModelComponent.H.

Definition at line 48 of file VCC4.C.

References ModelComponent::addSubComponent(), and itsPort.

VCC4::~VCC4 ( void   ) 

destructor - closes serial connection

Definition at line 62 of file VCC4.C.


Member Function Documentation

int VCC4::AbsNumCommand ( int  cmdno,
unsigned int  value,
bool  wait = true 
)

send a command that needs an integer number as a parameter

Parameters:
cmdno for command numbers see VCC4cmddef.H
value the integer value to set
wait wait for successful completion if true
Returns:
0 if successful, some error code otherwise

Definition at line 194 of file VCC4.C.

References getIndex(), intToHexString(), SendRawCommand(), and WaitRawCommand().

int VCC4::AngleCommand ( int  cmdno,
float  angle1,
float  angle2,
bool  wait = true 
)

send a command that needs two angles as parameters

Parameters:
cmdno for command numbers see VCC4cmddef.H
angle1 
angle2 the angles (in degrees) to set
wait wait for successful completion if true
Returns:
0 if successful, some error code otherwise

Definition at line 238 of file VCC4.C.

References getIndex(), OModelParam< T >::getVal(), intToHexString(), itsMaxAngle, itsPulseRatio, SendRawCommand(), and WaitRawCommand().

Referenced by gotoPosition().

int VCC4::CameraInitialize ( bool  goHome = false  ) 

initialize camera

after successful completion, ReplyString contains the name of the device.

Parameters:
goHome put camera into Home position if true
Returns:
0 if successful, some error code otherwise

Definition at line 79 of file VCC4.C.

References getAbsNum(), getOneAngle(), OModelParam< T >::getVal(), itsMaxAngle, itsPulseRatio, PlainCommand(), and OModelParam< T >::setVal().

int VCC4::getAbsNum ( unsigned int  length  )  [inline]

retrieve an absolute number from the ReplyString

Parameters:
the length of the string representing the number
Returns:
the integer value extracted from the ReplyString

Definition at line 229 of file VCC4.H.

References hexStringToInt(), and ReplyString.

Referenced by CameraInitialize().

int VCC4::getIndex ( int  cmdno  )  [protected]

return the index for a command number

Definition at line 415 of file VCC4.C.

Referenced by AbsNumCommand(), AngleCommand(), PlainCommand(), SendRawCommand(), and StringCommand().

int VCC4::getOneAngle ( float &  angle  ) 

retrieve one angle from the ReplyString

Parameters:
angle reference to write the extracted angle to
Returns:
0 if successful, some error code otherwise

Definition at line 210 of file VCC4.C.

References OModelParam< T >::getVal(), hexStringToInt(), itsPulseRatio, and ReplyString.

Referenced by CameraInitialize().

int VCC4::getPosition ( float &  pan,
float &  tilt,
bool  wait = true 
)

retrieve the current position

Parameters:
pan panning angle (in degrees)
tilt tilting angle (in degrees)
wait wait for the command to successfully complete if true
Returns:
0 if successful, some error code otherwise

Definition at line 172 of file VCC4.C.

References getTwoAngles(), and PlainCommand().

Referenced by gotoPosition().

float VCC4::getPulseRatio ( void   )  [inline]

returns the pulse ratio for the pan and tilt mechanism

Definition at line 235 of file VCC4.H.

References OModelParam< T >::getVal(), and itsPulseRatio.

int VCC4::getReply ( void   )  [protected]

attempt to retrieve a reply

Definition at line 376 of file VCC4.C.

References itsPort, and ReplyString.

Referenced by SendRawCommand().

int VCC4::getTwoAngles ( float &  angle1,
float &  angle2 
)

retrieve two angle values from ReplyString

Parameters:
angle1 
angle2 references to write the extracted angles to (in degrees)
Returns:
0 if successful, some error code otherwise

Definition at line 222 of file VCC4.C.

References OModelParam< T >::getVal(), hexStringToInt(), itsPulseRatio, and ReplyString.

Referenced by getPosition(), and gotoPosition().

int VCC4::getUnitNo ( void   )  [inline]

get the unit number

Definition at line 216 of file VCC4.H.

References OModelParam< T >::getVal(), and itsUnitNo.

int VCC4::gotoPosition ( float  pan,
float  tilt,
bool  wait = true 
)

go to the specified position

Parameters:
pan panning angle (in degrees)
tilt tilting angle (in degrees)
wait wait for the command to successfully complete if true
Returns:
0 if successful, some error code otherwise

Definition at line 128 of file VCC4.C.

References AngleCommand(), getPosition(), getTwoAngles(), max(), min(), and PlainCommand().

int VCC4::hexStringToInt ( char *  buf,
unsigned int  length 
) [protected]

transforms a string of hex digits into an int

Definition at line 299 of file VCC4.C.

Referenced by getAbsNum(), getOneAngle(), and getTwoAngles().

int VCC4::intToHexString ( unsigned int  value,
char *  buf,
unsigned int  length 
) [protected]

transforms an unsigned int to a string of hex digits

Definition at line 280 of file VCC4.C.

Referenced by AbsNumCommand(), and AngleCommand().

bool VCC4::IsMoving ( void   )  [inline]

is the pedestal moving?

Definition at line 222 of file VCC4.H.

References PlainCommand().

int VCC4::PlainCommand ( int  cmdno,
bool  wait = true 
)

send a command that does not need parameters

Parameters:
cmdno for command numbers see VCC4cmddef.H
wait wait for successful completion if true
Returns:
0 if successful, some error code otherwise

Definition at line 182 of file VCC4.C.

References getIndex(), SendRawCommand(), and WaitRawCommand().

Referenced by CameraInitialize(), getPosition(), gotoPosition(), IsMoving(), and stop1().

int VCC4::SendRawCommand ( int  cmdno,
char *  param = NULL 
) [protected]

send a command with parameters to the device

Definition at line 331 of file VCC4.C.

References getIndex(), getReply(), OModelParam< T >::getVal(), itsPort, and itsUnitNo.

Referenced by AbsNumCommand(), AngleCommand(), PlainCommand(), StringCommand(), and WaitRawCommand().

int VCC4::setUnitNo ( int  unum  )  [inline]

set the unit number

Definition at line 208 of file VCC4.H.

References itsUnitNo, and OModelParam< T >::setVal().

void VCC4::start1 (  )  [protected, virtual]

get started (see ModelComponent.H). The serial port gets configured.

Reimplemented from ModelComponent.

Definition at line 66 of file VCC4.C.

References OModelParam< T >::getVal(), itsPort, and itsSerialDevice.

void VCC4::stop1 (  )  [protected, virtual]

get stopped (see ModelComponent.H). We return the unit to home position

Reimplemented from ModelComponent.

Definition at line 73 of file VCC4.C.

References PlainCommand().

int VCC4::StringCommand ( int  cmdno,
char *  string,
bool  wait = true 
)

send a command that needs a string as a parameter

Parameters:
cmdno for command numbers see VCC4cmddef.H
string the string value to set
wait wait for successful completion if true
Returns:
0 if successful, some error code otherwise

Definition at line 262 of file VCC4.C.

References getIndex(), SendRawCommand(), and WaitRawCommand().

int VCC4::WaitRawCommand ( int  cmdno,
char *  param = NULL 
) [protected]

send command and keep trying if busy

Definition at line 315 of file VCC4.C.

References SendRawCommand().

Referenced by AbsNumCommand(), AngleCommand(), PlainCommand(), and StringCommand().


Member Data Documentation

OModelParam<float> VCC4::itsMaxAngle [protected]

our max angle

Definition at line 172 of file VCC4.H.

Referenced by AngleCommand(), and CameraInitialize().

our serial port

Definition at line 168 of file VCC4.H.

Referenced by getReply(), SendRawCommand(), start1(), and VCC4().

OModelParam<float> VCC4::itsPulseRatio [protected]

our pulse ratio

Definition at line 171 of file VCC4.H.

Referenced by AngleCommand(), CameraInitialize(), getOneAngle(), getPulseRatio(), and getTwoAngles().

our serial device

Definition at line 169 of file VCC4.H.

Referenced by start1().

OModelParam<int> VCC4::itsUnitNo [protected]

our unit number

Definition at line 170 of file VCC4.H.

Referenced by getUnitNo(), SendRawCommand(), and setUnitNo().

reply string from last command (i.e. status reports and other replies)

Definition at line 165 of file VCC4.H.

Referenced by getAbsNum(), getOneAngle(), getReply(), and getTwoAngles().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:26:30 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3