AURobotServers
4
|
#include <ulms500.h>
Public Member Functions | |
virtual bool | changeMode (int scanangle, double resolution) |
virtual bool | getNewestData (ULaserData *dest, unsigned long lastSerial, int fake) |
virtual bool | isLms500 () |
virtual bool | isPortOpen () |
ULms500 () | |
~ULms500 () | |
Public Member Functions inherited from ULaserDevice | |
virtual void | callGotNewDataWithObject () |
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 () |
int | getScanAngle () |
double | getScanAngle (int measurement) |
double | getScanResolution () |
unsigned long | getSerial () |
void | gotNewScan (ULaserData *gotData) |
virtual bool | isLogFileOpen () |
virtual bool | isReplayDevice () |
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) |
UServerPushImplement * | getImplementor () |
int | getPushCmdCnt (int *cmdCnt, int *callCnt) |
UServerPushQueue * | getPushQueue () |
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 Member Functions | |
virtual void | closePort () |
bool | configLMS5xx (int frq, float res, double scanangle) |
char * | decodeData (char *msg, UTime rxTime, int dataCnt) |
Decode message from laserscanner. Handles all received messagetypes, and stores result as appropriate. More... | |
bool | decodeName (char *msg) |
bool | getDataTo (char *msg, ULaserData *dest) |
virtual double | getDefaultDelay () |
virtual const char * | getNameFromDevice () |
virtual bool | openPort () |
virtual bool | receiveData () |
virtual bool | sendToDevice (const char *msg, int lng) |
bool | setAllEchos () |
bool | setDataFrqAndRes (int frq, float res) |
bool | setDataOutput () |
bool | setDataOutputRange (double angle) |
void | toLog (const char *data, int length, const char *pre) |
Protected Member Functions inherited from ULaserDevice | |
void | getFakeScan (ULaserData *dest, unsigned long lastSerial, int fake, double fakeDt=0.2) |
void | updateScanData (UTime scanTime) |
Protected Member Functions inherited from UClientPort | |
virtual void | connectionChange (bool nowConnected) |
virtual void | sendNamespaceOpenTag () |
bool | blockSend (const char *buffer, int length) |
void | closeConnection () |
int | getDataFromLine (char *buffer, int bufferSize, int pollTimeoutMs) |
const char * | getHost () |
const char * | getHostIP () |
int | getPort () |
bool | isConnected () |
bool | isVerbose () |
bool | sendMsg (const char *message) |
bool | sendWithLock (const char *message) |
void | setHost (const char *toHost) |
void | setPort (int toPort) |
void | setVerbose (bool value) |
bool | tryConnect () |
UClientPort () | |
virtual | ~UClientPort () |
Protected Member Functions inherited from ULock | |
bool | lock () |
void | lockInit () |
void | post () |
bool | tryLock () |
bool | tryWait () |
ULock () | |
void | unlock () |
bool | wait () |
~ULock () | |
Static Protected Attributes | |
static const char | ETX = 3 |
static const char | STX = 2 |
Private Attributes | |
bool | finishedScan |
Additional Inherited Members | |
Protected Types inherited from UClientPort | |
enum | { notLost, forReopen, rxError, txError } |
Interface to LMS500 laser scanner
ULms500::ULms500 | ( | ) |
Constructor
References ULaserDevice::angleResolution, dataBuf, dataCnt, finishedScan, lasData, laslog, MAX_NAME_LNG, ULaserDevice::maxValidRange, ULaserDevice::modeAngleScan, ULaserDevice::name, ULogFile::openLog(), and ULaserDevice::setDeviceName().
ULms500::~ULms500 | ( | ) |
Destructor
References ULogFile::closeLog(), closePort(), finishedScan, UClientPort::isConnected(), ULogFile::isOpen(), laslog, and ULaserDevice::stop().
|
virtual |
Change scanner resolution mode. Returns true if new resolution is set
Reimplemented from ULaserDevice.
References ULaserDevice::angleResolution, configLMS5xx(), mini(), and ULaserDevice::modeAngleScan.
|
protectedvirtual |
Close serial port
Reimplemented from ULaserDevice.
References UClientPort::closeConnection(), ULock::lock(), toLog(), and ULock::unlock().
Referenced by isLms500(), and ~ULms500().
|
protected |
configure data settings for LMS 500 series
frq | is update frequency 25, 33, 50, 75, 100 |
res | is resolution 0.1667, 0.25, 0.333, 0.5, 0.667, 1.0 |
scanangle | is scanangle 180 deg is from -90 to +90 |
References sendToDevice(), setAllEchos(), setDataFrqAndRes(), setDataOutput(), and setDataOutputRange().
Referenced by changeMode(), getDefaultDelay(), and openPort().
|
protected |
Decode message from laserscanner. Handles all received messagetypes, and stores result as appropriate.
msg | is a 0 terminated string (but may have binary parts). Intial STX and terminating ETX is removed. |
rxTime | is time-stamp just after start of receive |
dataCnt | is number of characters in buffer |
References dataRxTime, dataTime, ULaserDevice::deviceNum, ETX, finishedScan, getDataTo(), ULaserDevice::gotNewScan(), lasData, laslog, ULock::lock(), ULaserDevice::maxValidRange, ULaserDevice::mirrorData, UTime::Now(), ULaserDevice::serial, ULaserData::setDeviceNum(), ULaserData::setMaxValidRange(), ULaserData::setMirror(), ULaserData::setScanTime(), ULaserData::setSerial(), ULaserData::setUnit(), ULaserData::setValid(), ULaserDevice::statGoodCnt, ULogFile::toLog(), ULock::unlock(), and ULaserDevice::var.
Referenced by isLms500(), and receiveData().
|
protected |
Decode name message
References MAX_DEVICE_NAME_LNG, and ULaserDevice::name.
Referenced by isLms500().
|
protected |
Decode this 'msg' data to the 'dest' structure.
References ULaserData::addMeasurements(), ULaserDevice::getMirror(), and ULaserData::setMeasurement().
Referenced by decodeData(), and isLms500().
|
inlineprotectedvirtual |
Get default delay estimate for the device type
Reimplemented from ULaserDevice.
References configLMS5xx(), setAllEchos(), setDataFrqAndRes(), setDataOutput(), and setDataOutputRange().
|
protectedvirtual |
Get name of device
Reimplemented from ULaserDevice.
References ULaserDevice::getName().
Referenced by isLms500().
|
virtual |
Get the newest data unpacked to this structure. Returns true if valid.
Reimplemented from ULaserDevice.
References ULaserData::copy(), ULaserDevice::datalogUsedScans, ULaserDevice::deviceNum, ULaserDevice::getFakeScan(), ULaserData::getSerial(), isPortOpen(), ULaserData::isValid(), lasData, ULock::lock(), ULaserDevice::logThisScan(), ULaserData::setDeviceNum(), ULaserData::setValid(), ULaserDevice::start(), and ULock::unlock().
|
inlinevirtual |
Is laserscanner a LMS500 scanner
References closePort(), data, dataCnt, decodeData(), decodeName(), getDataTo(), getNameFromDevice(), openPort(), receiveData(), sendToDevice(), and toLog().
|
virtual |
Is the port to the device open
Reimplemented from ULaserDevice.
References UClientPort::isConnected().
Referenced by getNewestData(), and receiveData().
|
protectedvirtual |
Open serial post. Return true if open(ed)
Reimplemented from ULaserDevice.
References configLMS5xx(), ULaserDevice::devName, finishedScan, UClientPort::setHost(), UClientPort::setPort(), toLog(), UClientPort::tryConnect(), and Wait().
Referenced by isLms500().
|
protectedvirtual |
Receive data from device – called from device loop, should return as fast as possible after doing the job, i.e. no blocking read. Should add number of good and bad blocks of data to statBadCnt and statGootcnt. Returns true if data received.
Reimplemented from ULaserDevice.
References dataBuf, dataCnt, dataRxTime, dataTime, decodeData(), ETX, finishedScan, UClientPort::getDataFromLine(), UTime::getTimePassed(), isPortOpen(), laslog, ULock::lock(), MAX_LMS500_LNG, UTime::now(), sendToDevice(), ULaserDevice::statBadCnt, STX, ULogFile::toLog(), and ULock::unlock().
Referenced by isLms500().
|
protectedvirtual |
Send data to device. Sends 'lng' bytes from 'msg'. Data must be a zero-terminated string.
Reimplemented from ULaserDevice.
References UClientPort::blockSend(), ETX, ULaserDevice::name, STX, and toLog().
Referenced by configLMS5xx(), isLms500(), receiveData(), setAllEchos(), setDataFrqAndRes(), setDataOutput(), and setDataOutputRange().
|
protected |
set all data (up to 5 echos per pulse) (after login) true if send
References sendToDevice().
Referenced by configLMS5xx(), and getDefaultDelay().
|
protected |
Set data rate and resolution (after login)
frq | is update frequency 25, 33, 50, 75, 100 |
res | is resolution 0.1667, 0.25, 0.333, 0.5, 0.667, 1.0 |
References sendToDevice().
Referenced by configLMS5xx(), and getDefaultDelay().
|
protected |
Set output type - e.g. remission (after login)
References sendToDevice().
Referenced by configLMS5xx(), and getDefaultDelay().
|
protected |
Set output scan angle
angle | is angle width 180 is from -90 to +90 degrees |
References roundi(), and sendToDevice().
Referenced by configLMS5xx(), and getDefaultDelay().
|
protected |
Send data to log, replacing whitespace with '<'
References data, ULogFile::isOpen(), laslog, MAX_LMS500_LNG, and ULogFile::toLog().
Referenced by closePort(), isLms500(), openPort(), and sendToDevice().
|
protected |
Data buffer for received data
Referenced by receiveData(), and ULms500().
|
protected |
Number of unused characters in buffer
Referenced by isLms500(), receiveData(), and ULms500().
|
protected |
Time stamp of received data. Time stamp is taken, when first data is received (first chunk of data)
Referenced by decodeData(), and receiveData().
|
protected |
Time of last received data
Referenced by decodeData(), and receiveData().
|
staticprotected |
Referenced by decodeData(), receiveData(), and sendToDevice().
|
private |
Referenced by decodeData(), openPort(), receiveData(), ULms500(), and ~ULms500().
|
protected |
Decoded range data
Referenced by decodeData(), getNewestData(), and ULms500().
|
protected |
Log file
Referenced by decodeData(), receiveData(), toLog(), ULms500(), and ~ULms500().
|
staticprotected |
Referenced by receiveData(), and sendToDevice().