#include <ArVCC4.h>
Inheritance diagram for ArVCC4:
Public Types | |
enum | CameraType { CAMERA_VCC4, CAMERA_C50I } |
enum | CommState { COMM_UNKNOWN, COMM_BIDIRECTIONAL, COMM_UNIDIRECTIONAL } |
Public Member Functions | |
void | addErrorCB (ArFunctor *functor, ArListPos::Pos position) |
ArVCC4 (ArRobot *robot, bool inverted=false, CommState commDirection=COMM_UNKNOWN, bool autoUpdate=true, bool disableLED=false, CameraType cameraType=CAMERA_VCC4) | |
Constructor. | |
virtual bool | autoFocus (void) |
virtual bool | canGetRealPanTilt (void) const |
If this driver can tell the real pan/tilt angle. | |
virtual bool | canGetRealZoom (void) const |
If this driver can tell the real zoom. | |
virtual bool | canSetFocus (void) const |
If the driver can set the focus on the camera, or not. | |
virtual bool | canZoom (void) const |
Returns true if camera can zoom (or rather, if it is controlled by this). | |
virtual void | connectHandler (void) |
Internal, attached to robot, inits the camera when robot connects. | |
bool | digitalZoom (int deg) |
void | disableAutoUpdate (void) |
void | disableIRFilterMode (void) |
Disable IR cutoff filter. This also turns off the LEDs, if they're on. | |
void | disableIRLEDs (void) |
Turn off IR LEDs. | |
void | enableAutoUpdate (void) |
Toggle the state of the auto-update. | |
void | enableIRFilterMode (void) |
Enable physical IR cutoff filter. | |
void | enableIRLEDs (void) |
Turn on IR LEDs. IR-filter must be in place for LEDs to turn on. | |
virtual bool | focusFar (void) |
auto-fovus on a far object | |
virtual bool | focusNear (void) |
auto-focus on a near object | |
bool | getAutoUpdate (void) |
int | getDigitalZoom (void) const |
bool | getIRFilterModeEnabled (void) |
Returns true if the IR cutoff filter is in place. | |
bool | getIRLEDsEnabled (void) |
Returns true if the IR LEDs are on. | |
virtual int | getMaxNegPan (void) const |
Gets the lowest negative degree the camera can pan to. | |
virtual int | getMaxNegTilt (void) const |
Gets the lowest negative degree the camera can tilt to. | |
int | getMaxPanSlew (void) |
Gets the maximum pan slew. | |
virtual int | getMaxPosPan (void) const |
Gets the highest positive degree the camera can pan to. | |
virtual int | getMaxPosTilt (void) const |
Gets the highest positive degree the camera can tilt to. | |
int | getMaxTiltSlew (void) |
Gets the maximum tilt slew. | |
virtual int | getMaxZoom (void) const |
Gets the maximum value for the zoom on this camera. | |
int | getMinPanSlew (void) |
Gets the minimum pan slew. | |
int | getMinTiltSlew (void) |
Gets the minimum tilt slew. | |
virtual int | getMinZoom (void) const |
Gets the lowest value for the zoom on this camera. | |
virtual int | getPan (void) const |
The angle the camera was last told to pan to. | |
int | getPanSlew (void) |
Gets the current pan slew. | |
bool | getPower (void) |
void | getRealPanTilt (void) |
void | getRealZoomPos (void) |
virtual int | getTilt (void) const |
The angle the camera was last told to tilt to. | |
int | getTiltSlew (void) |
Gets the current tilt slew. | |
virtual int | getZoom (void) const |
The value the camera was last told to zoom to. | |
bool | haltPanTilt (void) |
Halts all pan-tilt movement. | |
bool | haltZoom (void) |
Halts zoom movement. | |
virtual bool | init (void) |
Initializes the camera. | |
bool | isInitted (void) |
Returns true if the camera has been initialized. | |
virtual bool | packetHandler (ArBasePacket *packet) |
Handles a packet that was read from the device. | |
virtual bool | pan (int deg) |
Pans to the given degrees. | |
virtual bool | panRel (int deg) |
Pans relative to current position by given degrees. | |
bool | panSlew (int deg) |
Sets the rate that the unit pans at. | |
virtual bool | panTilt (int pdeg, int tdeg) |
Pans and tilts to the given degrees. | |
virtual bool | panTiltRel (int pdeg, int tdeg) |
Pans and tilts relatives to the current position by the given degrees. | |
virtual bool | power (bool state) |
void | preparePacket (ArVCC4Packet *packet) |
Adds device ID and delimeter to packet buffer. | |
void | remErrorCB (ArFunctor *functor) |
Remove an error callback from the callback list. | |
void | setLEDControlMode (int controlMode) |
virtual bool | tilt (int deg) |
Tilts to the given degrees. | |
virtual bool | tiltRel (int deg) |
Tilts relative to the current position by given degrees. | |
bool | tiltSlew (int deg) |
Sets the rate the unit tilts at. | |
bool | wasError (void) |
Returns true if the error callback list was called during the last cycle. | |
virtual bool | zoom (int deg) |
Zooms to the given value. | |
virtual | ~ArVCC4 () |
Destructor. | |
Protected Types | |
enum | Error { CAM_ERROR_NONE = 0x30, CAM_ERROR_BUSY = 0x31, CAM_ERROR_PARAM = 0x35, CAM_ERROR_MODE = 0x39, CAM_ERROR_UNKNOWN = 0xFF } |
enum | Param { MAX_PAN = 98, MIN_PAN = -98, MAX_TILT = 88, MIN_TILT = -30, MAX_PAN_SLEW = 90, MIN_PAN_SLEW = 1, MAX_TILT_SLEW = 69, MIN_TILT_SLEW = 1, MAX_ZOOM_OPTIC = 1960, MIN_ZOOM = 0 } |
enum | State { UNINITIALIZED, STATE_UNKNOWN, INITIALIZING, SETTING_CONTROL_MODE, SETTING_INIT_TILT_RATE, SETTING_INIT_PAN_RATE, SETTING_INIT_RANGE, POWERING_ON, POWERING_OFF, POWERED_OFF, POWERED_ON, AWAITING_INITIAL_POWERON, AWAITING_INITIAL_INIT, AWAITING_ZOOM_RESPONSE, AWAITING_PAN_TILT_RESPONSE, AWAITING_STOP_PAN_TILT_RESPONSE, AWAITING_STOP_ZOOM_RESPONSE, AWAITING_PAN_SLEW_RESPONSE, AWAITING_TILT_SLEW_RESPONSE, AWAITING_POS_REQUEST, AWAITING_ZOOM_REQUEST, AWAITING_LED_CONTROL_RESPONSE, AWAITING_IRLEDS_RESPONSE, AWAITING_IRFILTER_RESPONSE, AWAITING_PRODUCTNAME_REQUEST, AWAITING_DIGITAL_ZOOM_RESPONSE, AWAITING_FOCUS_RESPONSE, STATE_DELAYED_SWITCH, STATE_ERROR } |
Protected Member Functions | |
void | camTask (void) |
int | invert (int before) const |
void | processGetPanTiltResponse (void) |
void | processGetProductNameResponse (void) |
void | processGetZoomResponse (void) |
virtual ArBasePacket * | readPacket (void) |
Reads a packet from the device connection, MUST NOT BLOCK. | |
void | requestBytes (int num=6) |
bool | sendCameraNameRequest (void) |
bool | sendDigitalZoom (void) |
bool | sendFocus (void) |
bool | sendHaltPanTilt (void) |
bool | sendHaltZoom (void) |
bool | sendInit (void) |
bool | sendIRFilterControl (void) |
bool | sendIRLEDControl (void) |
bool | sendLEDControlMode (void) |
bool | sendPanSlew (void) |
bool | sendPanTilt (void) |
bool | sendPower (void) |
bool | sendProductNameRequest (void) |
bool | sendRealPanTiltRequest (void) |
bool | sendRealZoomRequest (void) |
bool | sendTiltSlew (void) |
bool | sendZoom (void) |
bool | setControlMode (void) |
bool | setDefaultRange (void) |
void | switchState (State state, int delayTime=0) |
void | throwError () |
bool | timeout (int mSec=0) |
Protected Attributes | |
bool | myAutoUpdate |
int | myAutoUpdateCycle |
int | myBytesLeft |
bool | myCameraHasBeenInitted |
bool | myCameraIsInitted |
CameraType | myCameraType |
CommState | myCommType |
ArDeviceConnection * | myConn |
bool | myDesiredIRFilterMode |
bool | myDesiredIRLEDsMode |
int | myDesiredLEDControlMode |
int | myDigitalZoom |
int | myDigitalZoomDesired |
unsigned int | myError |
std::list< ArFunctor * > | myErrorCBList |
int | myFocusMode |
int | myFocusModeDesired |
bool | myHaltPanTiltRequested |
bool | myHaltZoomRequested |
ArTime | myIdleTime |
bool | myInitRequested |
bool | myInverted |
bool | myIRFilterModeEnabled |
bool | myIRLEDsEnabled |
State | myNextState |
ArVCC4Packet | myPacket |
unsigned char | myPacketBuf [50] |
int | myPacketBufLen |
ArTime | myPacketTime |
int | myPacketTimeout |
int | myPan |
int | myPanDesired |
int | myPanResponse |
int | myPanSent |
int | myPanSlew |
int | myPanSlewDesired |
int | myPanSlewSent |
bool | myPowerState |
bool | myPowerStateDesired |
State | myPreviousState |
std::string | myProductName |
char | myProductNameResponse [4] |
bool | myRealPanTiltRequested |
bool | myRealZoomRequested |
bool | myRequestProductName |
bool | myResponseReceived |
ArRobot * | myRobot |
State | myState |
int | myStateDelayTime |
ArTime | myStateTime |
int | myStateTimeout |
ArFunctorC< ArVCC4 > | myTaskCB |
int | myTilt |
int | myTiltDesired |
int | myTiltResponse |
int | myTiltSent |
int | myTiltSlew |
int | myTiltSlewDesired |
int | myTiltSlewSent |
bool | myUsingAuxPort |
bool | myWaitingOnPacket |
bool | myWaitingOnStop |
bool | myWasError |
int | myZoom |
int | myZoomDesired |
int | myZoomResponse |
int | myZoomSent |
ArBasePacket * | newPacket |
Definition at line 132 of file ArVCC4.h.
|
|
|
Constructor.
Definition at line 114 of file ArVCC4.cpp. References ArRobot::addUserTask(), CAM_ERROR_NONE, getMaxPanSlew(), getMaxTiltSlew(), ArLog::log(), and ArTime::setToNow(). |
|
Adds an error callback to a list of callbacks to be called when there is a serious error in communicating - either the parameters were incorrect, the mode was incorrect, or there was an unknown error. Definition at line 1924 of file ArVCC4.cpp. References ArLog::log(). |
|
Set autofocus mode: 0 = Autofocus, 1 = manual focus |
|
adjust the optical zoom amount. Has four states, takes 0-3 for: 1x, 2x, 4x, 8x Definition at line 1770 of file ArVCC4.cpp. |
|
Requests that a packet be sent to the camera to retrieve what the camera thinks are its pan/tilt positions |
|
Requests that a packet be sent to the camera to retrieve what the camera thinks is its zoom position |
|
Handles a packet that was read from the device. This should work for the robot packet handler or for packets read in from readPacket (the joys of OO), but it can't deal with the need to check the id on robot packets, so you should check the id from robotPacketHandler and then call this one so that your stuff can be used by both robot and serial port connections.
Reimplemented from ArPTZ. Definition at line 1517 of file ArVCC4.cpp. References CAM_ERROR_BUSY, CAM_ERROR_MODE, CAM_ERROR_NONE, CAM_ERROR_PARAM, CAM_ERROR_UNKNOWN, ArLog::log(), and ArTime::setToNow(). |
|
Reads a packet from the device connection, MUST NOT BLOCK. This should read in a packet from the myConn connection and return a pointer to a packet if there was on to read in, or NULL if there wasn't one... this MUST not block if it is used with the default mode of being driven from the sensorInterpHandler, since that is on the robot loop.
Reimplemented from ArPTZ. Definition at line 1443 of file ArVCC4.cpp. References ArBasePacket::dataToBuf(), ArBasePacket::empty(), ArLog::log(), ArDeviceConnection::read(), and ArBasePacket::resetRead(). |
|
This controls the status of the LED. 0 - disable forced control 1 - green forced on 2 - all forced off 3 - red forced on 4 - orange forced on Definition at line 2235 of file ArVCC4.cpp. References ArBasePacket::empty(), ArLog::log(), preparePacket(), ArPTZ::sendPacket(), and ArBasePacket::uByteToBuf(). |
|
Set the control mode for the status LED on the front of the camera 0 = auto-control, 1 = Green ON, 2 = All OFF, 3 = Red ON, 4 = Orange ON |