interface with the pan-tilt mechanism of a Canon VC-C4 camera More...
#include <Devices/VCC4.H>
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< Serial > | itsPort |
our serial port | |
OModelParam< std::string > | itsSerialDevice |
our serial device | |
OModelParam< int > | itsUnitNo |
our unit number | |
OModelParam< float > | itsPulseRatio |
our pulse ratio | |
OModelParam< float > | itsMaxAngle |
our max angle |
interface with the pan-tilt mechanism of a Canon VC-C4 camera
Definition at line 76 of file VCC4.H.
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.
int VCC4::AbsNumCommand | ( | int | cmdno, | |
unsigned int | value, | |||
bool | wait = true | |||
) |
send a command that needs an integer number as a parameter
cmdno | for command numbers see VCC4cmddef.H | |
value | the integer value to set | |
wait | wait for successful completion if true |
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
cmdno | for command numbers see VCC4cmddef.H | |
angle1 | ||
angle2 | the angles (in degrees) to set | |
wait | wait for successful completion if true |
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.
goHome | put camera into Home position if true |
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
the | length of the string representing the number |
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
angle | reference to write the extracted angle to |
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
pan | panning angle (in degrees) | |
tilt | tilting angle (in degrees) | |
wait | wait for the command to successfully complete if true |
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
angle1 | ||
angle2 | references to write the extracted angles to (in degrees) |
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
pan | panning angle (in degrees) | |
tilt | tilting angle (in degrees) | |
wait | wait for the command to successfully complete if true |
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] |
int VCC4::PlainCommand | ( | int | cmdno, | |
bool | wait = true | |||
) |
send a command that does not need parameters
cmdno | for command numbers see VCC4cmddef.H | |
wait | wait for successful completion if true |
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
cmdno | for command numbers see VCC4cmddef.H | |
string | the string value to set | |
wait | wait for successful completion if true |
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().
OModelParam<float> VCC4::itsMaxAngle [protected] |
our max angle
Definition at line 172 of file VCC4.H.
Referenced by AngleCommand(), and CameraInitialize().
nub::soft_ref<Serial> VCC4::itsPort [protected] |
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().
OModelParam<std::string> VCC4::itsSerialDevice [protected] |
OModelParam<int> VCC4::itsUnitNo [protected] |
our unit number
Definition at line 170 of file VCC4.H.
Referenced by getUnitNo(), SendRawCommand(), and setUnitNo().
char VCC4::ReplyString[30] |
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().