AURobotServers
4
|
#include <usick.h>
Public Member Functions | |
virtual bool | changeMode (int scanangle, double resolution) |
char * | getDeviceName () |
virtual bool | getNewestData (ULaserData *dest, unsigned long lastSerial, int fake) |
USickData * | getNewestLocked () |
virtual bool | isPortOpen () |
virtual bool | isSick () |
USick () | |
~USick () | |
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 () |
virtual const char * | getNameFromDevice () |
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 | |
void | addCRC16 (unsigned char *CommData) |
void | close_port () |
virtual void | closePort () |
bool | enter_continous_mode () |
void | enter_installation_mode () |
unsigned int | getCCRC (unsigned char *CommData) |
virtual double | getDefaultDelay () |
USickData * | getNextBuffLocked () |
USickData * | LMS_send_receive (unsigned char *telegram) |
USickData * | LMS_send_receive (unsigned char *telegram, int repeats) |
int | open_port (void) |
virtual bool | openPort () |
bool | receive_continous_data (int *length) |
virtual bool | receiveData () |
bool | receiveSimulatedData (int *length) |
void | request_status () |
void | set_configuration () |
bool | set_fast_speed () |
virtual bool | set_resolution (int scanAngleDeg, int resolutionCdeg, int repeats) |
bool | set_serial (int fd, int speed) |
bool | set_slow_speed () |
unsigned short | specialCCRC (unsigned char *CommData, unsigned int uLen) |
bool | stop_continous_mode () |
int | toLMS (int fd, unsigned char *msg, unsigned int datalen) |
Protected Member Functions inherited from ULaserDevice | |
void | getFakeScan (ULaserData *dest, unsigned long lastSerial, int fake, double fakeDt=0.2) |
virtual bool | sendToDevice (const char *msg, int lng) |
void | updateScanData (UTime scanTime) |
Protected Member Functions inherited from ULock | |
bool | lock () |
void | lockInit () |
void | post () |
bool | tryLock () |
bool | tryWait () |
ULock () | |
void | unlock () |
bool | wait () |
~ULock () | |
Holds basic laser scanner functions
USick::USick | ( | ) |
USick::~USick | ( | ) |
Destructor
References ULaserDevice::stop().
|
protected |
Add CRC to this message
References getCCRC(), and TSIZE.
Referenced by isSick(), and LMS_send_receive().
|
virtual |
Get number of measurements in scan-mode Get angle from measurement number - result is in degrees Print status Change scanner resolution mode. Returns true if new resolution is set
Reimplemented from ULaserDevice.
References ULaserDevice::angleResolution, ULaserDevice::devName, enter_continous_mode(), LMS_fd, ULock::lock(), ULaserDevice::modeAngleScan, roundi(), set_fast_speed(), set_resolution(), set_serial(), set_slow_speed(), SLOWSERIAL_BAUDRATE, stop_continous_mode(), and ULock::unlock().
Referenced by getDeviceName(), and openPort().
|
protected |
|
protectedvirtual |
Close serial port
Reimplemented from ULaserDevice.
References close_port(), LMS_fd, set_slow_speed(), and stop_continous_mode().
Referenced by isSick().
|
protected |
Start continoious mode operation from SICK scanner
References data, LMS_send_receive(), and LMScontinous_mode.
Referenced by changeMode(), and isSick().
|
protected |
Change to installation mode
References LMS_send_receive(), and LMSinstallation_mode.
Referenced by isSick().
|
protected |
Set next buffer unlocked and if the result is true advance packsNew to this buffer Test af data pakkerne der modtages fra SICK sensoren (CRC) Der undersoeges om der er fejl paa data pakken Denne funktion er taget fra SICK manualen
References CRC16_GEN_POL, MKSHORT, and TSIZE.
Referenced by addCRC16(), and isSick().
|
inlineprotectedvirtual |
Get default delat estimate for the device type
Reimplemented from ULaserDevice.
|
inline |
Start the receive loop for continous messages Set simulated mode Set scan angle mode (180 or 100 deg) Set scan resolution mode (100, 50 or 25 centi degrees) Get actual scan resolution in centi degrees Get actual scan angle in degrees Get statistics - good count Get statistics - bad count Get statistics - number of good messages per second Get serial device name
References changeMode(), ULaserDevice::devName, getNewestData(), and isPortOpen().
|
virtual |
Get the newest data unpacked to this structure. Returns true if valid.
Reimplemented from ULaserDevice.
References ULaserDevice::angleResolution, ULaserData::clear(), ULaserDevice::datalogUsedScans, ULaserDevice::deviceNum, USickData::getDataTo(), ULaserDevice::getFakeScan(), getNewestLocked(), ULaserDevice::isRunning(), ULaserDevice::logThisScan(), ULaserDevice::maxValidRange, ULaserDevice::mirrorData, ULaserDevice::modeAngleScan, ULaserDevice::serial, ULaserData::setAngleResAndStart(), ULaserData::setDeviceNum(), ULaserData::setMaxValidRange(), ULaserData::setMirror(), ULaserData::setSerial(), ULaserData::setValid(), ULaserDevice::start(), ULock::unlock(), and Wait().
Referenced by getDeviceName().
USickData * USick::getNewestLocked | ( | ) |
Is sick scanner running Set device name Start sick scanner and grap the data Stop sick scanner port. Stop also thread - if not 'justClosePort'. Get newest data packet
References USickData::isValid(), PACK_BUF_SIZE, packs, packsNew, ULock::tryLock(), and ULock::unlock().
Referenced by getNewestData().
|
protected |
Get next buffer that can be locked and return pointer to this
References PACK_BUF_SIZE, packs, packsNew, and ULock::tryLock().
Referenced by isSick(), LMS_send_receive(), and receiveData().
|
virtual |
Is the port to the device open
Reimplemented from ULaserDevice.
References LMS_fd.
Referenced by getDeviceName().
|
inlinevirtual |
Is laserscanner a SICK scanner
References addCRC16(), close_port(), closePort(), enter_continous_mode(), enter_installation_mode(), getCCRC(), getNextBuffLocked(), LMS_send_receive(), open_port(), openPort(), receive_continous_data(), receiveData(), receiveSimulatedData(), request_status(), set_configuration(), set_fast_speed(), set_resolution(), set_serial(), set_slow_speed(), specialCCRC(), stop_continous_mode(), and toLMS().
|
protected |
Send data to SICK
References ACKSTX, addCRC16(), buf, data, FASTSERIAL_BAUDRATE, getNextBuffLocked(), LMS_fd, NACK, set_serial(), SLOWSERIAL_BAUDRATE, toLMS(), TSIZE, and verbose.
Referenced by enter_continous_mode(), enter_installation_mode(), isSick(), LMS_send_receive(), request_status(), set_configuration(), set_fast_speed(), set_resolution(), set_slow_speed(), and stop_continous_mode().
|
protected |
Send data to sick, and try up to 'repeat' times for a successfull reply
References data, and LMS_send_receive().
|
protected |
Open serial post
References ULaserDevice::devName, and ULaserDevice::open.
Referenced by isSick(), and openPort().
|
protectedvirtual |
Open serial post. Return true if open(ed)
Reimplemented from ULaserDevice.
References ULaserDevice::angleResolution, bool2str(), changeMode(), LMS_fd, MAX_NAME_LNG, ULaserDevice::modeAngleScan, ULaserDevice::name, and open_port().
Referenced by isSick().
|
protected |
Get next full package from serial device. Returnes the data length at the given adress 'length'. NB! on entry the length of the previous message must be maintained in length, to discard used data properly. Returns true if data has passed the CRC check.
References byteCnt, LMS_fd, LMS_response_buffer, RECEIVE_BUFFER_SIZE, ULaserDevice::serial, specialCCRC(), ULaserDevice::statBadCnt, and wastedData.
Referenced by isSick(), and receiveData().
|
protectedvirtual |
Receive data from device – called from device loop, should return as fast as possible after dooing 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 byteCnt, data, USickData::getData(), getNextBuffLocked(), ULaserDevice::gotNewScan(), LMS_response_buffer, ULock::lock(), receive_continous_data(), USickData::setTime(), USickData::setValid(), ULaserDevice::statGoodCnt, ULock::unlock(), ULaserDevice::var, and Wait().
Referenced by isSick().
|
protected |
Make a simulated reply - old recording in place of real Sick data Returnes the data length at the given adress 'length'. Returns true if message is valid.
Referenced by isSick().
|
protected |
|
protected |
Set scanner configuration
References LMS_send_receive(), and LMSset_configuration.
Referenced by isSick().
|
protected |
change communication speed to fast (500 kbps) NB! this may take some time (< 1 sec)
References data, FASTSERIAL, FASTSERIAL_BAUDRATE, LMS_fd, LMS_send_receive(), LMSset_500k_baud, serialspeed, set_serial(), SLOWSERIAL, SLOWSERIAL_BAUDRATE, and Wait().
Referenced by changeMode(), and isSick().
|
protectedvirtual |
Set resolution to either 1 deg or 0.5 deg. The command is repeated up to 'repeats',waiting for a positive reply. Returns true if successful, otherwise false.
References ULaserDevice::angleResolution, LMS_send_receive(), LMSADR, ULaserDevice::modeAngleScan, and STX.
Referenced by changeMode(), and isSick().
|
protected |
Set serial speed on communication port
References FASTSERIAL, portSpeed, serialspeed, and SLOWSERIAL.
Referenced by changeMode(), isSick(), LMS_send_receive(), set_fast_speed(), and set_slow_speed().
|
protected |
change communication speed to slow (9600 bps) NB! this may take some time (< 1 sec)
References data, FASTSERIAL, FASTSERIAL_BAUDRATE, LMS_fd, LMS_send_receive(), LMSset_9k6_baud, serialspeed, set_serial(), SLOWSERIAL, SLOWSERIAL_BAUDRATE, and Wait().
Referenced by changeMode(), closePort(), and isSick().
|
protected |
Calculate expected CRC on received data
References CRC16_GEN_POL, and MKSHORT.
Referenced by isSick(), and receive_continous_data().
|
protected |
Stop continoious mode operation from SICK scanner
References data, LMS_send_receive(), and LMScontinous_mode_stop.
Referenced by changeMode(), closePort(), and isSick().
|
protected |
Function writes the received message to the delivered file descripter
Referenced by isSick(), and LMS_send_receive().
|
protected |
Used data in LMS_response_buffer
Referenced by receive_continous_data(), receiveData(), and USick().
|
protected |
Is sick scanner running Serial device, where laser scanner is attached File descriptor for connection to laser scanner
Referenced by changeMode(), close_port(), closePort(), isPortOpen(), LMS_send_receive(), openPort(), receive_continous_data(), set_fast_speed(), set_slow_speed(), and USick().
|
protected |
Thread handle for frame read thread. Is thread actually running Should thread stop - terminate Buffer for received data
Referenced by receive_continous_data(), and receiveData().
|
protected |
Statistics of lost bytes, counts, when packages are too short
Referenced by USick().
|
protected |
Buffers for received data
Referenced by getNewestLocked(), and getNextBuffLocked().
|
protected |
Newest received package buffer
Referenced by getNewestLocked(), getNextBuffLocked(), and USick().
|
protected |
Speed of serial port
Referenced by set_serial(), and USick().
|
protected |
Serial speed (1 (slow (typically 9600)) or 2 (fast (500000)))
Referenced by set_fast_speed(), set_serial(), set_slow_speed(), and USick().
|
protected |
Print more (debug) messages
Referenced by LMS_send_receive().
|
protected |
Data left unused before a header is detected
Referenced by receive_continous_data(), and USick().