AURobotServers  4
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
UImgClientTest Class Reference

#include <uimgpushtest.h>

Inheritance diagram for UImgClientTest:
Inheritance graph

Public Member Functions

bool blockSend (const char *buffer, int length)
 
bool sendBarcodeExecute (int sourceImage, bool findCode, bool extraImages, bool nearGMK, bool findPosition, bool findRotation, bool findChartPosition, bool clearOldData, bool findCameraParameters, int frameSize, float blockSize, int codeBlockFactor, int maxCodesToLookFor, float chartHeight, unsigned char specificCodeLng, int specificCode[])
 
bool sendCameraCalibrateRequest (bool analyzeImage, int imageSource, bool clearAllData, bool clearSpecificData, float blockSize, bool findCameraParams, bool alsoFocalLength, bool alsoK1, bool alsoK2, unsigned long setsToUse, bool extraImages)
 
bool sendCameraClose ()
 
bool sendCameraInfoRequest (bool allCams)
 
bool sendCameraMaster ()
 
bool sendCameraParameterRequest ()
 
bool sendGetImage (int sourceNum, unsigned int device, bool tryPacked, int line=-1, int format=-1)
 
bool sendImageCaptureRequest (bool removeRadialError, int imageFormat)
 
bool sendImageMetaRequest (int sourceNum)
 
bool sendNewCameraParameters (const float radialK1, const float radialK2, const float focalLength, const float headX, const float headY)
 
bool sendNewCameraSettings (int dev, int w, int h, int fps, long imNum, bool repeatNewImages, bool newPosition, UPosition newPos, bool newRotation, URotation newRot, bool ensureOpen)
 
bool sendNewCameraSettings2 (UComCam *cs)
 
bool sendPantiltInfoRequest ()
 
bool sendPantiltPosRequest (bool reset, bool relative, int pan, int tilt)
 
bool sendTimeRequest ()
 
 UImgClientTest ()
 
virtual ~UImgClientTest ()
 
- Public Member Functions inherited from USockClient
bool blockSend (const char *buffer, int length)
 
void closeConnection ()
 
virtual void connectionLost ()
 
bool doDisconnect ()
 
bool getDataFromLine (int pollTimeoutMs)
 
char * getHost ()
 
int getPort ()
 
void handleConnection (bool terminateOnDisconnect=false)
 
bool isConnected ()
 
virtual void pollTimeout ()
 
int setHost (const char *iHost)
 
int setPort (int iPort)
 
virtual void transmissionTraffic (bool traffic)
 
bool tryConnect (bool andStartReceiveThread=true)
 
 USockClient ()
 
virtual ~USockClient ()
 

Public Attributes

UComCam ccam
 
bool dataBuffersCreated
 
int formatMajor
 
int formatMinor
 
int imagesReceived
 
URawImage * rawImage
 
UTime recvTime
 
int reqMessageSerial
 
bool reqOutstanding
 
UTime reqTime
 
UImage640rgbImage
 
UTime startTime
 
UTime startTimeClient
 
UTime timeServ
 
int tryColorFormat
 
bool verboseMessages
 

Protected Member Functions

virtual void cameraDataUpdated (int device)
 
bool decodeBarcodeCode (unsigned char *msg)
 
bool decodeCameraInfoMsg (unsigned char *msg)
 
bool decodeCameraInfoMsg2 (unsigned char *msg)
 
bool decodeCameraParamMsg (unsigned char *msg)
 
bool decodeDone (unsigned char *msg)
 
bool decodeImageData (unsigned char *msg)
 
bool decodeImageMetaData (unsigned char *msg)
 
int decodeMessages ()
 
bool decodePantiltPosition (unsigned char *msg)
 
bool decodeTimeMsg (unsigned char *msg)
 
virtual void imageMetaUpdated (int imageSlot)
 
virtual void imageUpdated (unsigned int serial, int source, int row, bool isBW)
 
void processMessage (unsigned char *data, int length)
 
virtual void sInfo (const char *message, int type)
 
virtual void timeUpdated ()
 

Protected Attributes

unsigned char message [MAX_MESSAGE_LENGTH_FROM_CAM *2]
 
int messageCnt
 
bool receiving
 
int selectedDeviceNumber
 
int serial
 
- Protected Attributes inherited from USockClient
char host [MAX_HOST_LENGTH]
 
int pollTimeoutMs
 
int port
 
unsigned int readCnt
 

Detailed Description

Image client function

Constructor & Destructor Documentation

UImgClientTest::UImgClientTest ( )

Constructor

virtual UImgClientTest::~UImgClientTest ( )
virtual

Member Function Documentation

bool UImgClientTest::blockSend ( const char *  buffer,
int  length 
)

Send message block, but first log, what is transmitted.

virtual void UImgClientTest::cameraDataUpdated ( int  device)
protectedvirtual

Called, when camera information is updated

bool UImgClientTest::decodeBarcodeCode ( unsigned char *  msg)
protected

Decode message with barcode code. Returns true if decoded OK.

bool UImgClientTest::decodeCameraInfoMsg ( unsigned char *  msg)
protected

Decode message with camera info - like image size and device name. Returns true if no errors were found.

bool UImgClientTest::decodeCameraInfoMsg2 ( unsigned char *  msg)
protected

Full camera device state message (replaces first version) Returns true if no errors were found.

bool UImgClientTest::decodeCameraParamMsg ( unsigned char *  msg)
protected

Decode message with camera parameters - like focus length and radial error parameters. Returns true if no errors were found.

bool UImgClientTest::decodeDone ( unsigned char *  msg)
protected

Decode done message, that are the default message, if no other data are returned. This message may include a string. if so, then this is logged. Returns true.

bool UImgClientTest::decodeImageData ( unsigned char *  msg)
protected

Decode message with image pixel data (packed or unpacked) returns true if no format error were found. The full message consist of several messages of this type. The last message is marked, and could trigger further action.

bool UImgClientTest::decodeImageMetaData ( unsigned char *  msg)
protected

Decode received image meta data

int UImgClientTest::decodeMessages ( )
protected

Decode a received message. Returns number of bytes used.

bool UImgClientTest::decodePantiltPosition ( unsigned char *  msg)
protected

Decode message with pan-tilt support and position info. Returns true if message is valid

bool UImgClientTest::decodeTimeMsg ( unsigned char *  msg)
protected

Decode this time message

virtual void UImgClientTest::imageMetaUpdated ( int  imageSlot)
protectedvirtual

Called when image meta data is updated

virtual void UImgClientTest::imageUpdated ( unsigned int  serial,
int  source,
int  row,
bool  isBW 
)
protectedvirtual

Called when image is updated. if only one row, then row specified. if full image, then row is -1. If 'isBW' is true, then only Y channel is used (U,V is 128).

void UImgClientTest::processMessage ( unsigned char *  data,
int  length 
)
protectedvirtual

Called by receive thread every time some bytes have been received. There is no garantee that data is separated at a message boundary.

Reimplemented from USockClient.

bool UImgClientTest::sendBarcodeExecute ( int  sourceImage,
bool  findCode,
bool  extraImages,
bool  nearGMK,
bool  findPosition,
bool  findRotation,
bool  findChartPosition,
bool  clearOldData,
bool  findCameraParameters,
int  frameSize,
float  blockSize,
int  codeBlockFactor,
int  maxCodesToLookFor,
float  chartHeight,
unsigned char  specificCodeLng,
int  specificCode[] 
)

Send request for analyzing current image for barcode data. Barcode frame size must be (frameSize), and each block is a 'blockSize' cm square. booleand flag indicates different calculation and debugging options. Returns true if send.

bool UImgClientTest::sendCameraCalibrateRequest ( bool  analyzeImage,
int  imageSource,
bool  clearAllData,
bool  clearSpecificData,
float  blockSize,
bool  findCameraParams,
bool  alsoFocalLength,
bool  alsoK1,
bool  alsoK2,
unsigned long  setsToUse,
bool  extraImages 
)

Send camera calibration request for estimation of radial error parameters

bool UImgClientTest::sendCameraClose ( )

Send request to close device. Returns true if send.

bool UImgClientTest::sendCameraInfoRequest ( bool  allCams)

Request camera information - such as device number, frame speed, device name and frame size. Returns true if send.

bool UImgClientTest::sendCameraMaster ( )

Send request to be master for controlling this camera

bool UImgClientTest::sendCameraParameterRequest ( )

Request camara parameter info, such as focus length, radial error parameters and head point. Returns true if send.

bool UImgClientTest::sendGetImage ( int  sourceNum,
unsigned int  device,
bool  tryPacked,
int  line = -1,
int  format = -1 
)

Request image, either packed or unpacked. Source number is image source at camera server. Destination is saved until image is retrived. If line number != -1, then just the specified line is send. If format (color) is -1 then the default format is used as set by tryColorFormat parameter. Format can be 1 = YUV, 2 = RGB or 3 = BW. Returns true if send.

bool UImgClientTest::sendImageCaptureRequest ( bool  removeRadialError,
int  imageFormat 
)

Send request to capture a new image, with or without radial error removed. Returns true if send.

bool UImgClientTest::sendImageMetaRequest ( int  sourceNum)

Request a image metadata to be taken with default camera parameters. NB! actual image is not send, but will have to be requested separately.

bool UImgClientTest::sendNewCameraParameters ( const float  radialK1,
const float  radialK2,
const float  focalLength,
const float  headX,
const float  headY 
)

Send specific camera settings. Radial error parameters K1 must be larger than 1e-12 and parameter K2 must be larger than 1e-15. Focus length with 2 decomals in pixels. headX center point in pixels. headY center point in pixels.

bool UImgClientTest::sendNewCameraSettings ( int  dev,
int  w,
int  h,
int  fps,
long  imNum,
bool  repeatNewImages,
bool  newPosition,
UPosition  newPos,
bool  newRotation,
URotation  newRot,
bool  ensureOpen 
)

Request that camera settings are changed to this device ('/dev/videoX' with X = 0..5), Width (w) and height (h) normally from 160x120 to 640x480. (0,0) means no change.
Frames per seconf (fps) normally 5, 10, 15 or 30.
fps = -1 (0xff) means no change.
Image number is camera serial number will be set to this number.
Relative camera position on robot is used when reporting estimated single camera positions of e.g. barchart position. The position is set if 'newPosition' is true.
The rotation is set if 'newRotation' is true.
imNum = -1 means no change.
Returns true if send.

bool UImgClientTest::sendNewCameraSettings2 ( UComCam cs)

Request new camera settings, as defined in UComCam structure. Returns true if send.

bool UImgClientTest::sendPantiltInfoRequest ( )

Send request for pan-tilt position and range for this camera

bool UImgClientTest::sendPantiltPosRequest ( bool  reset,
bool  relative,
int  pan,
int  tilt 
)

Request a pan-tilt camera to move to a desired position

bool UImgClientTest::sendTimeRequest ( )

Request camera time

virtual void UImgClientTest::sInfo ( const char *  message,
int  type 
)
protectedvirtual

Called when something is to be displayed or logged. if not handled by virtual function, then messages are just printed to console.

Reimplemented from USockClient.

virtual void UImgClientTest::timeUpdated ( )
inlineprotectedvirtual

Barcode data updated Version or server time updated

Member Data Documentation

UComCam UImgClientTest::ccam
bool UImgClientTest::dataBuffersCreated
int UImgClientTest::formatMajor

server version major (set on connect)

int UImgClientTest::formatMinor

server version major (set on connect)

int UImgClientTest::imagesReceived

Image count

unsigned char UImgClientTest::message[MAX_MESSAGE_LENGTH_FROM_CAM *2]
protected

buffer for incomplete messages plus new full buffer of data

int UImgClientTest::messageCnt
protected

bytes in buffer

URawImage* UImgClientTest::rawImage
bool UImgClientTest::receiving
protected
UTime UImgClientTest::recvTime

Timing test - time for received and unpacked

int UImgClientTest::reqMessageSerial
bool UImgClientTest::reqOutstanding

requested image data

UTime UImgClientTest::reqTime
UImage640* UImgClientTest::rgbImage
int UImgClientTest::selectedDeviceNumber
protected

Current device number for info-messages etc. i.e. when a message is send or received without explicit device number.

int UImgClientTest::serial
protected

message serial number

UTime UImgClientTest::startTime

Timing test - time start of test

UTime UImgClientTest::startTimeClient

Timing test sime of reception of first image meta

UTime UImgClientTest::timeServ

Received parameters server time (set when requested only)

int UImgClientTest::tryColorFormat

This is ...

bool UImgClientTest::verboseMessages

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