AURobotServers  4
Public Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | List of all members
UReplayDevice Class Reference

#include <ureplaydevice.h>

Inheritance diagram for UReplayDevice:
Inheritance graph

Public Member Functions

virtual bool getNewestData (ULaserData *dest, unsigned long lastSerial, int fake)
 
bool getReplayFileExist ()
 
char * getReplayFileName (char *fn, const int fnCnt)
 
int getReplayLogLine ()
 
UTime getReplayTimeNext ()
 
UTime getReplayTimeNow ()
 
virtual bool isPortOpen ()
 
virtual bool isReplay ()
 
virtual bool isReplayDevice ()
 
bool isReplayFileOpen ()
 
double maxRange ()
 
bool replayStep (int steps, UResBase *lasPool)
 
bool replayStepToScan (unsigned int toSerial, UResBase *lasPool)
 
bool replayToTime (UTime untilTime)
 
bool setReplay (bool value)
 
 UReplayDevice ()
 
 ~UReplayDevice ()
 
- Public Member Functions inherited from ULaserDevice
virtual void callGotNewDataWithObject ()
 
virtual bool changeMode (int scanangle, double resolution)
 
virtual void createBaseVars ()
 
unsigned int getBad ()
 
char * getDeviceName ()
 
int getDeviceNum ()
 
UPosition getDevicePos ()
 
UPosRot getDevicePose ()
 
URotation getDeviceRot ()
 
unsigned int getGood ()
 
char * getLogFileName (char *buffer, int bufferCnt)
 
int getLogInterval ()
 
bool getLogUsedScans ()
 
int getMaxMeasurements ()
 
bool getMirror ()
 
double getMsgRate ()
 
char * getName ()
 
virtual const char * getNameFromDevice ()
 
int getScanAngle ()
 
double getScanAngle (int measurement)
 
double getScanResolution ()
 
unsigned long getSerial ()
 
void gotNewScan (ULaserData *gotData)
 
virtual bool isLogFileOpen ()
 
bool isRunning ()
 
bool isSend ()
 
virtual bool isVerbose ()
 
void logFileClose ()
 
bool logFileOpen ()
 
void logThisScan (ULaserData *scan)
 
void openRequest (bool toOpen)
 
void print (char *preString)
 
virtual const char * print (const char *preString, char *buff, int buffCnt)
 
void send (char *msg)
 
virtual void setCore (UCmdExe *pCore)
 
virtual void setDeviceName (const char *device)
 
void setDeviceNum (int value)
 
void setDevicePose (UPosRot *newPose)
 
void setLogInterval (int value)
 
void setLogUsedScans (bool value)
 
void setMirror (bool value)
 
void setVarStructure (UVarPool *varStruct)
 
void setVerbose (bool value)
 
bool start ()
 
void stop (bool justClosePort)
 
void threadRunLoop ()
 
 ULaserDevice ()
 
virtual ~ULaserDevice ()
 
- Public Member Functions inherited from UServerPush
int addPushCommand (UServerInMsg *msg)
 
bool doPushCall (UServerPushElement *pe, const char *value)
 
void flushClientCmds (int clientIdx)
 
UServerPushImplementgetImplementor ()
 
int getPushCmdCnt (int *cmdCnt, int *callCnt)
 
UServerPushQueuegetPushQueue ()
 
bool gotCmdExe ()
 
void gotNewData (void *pData)
 
bool isUpdated (int lastCnt, int *newCnt)
 
bool needNewData ()
 
void print (const char *preString)
 
void print (const char *preString, char *buff, int buffCnt)
 
void servicePendingPushCmds ()
 
void setCmdExe (UServerPushImplement *executor)
 
void setImplementor (UServerPushImplement *executor)
 
bool setResource (UResBase *resource, bool remove)
 
bool setUpdated (const char *value)
 Add watch object if needed. An image or other object is updated. set object as updated, with an extra qualifier, that may be used as a parameter in a push call. this push list is then added to the to the push list examined by the server thread. when server thread reach this push list it will call to get a possible associated data structure by a call to needNewData() whish is expected to call gotNewData(void * data_structure) - but now in the server thread. More...
 
 UServerPush ()
 
virtual ~UServerPush ()
 

Protected Attributes

bool replay
 
FILE * replayFile
 
char replayLine [MAX_LOG_LINE_LENGTH]
 
int replayLogLine
 
UTime replayTimeNext
 
UTime replayTimeNow
 
ULaserData scan
 
- Protected Attributes inherited from ULaserDevice
double angleResolution
 
ULogFile datalog
 
int datalogSeq
 
bool datalogUsedScans
 
int deviceNum
 
char devName [MAX_DEVICE_NAME_LNG]
 
UTime lastScanTime
 
int loopCnt
 
double maxValidRange
 
bool mirrorData
 
int modeAngleScan
 
char name [MAX_NAME_LNG]
 
ULaserDatapushData
 
bool replayOrFake
 
bool sendNewData
 
char sendStr [MAX_SEND_MSG_LNG]
 
int sendStrCnt
 
unsigned long serial
 
unsigned int statBadCnt
 
unsigned int statGoodCnt
 
double statMsgRate
 
pthread_t threadHandle
 
bool threadRunning
 
bool threadStop
 
struct {
   UVariable *   framerate
 
   UVariable *   logData
 
   UVariable *   logDataInterval
 
   UVariable *   logSource
 
   UVariable *   maxRange
 
   UVariable *   name
 
   UVariable *   open
 
   UVariable *   pose
 
   UVariable *   scanDelay
 
   UVariable *   scanres
 
   UVariable *   scanwidth
 
   UVariable *   serial
 
   UVariable *   type
 
   UVariable *   versionInfo
 
var
 
UVarPoolvars
 
bool verbose
 

Static Protected Attributes

static const int MAX_LOG_LINE_LENGTH = 10000
 

Private Member Functions

bool replayStep ()
 

Additional Inherited Members

- Protected Member Functions inherited from ULaserDevice
virtual void closePort ()
 
virtual double getDefaultDelay ()
 
void getFakeScan (ULaserData *dest, unsigned long lastSerial, int fake, double fakeDt=0.2)
 
virtual bool openPort ()
 
virtual bool receiveData ()
 
virtual bool sendToDevice (const char *msg, int lng)
 
void updateScanData (UTime scanTime)
 

Detailed Description

Laser scanner device that gets the data from a logfile

    @author Christian Andersen <jca@oersted.dtu.dk>

Constructor & Destructor Documentation

UReplayDevice::UReplayDevice ( )
UReplayDevice::~UReplayDevice ( )

destructor

Member Function Documentation

bool UReplayDevice::getNewestData ( ULaserData dest,
unsigned long  lastSerial,
int  fake 
)
virtual

Get the newest data unpacked to this structure. Returns true if valid.

Reimplemented from ULaserDevice.

References ULaserData::copy(), ULaserDevice::getFakeScan(), ULaserData::getSerial(), ULock::lock(), scan, ULaserData::setValid(), and ULock::unlock().

Referenced by isPortOpen().

bool UReplayDevice::getReplayFileExist ( )

Test if replay file with current specifications exist (and read is allowed)

References getReplayFileName().

Referenced by getReplayLogLine(), and UFunctionLaser::handleSetCommand().

char * UReplayDevice::getReplayFileName ( char *  fn,
const int  fnCnt 
)

Get the full replay logfile name. Returns pointer fn[] string.

References ULaserDevice::devName, and replayPath.

Referenced by getReplayFileExist(), getReplayLogLine(), UFunctionLaser::handleSetCommand(), and setReplay().

int UReplayDevice::getReplayLogLine ( )
inline
UTime UReplayDevice::getReplayTimeNext ( )
inline

Get replat time next

References replayTimeNext.

Referenced by UFunctionLaser::handleSetCommand(), and replayStep().

UTime UReplayDevice::getReplayTimeNow ( )
inline

Set replay subdir. Sets the value to the subdir buffer, but nothing else is changed. Get pointer to replay subdir Get replat time now

References replayTimeNow.

Referenced by UFunctionLaser::handleSetCommand().

virtual bool UReplayDevice::isPortOpen ( )
inlinevirtual

Change scanner resolution mode. Returns true if new resolution is set Is the port to the device open

Reimplemented from ULaserDevice.

References getNewestData().

virtual bool UReplayDevice::isReplay ( )
inlinevirtual

Get replay flag

References replay.

virtual bool UReplayDevice::isReplayDevice ( )
inlinevirtual

Is laserscanner a replay device scanner

Reimplemented from ULaserDevice.

References maxRange(), and setReplay().

Referenced by UFunctionLaser::handleSetCommand().

bool UReplayDevice::isReplayFileOpen ( )
inline

is replay file open

References replayFile.

Referenced by UFunctionLaser::handleSetCommand().

double UReplayDevice::maxRange ( )

Print device status to a buffer string Device name determines max range for device. Decode the range from the name.

Referenced by isReplayDevice().

bool UReplayDevice::replayStep ( int  steps,
UResBase lasPool 
)

Replay N singles from the logfile.

Parameters
stepsnumber of steps to advance
lasPoolis pointer to laser pool - to notify other replay partners. true if N steps were available in replay file.

References UReplay::replayAdvanceTime(), replayStep(), and replayTimeNow.

Referenced by UFunctionLaser::handleSetCommand().

bool UReplayDevice::replayStep ( )
private
bool UReplayDevice::replayStepToScan ( unsigned int  toSerial,
UResBase lasPool 
)

Advance replay to this scannumber

Parameters
toSerialis the scan serial to advance to
lasPoolis pointer to laser pool - to notify other replay partners. true if scan is found.

References ULaserData::getSerial(), UReplay::replayAdvanceTime(), replayStep(), replayTimeNow, and scan.

Referenced by getReplayLogLine(), and UFunctionLaser::handleSetCommand().

bool UReplayDevice::replayToTime ( UTime  untilTime)

Replay until just before this time

References replayStep(), and replayTimeNext.

Referenced by getReplayLogLine(), and ULaserPool::replayToTime().

bool UReplayDevice::setReplay ( bool  value)

Set replay flag. If replay flag is changed to true, the logfile (odo.log) is attempted opened. If successfull, the current pose history is cleared and the first record read and implemented. If not successfull, the replay flag is set to true, and the pose history is cleared only. Returns true if replay file is opened

References getReplayFileName(), MAX_LOG_LINE_LENGTH, replay, replayFile, replayLine, replayLogLine, replayTimeNext, UTime::setTimeTod(), and UTime::valid.

Referenced by UFunctionLaser::handleSetCommand(), isReplayDevice(), and replayStep().

Member Data Documentation

const int UReplayDevice::MAX_LOG_LINE_LENGTH = 10000
staticprotected

Maximum length of a line in the logfile

Referenced by replayStep(), and setReplay().

bool UReplayDevice::replay
protected

Replay flag - source of info for pose history a change in this flag clears the current pose history.

Referenced by isReplay(), replayStep(), setReplay(), and UReplayDevice().

FILE* UReplayDevice::replayFile
protected

Replay file handle

Referenced by isReplayFileOpen(), replayStep(), setReplay(), and UReplayDevice().

char UReplayDevice::replayLine[MAX_LOG_LINE_LENGTH]
protected

Buffer for latest line (but not used) line from logfile

Referenced by replayStep(), setReplay(), and UReplayDevice().

int UReplayDevice::replayLogLine
protected

Current line number in logfile

Referenced by getReplayLogLine(), replayStep(), setReplay(), and UReplayDevice().

UTime UReplayDevice::replayTimeNext
protected

Replay time of next data from in logfile (line buffer)

Referenced by getReplayTimeNext(), replayStep(), replayToTime(), and setReplay().

UTime UReplayDevice::replayTimeNow
protected

Replay time of last used data from logfile

Referenced by getReplayTimeNow(), replayStep(), and replayStepToScan().

ULaserData UReplayDevice::scan
protected

Buffer for laser data

Referenced by getNewestData(), replayStep(), and replayStepToScan().


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