34 #define LUXBASE_VERSION "1.1.0" 37 #include "../tools/errorhandler.hpp" 38 #include "../tools/MathToolbox.hpp" 41 #include "../datatypes/Msg.hpp" 42 #include "../datatypes/Object.hpp" 51 std::string ipAddress,
UINT16 tcpPortNumber,
52 double scanFrequency,
double scanStartAngle,
double scanEndAngle,
double offsetX,
53 double offsetY,
double offsetZ,
double yawAngle,
double pitchAngle,
double rollAngle,
54 bool beVerbose, std::string inputFileName)
58 m_ipAddress(ipAddress),
59 m_tcpPortNumber(tcpPortNumber),
60 m_inputFileName(inputFileName),
61 m_scanFrequency(scanFrequency),
62 m_scanStartAngle(scanStartAngle),
63 m_scanEndAngle(scanEndAngle),
68 m_pitchAngle(pitchAngle),
69 m_rollAngle(rollAngle),
71 m_beVerbose(beVerbose)
132 printError(
"LuxBase::initTcp: Called in file mode - this is an error, aborting.");
150 printError(
"LuxBase::initTcp(): ERROR: Failed to establish TCP connection, aborting.");
176 printError(
"LuxBase::initTcp(): ERROR: Failed to read scanner status, aborting.");
194 printError(
"LuxBase::initTcp(): ERROR: Failed to read scanner beam tilt angle, aborting.");
253 printError(
"LuxBase::initFile: called without file - aborting!");
266 printError(
"LuxBase::initFile(): ERROR: Failed to open file, aborting.");
292 printWarning(
"updateThreadFunction(): Failed to read the status.");
296 sleepTimeMs = 1000 * 60;
322 uValue = uValue & 0x0000FFFF;
327 printError(
"Failed to set MountingX parameter!");
334 uValue = uValue & 0x0000FFFF;
339 printError(
"Failed to set MountingY parameter!");
346 uValue = uValue & 0x0000FFFF;
351 printError(
"Failed to set MountingZ parameter!");
359 uValue = uValue & 0x0000FFFF;
364 printError(
"Failed to set MountingYaw parameter!");
372 uValue = uValue & 0x0000FFFF;
377 printError(
"Failed to set MountingPitch parameter!");
385 uValue = uValue & 0x0000FFFF;
390 printError(
"Failed to set MountingRoll parameter!");
404 if ((2 * (value / 2)) != value)
424 if ((uValue > 3100) && (uValue < 3300))
428 else if ((uValue > 6300) && (uValue < 6500))
432 else if ((uValue > 12700) && (uValue < 12900))
439 printWarning(
"Para 'ScanFrequency' out of range, setting a default scan frequency of 12.5 Hz!");
445 printError(
"The SetParameter command failed!");
479 if (endAngle > startAngle)
481 printError(
"Start angle must be greater than end angle!");
492 printWarning(
"Para 'ScanStartAngle' out of range, limiting to 1600!");
497 printWarning(
"Para 'ScanStartAngle' out of range, limiting to -1919!");
500 uValue = uValue & 0x0000FFFF;
512 value = (
INT16)(endAngle * rad2deg * 32.0);
518 printWarning(
"Para 'ScanEndAngle' out of range, limiting to 1599!");
523 printWarning(
"Para 'ScanEndAngle' out of range, limiting to -1920!");
526 uValue = uValue & 0x0000FFFF;
531 printError(
"The SetParameter command failed!");
546 printWarning(
"Para 'SyncAngleOffset' out of range, limiting to 5759!");
551 printWarning(
"Para 'SyncAngleOffset' out of range, limiting to -5760!");
554 uValue = uValue & (1 << 14) - 1;
575 infoMessage(
"cmd_getStatus() called, but there is no connection - aborting!");
593 " MRS Status was read successfully. Firmware version is 0x" +
598 printError(
"LuxBase::cmd_getStatus: " +
m_longName +
" ERROR: Failed to receive status reply, aborting.");
604 printError(
"LuxBase::cmd_getStatus: " +
m_longName +
" ERROR: Failed to send command, aborting.");
621 infoMessage(
"readBeamTilt() called, but there is no connection - aborting!");
630 INT16 tilt =
static_cast<INT16>(value & 0xFFFF);
640 printError(
"LuxBase::readBeamTilt: " +
m_longName +
" ERROR: Failed to read beam tilt angle, aborting.");
655 infoMessage(
"readUpsideDown() called, but there is no connection - aborting!");
695 printError(
"LuxBase::cmd_stopMeasure: " +
m_longName +
" ERROR: stopMeasure() called, but there is no connection!");
716 printError(
"LuxBase::cmd_stopMeasure: " +
m_longName +
" ERROR: Failed to receive StopMeasure reply.");
722 printError(
"LuxBase::cmd_stopMeasure: " +
m_longName +
" ERROR: Failed to send command, aborting.");
737 printError(
"LuxBase::cmd_setNtpTimestamp: " +
m_longName +
" ERROR: stopMeasure() called, but there is no connection!");
747 std::stringstream secString;
748 secString <<
"seconds: " << seconds <<
"; fractional: " << fractionalSec;
753 printInfoMessage(
"LuxBase::cmd_setNtpTimestamp: MRS command 'SetNTPTimestampSec' was sent successfully, waiting for reply.",
m_beVerbose);
763 printError(
"LuxBase::cmd_setNtpTimestamp: " +
m_longName +
" ERROR: Failed to receive 'SetNTPTimestampSec' reply, aborting.");
770 printError(
"LuxBase::cmd_setNtpTimestampSec: " +
m_longName +
" ERROR: Failed to send command, aborting.");
781 printInfoMessage(
"LuxBase::cmd_setNtpTimestamp: MRS command 'SetNTPTimestampFrac' was sent successfully, waiting for reply.",
m_beVerbose);
791 printError(
"LuxBase::cmd_setNtpTimestampFrac: " +
m_longName +
" ERROR: Failed to receive 'SetNTPTimestampFrac' reply, aborting.");
798 printError(
"LuxBase::cmd_setNtpTimestampFrac: " +
m_longName +
" ERROR: Failed to send command, aborting.");
815 printError(
"LuxBase::cmd_setParameter: " +
m_longName +
" ERROR: setParameter() called, but there is no connection, aborting!");
839 printError(
"LuxBase::cmd_setParameter: " +
m_longName +
" ERROR: Failed to receive SetParameter reply.");
845 printError(
"LuxBase::cmd_setParameter: " +
m_longName +
" ERROR: Failed to send command, aborting.");
856 printError(
"LuxBase::cmd_getParameter: " +
m_longName +
" ERROR: setParameter() called, but there is no connection, aborting!");
880 printError(
"LuxBase::cmd_getParameter: " +
m_longName +
" ERROR: Failed to receive GetParameter reply.");
886 printError(
"LuxBase::cmd_getParameter: " +
m_longName +
" ERROR: Failed to send command, aborting.");
924 printInfoMessage(
"LuxBase::cmd_setDataOutputFlags: Output flags were set successfully to " +
930 printError(
"LuxBase::cmd_setDataOutputFlags:" +
m_longName +
" ERROR: Failed to set output flags, aborting.");
959 printError(
"LuxBase::cmd_startMeasure:" +
m_longName +
" ERROR: startMeasure() called, but there is no connection, aborting!");
968 printWarning(
"LuxBase::cmd_startMeasure:" +
m_longName +
" Warning: StartMeasure called, but neither scans nor objects are requested!");
981 printError(
"LuxBase::cmd_startMeasure:" +
m_longName +
" ERROR: Failed to set data output, aborting!");
1002 printError(
"LuxBase::cmd_startMeasure:" +
m_longName +
" ERROR: Failed to receive StartMeasure reply.");
1008 printError(
"LuxBase::cmd_startMeasure:" +
m_longName +
" ERROR: Failed to send command, aborting.");
1030 value = ((
UINT16)(buffer[0])) + ((
UINT16)(buffer[1]) << 8);
1039 value = ((
UINT32)(buffer[0])) + ((
UINT32)(buffer[1]) << 8)
1040 + ((
UINT32)(buffer[2]) << 16) + ((
UINT32)(buffer[3]) << 24);
1116 double voltage = 1.8663f - 0.01169f * celsius;
1121 UINT16 value = (
UINT16)(((1023 * voltage) / 3.3f) + 0.5);
1140 double voltage = ((double)intValue * 3.3f) / 1023.0;
1144 return (1.8663f - voltage) / 0.01169f;
1149 double temperature = 0;
1180 std::ostringstream oss;
1191 oss << std::setfill (
'0')
1200 oss << std::setfill (
'0') << std::hex
1223 std::ostringstream oss;
1224 oss << std::hex << std::uppercase
1225 << ((val & 0xF000) >> 12) <<
'.' 1226 << std::setfill(
'0') << std::setw(2) << ((val & 0x0FF0) >> 4) <<
'.' 1236 UINT16 year = timestamp[0];
1237 UINT16 month = timestamp[1] >> 8;
1238 UINT16 day = timestamp[1] & 0x00FF;
1239 UINT16 hour = timestamp[2] >> 8;
1240 UINT16 minute = timestamp[2] & 0x00FF;
1242 std::ostringstream oss;
1243 oss <<
int2Version (version) <<
' ' << std::setfill (
'0') << std::hex
1244 << std::setw (4) << year <<
'-' 1245 << std::setw (2) << month <<
'-' 1246 << std::setw (2) << day <<
' ' 1247 << std::setw (2) << hour <<
':' 1248 << std::setw (2) << minute;
1278 value += ((
UINT32)buffer[1]) << 8;
1282 value += ((
UINT32)buffer[1]) << 8;
1283 value += ((
UINT32)buffer[2]) << 16;
1284 value += ((
UINT32)buffer[3]) << 24;
1287 printError(
"LuxBase::readUValueLE: " +
m_longName +
" ERROR: Invalid number of bytes to read, can only handle 1,2 or 4.");
1306 value += ((
UINT64)buffer[1]) << 8;
1307 value += ((
UINT64)buffer[2]) << 16;
1308 value += ((
UINT64)buffer[3]) << 24;
1309 value += ((
UINT64)buffer[4]) << 32;
1310 value += ((
UINT64)buffer[5]) << 40;
1311 value += ((
UINT64)buffer[6]) << 48;
1312 value += ((
UINT64)buffer[7]) << 56;
1329 value = (
INT32)(buffer[0]);
1333 value |= 0xFFFFFF00;
1337 value = (
INT32)(buffer[0]);
1338 value += ((
INT32)buffer[1]) << 8;
1341 value = value - 0x10000;
1342 value |= 0xFFFF0000;
1347 value += ((
INT32)buffer[1]) << 8;
1348 value += ((
INT32)buffer[2]) << 16;
1349 value += ((
INT32)buffer[3]) << 24;
1352 printError(
"LuxBase::readValueLE: " +
m_longName +
" ERROR: Invalid number of bytes to read, can only handle 1,2 or 4.");
1379 value += ((
UINT32)buffer[0]) << 8;
1383 value += ((
UINT32)buffer[2]) << 8;
1384 value += ((
UINT32)buffer[1]) << 16;
1385 value += ((
UINT32)buffer[0]) << 24;
1388 printError(
"LuxBase::readUValueBE: " +
m_longName +
" ERROR: Invalid number of bytes to read, can only handle 1,2 or 4.");
1412 bool beVerboseHere =
false;
1413 printInfoMessage(
"LuxBase::decodeAnswerInInputBuffer: Called.", beVerboseHere);
1415 const UINT32 headerLen = 24;
1422 printInfoMessage(
"LuxBase::decodeAnswerInInputBuffer(): Not enough data in input buffer, just " +
1432 for (i = 0; i < end; i++)
1435 if (magicWord == 0xAFFEC0C2)
1437 printInfoMessage(
"LuxBase::decodeAnswerInInputBuffer(): Magic word found at pos " +
toString(i) +
".", beVerboseHere);
1442 if ((i > 0) && (magicWord != 0xAFFEC0C2))
1444 printInfoMessage(
"LuxBase::decodeAnswerInInputBuffer(): Out of sync, and no magic word found - clearing buffer.", beVerboseHere);
1450 else if ((i > 0) && (magicWord == 0xAFFEC0C2))
1453 printInfoMessage(
"LuxBase::decodeAnswerInInputBuffer(): Out of sync, adjusting the buffer by " +
toString(i) +
" bytes.", beVerboseHere);
1459 if (magicWord != 0xAFFEC0C2)
1462 printInfoMessage(
"LuxBase::decodeAnswerInInputBuffer(): Magic word not found, aborting!", beVerboseHere);
1467 printInfoMessage(
"LuxBase::decodeAnswerInInputBuffer(): Magic word found, now decoding header.", beVerboseHere);
1476 printInfoMessage(
"LuxBase::decodeAnswerInInputBuffer(): Message payload length is " +
toString(payloadLen) +
" bytes.", beVerboseHere);
1519 "(Length=" + ::
toString(headerLen + payloadLen) +
" bytes) in buffer, removing this dataset.");
1525 if (beVerboseHere ==
true)
1529 infoMessage(
"LuxBase::decodeAnswerInInputBuffer(): Header decoded successfully, datatype 0x" +
toHexString(datatype) +
".");
1533 infoMessage(
"LuxBase::decodeAnswerInInputBuffer(): Header decoded successfully, but message is incomplete.");
1566 text +=
"<Scan buffer transmitted incompletely> ";
1570 text +=
"<Scan buffer overflow> ";
1574 text +=
"<APD temperature sensor defective> ";
1580 text +=
"<APD undertemperature> ";
1584 text +=
"<APD overtemperature> ";
1591 text +=
"<No scan data received> ";
1595 text +=
"<Incorrect configuration data> ";
1599 text +=
"<Configuration contains incorrect parameters> ";
1603 text +=
"<Data processing timeout> ";
1607 text +=
"<Incorrect flex. res. configurarion> ";
1615 text +=
"<Some other error> ";
1631 text +=
"<Internal communication error> ";
1635 text +=
"<Warning of insufficient temperature> ";
1639 text +=
"<Warning of exceeding temperature> ";
1643 text +=
"<Check syncronisation- and scan frequency> ";
1649 text +=
"<CAN interface blocked> ";
1653 text +=
"<Ethernet interface blocked> ";
1657 text +=
"<Incorrect CAN message received> ";
1661 text +=
"<Check ethernet data> ";
1665 text +=
"<Incorrect or forbidden command received> ";
1669 text +=
"<Memory access failure> ";
1674 text +=
"<Some other warning> ";
1681 std::ostringstream registers;
1745 volatile bool isRearMirrorSide =
true;
1747 if ((processingFlags & 0x0400) == 0)
1750 isRearMirrorSide =
false;
1755 isRearMirrorSide =
true;
1770 UINT8* scanPtBuffer;
1771 for (
UINT16 s = 0; s < scanPoints; s++)
1773 scanPtBuffer = &(scanBuffer[44 + s*10]);
1775 UINT8 layer = layerAndEcho & 0x0F;
1776 UINT8 echo = (layerAndEcho >> 4) & 0x0F;
1790 double vAngle = 0.0;
1794 double dist = (double)radialDistanceCm / 100.0;
1797 newPoint.
setPolar (dist, hAngle, vAngle);
1800 newPoint.
setEchoWidth ((
float)echoPulseWidthCm / 100.0);
1831 start.
set(timestampStart);
1832 end.
set(timestampEnd);
1837 double yawAngle, pitchAngle, rollAngle, offsetX, offsetY, offsetZ;
1841 offsetX = (double)mountingPosX / 100.0;
1842 offsetY = (double)mountingPosY / 100.0;
1843 offsetZ = (double)mountingPosZ / 100.0;
1844 Position3D mp(yawAngle, pitchAngle, rollAngle, offsetX, offsetY, offsetZ);
1881 const double effMirrorTilt =
m_beamTiltAngle / 2.0 * M_SQRT2 * std::sin(0.5 * hAngle - M_PI_4);
1885 double mirrorDirection = 1.0;
1886 if (isRearMirrorSide ==
false)
1888 mirrorDirection = -1.0;
1894 mirrorDirection *= -1.0;
1898 const double numLayers = 4.0;
1899 const double verticalBeamDivergence = 0.8 *
deg2rad;
1900 const double layerOffset = ((numLayers - 1) / 2 - layerNumber) * verticalBeamDivergence;
1901 const double vAngle = layerOffset + mirrorDirection * 2 * effMirrorTilt;
1913 double angle = ((double)angleTicks / 32.0) *
deg2rad;
1915 if ((angle > -1000.0) && (angle < 1000.0))
1922 while (angle <= -
PI)
1930 printError(
"convertTicktsToAngle(): The angle value " +
toString(angle, 2) +
" is widely out of the reasonable range, setting to 0.0.");
1952 UINT32 bufferOffset = 24;
1958 bufferOffset = 24 + 10;
1960 for (
UINT16 i = 0; i < numObjects; i++)
1983 t.
set((
double)relativeTimestamp);
2005 double tmp = boundingBoxSize.
getX();
2007 boundingBoxSize.
setX(boundingBoxSize.
getY());
2008 boundingBoxSize.
setY(tmp);
2030 if (absoluteVelocity.
getX() < -320.0)
2049 switch (classification)
2082 if (classificationCertainty <= 100)
2096 if (numContourPoints == 0xFFFF)
2098 numContourPoints = 1;
2102 for (
UINT16 c = 0; c < numContourPoints; c++)
2110 objectList->push_back (newObject);
2129 return Point2D(((
double)value1 / 100.0), ((
double)value2 / 100.0));
2141 Point2D s((
double)value1 / 100.0, (
double)value2 / 100.0);
2154 infoMessage(
"moveDataFromInputToCmdBuffer(): Moving " +
toString(bytesToBeMoved) +
" bytes from input to command buffer.");
2185 toString(bytesToBeRemoved) +
" bytes should be removed - clearing buffer.");
2206 bool beVerboseHere =
false;
2207 printInfoMessage(
"Entering decodeAnswerInCmdReplyBuffer().", beVerboseHere);
2209 const UINT32 headerLen = 24;
2221 printInfoMessage(
"decodeAnswerInCmdReplyBuffer(): No data in input buffer.", beVerboseHere);
2229 printError(
"decodeAnswerInCmdReplyBuffer(): ERROR: Not enough data in reply buffer for the data header, just " +
2238 if (magicWord != 0xAFFEC0C2)
2240 printError(
"decodeAnswerInCmdReplyBuffer(): Magic word not found, clearing cmd buffer.");
2247 printInfoMessage(
"decodeAnswerInCmdReplyBuffer(): Magic word found, now decoding header.", beVerboseHere);
2253 printInfoMessage(
"decodeAnswerInCmdReplyBuffer(): Message payload length is " +
toString(payloadLen) +
" bytes.", beVerboseHere);
2260 printInfoMessage(
"decodeAnswerInCmdReplyBuffer(): Header decoded successfully, command = " +
2265 printError(
"decodeAnswerInCmdReplyBuffer(): Inconsistent length of data in reply buffer, expected length was " +
2271 printInfoMessage(
"decodeAnswerInCmdReplyBuffer(): Leaving successfully, command = " +
toHexString(commandId) +
".", beVerboseHere);
2280 std::ostringstream s;
2282 for (
UINT32 i = 0; i < 24; i++)
2294 std::ostringstream s;
2298 for (
UINT32 i = 0; i < payloadLen; i++)
2316 const UINT32 headerLen = 24;
2321 printWarning(
"LuxBase::removeAnswerFromInputBuffer: Not enough data in input buffer to remove a dataset, aborting!");
2328 if (magicWord != 0xAFFEC0C2)
2330 printError(
"LuxBase::removeAnswerFromInputBuffer: Magic word does not match, aborting!");
2338 printError(
"LuxBase::removeAnswerFromInputBuffer: The buffer does not hold enough data for the message!");
2356 m_inBufferLevel -= msgLen;
2358 printInfoMessage(
"LuxBase::removeAnswerFromInputBuffer(): Removed " +
toString(msgLen) +
" bytes from buffer, new size is " +
2375 UINT32 maxLoops = timeoutMs;
2376 bool result =
false;
2378 for (
UINT32 i = 0; i < maxLoops; i++)
2384 if (cmdInBuffer == cmd)
2415 if (cmdInBuffer != 0)
2421 if (cmdInBuffer == 0x8000 + cmd)
2449 UINT8 cmdBuffer[256];
2450 UINT32 sizeOfThisMsg = 0;
2456 sizeOfThisMsg = 2 + 2;
2459 sizeOfThisMsg = 2 + 2;
2462 sizeOfThisMsg = 2 + 2;
2465 sizeOfThisMsg = 2 + 2 + 2;
2468 sizeOfThisMsg = 2 + 2 + 2 + 4;
2471 sizeOfThisMsg = 2 + 2 + 2 + 4;
2474 sizeOfThisMsg = 2 + 2 + 2 + 4;
2477 printError(
"LuxBase::sendMrsCommand: " +
m_longName +
" ERROR: Unknown command to be sent (ID=0x" +
2507 UINT32 bytesToSend = bufferPos;
2508 bool result =
m_tcp.
write(cmdBuffer, bytesToSend);
2523 buffer[0] = value & 0xff;
2526 buffer[0] = (value & 0xff00) >> 8;
2527 buffer[1] = value & 0xff;
2530 buffer[0] = (value & 0xff000000) >> 24;
2531 buffer[1] = (value & 0xff0000) >> 16;
2532 buffer[2] = (value & 0xff00) >> 8;
2533 buffer[3] = value & 0xff;
2536 printError(
"LuxBase::writeValueToBufferBE: " +
m_longName +
" ERROR: Invalid number of bytes to write, can only handle 1,2 or 4.");
2552 buffer[0] = value & 0xff;
2555 buffer[1] = (value & 0xff00) >> 8;
2556 buffer[0] = value & 0xff;
2559 buffer[3] = (value & 0xff000000) >> 24;
2560 buffer[2] = (value & 0xff0000) >> 16;
2561 buffer[1] = (value & 0xff00) >> 8;
2562 buffer[0] = value & 0xff;
2565 printError(
"LuxBase::writeValueToBufferLE: " +
m_longName +
" ERROR: Invalid number of bytes to write, can only handle 1,2 or 4.");
2580 UINT32 magicWord = 0xAFFEC0C2;
2581 UINT32 sizeOfPrevMsg = 0;
2597 UINT32 timeSecFractionOffset = 0;
2624 bool result =
false;
2636 if (result ==
false)
2639 printError(
"LuxBase::run(): Call to init() was not successful, aborting!");
2664 if (result ==
false)
2666 printError(
"LuxBase::run(): Failed to set scan frequency, aborting.");
2672 if (result ==
false)
2674 printError(
"LuxBase::run(): Failed to set scan angles, aborting.");
2681 if (result ==
false)
2683 printError(
"LuxBase::run(): Failed to set mounting pos, aborting.");
2690 infoMessage(
"LuxBase::run(): Running in read-only mode, so we're just using current sensor parameters.");
2708 printError(
"LuxBase::run(): The StartMeasure command failed!");
2727 bool beVerboseHere =
false;
2728 printInfoMessage(
"LuxBase::readCallbackFunction(): Called with " +
toString(numOfBytes) +
" available bytes.", beVerboseHere);
2732 UINT32 bytesToBeTransferred = numOfBytes;
2733 if (remainingSpace < numOfBytes)
2735 bytesToBeTransferred = remainingSpace;
2739 " bytes from TCP to input buffer.", beVerboseHere);
2741 if (bytesToBeTransferred > 0)
2744 memcpy(&(
m_inputBuffer[m_inBufferLevel]), buffer, bytesToBeTransferred);
2745 m_inBufferLevel += bytesToBeTransferred;
2753 while (datatype != 0);
2760 m_inBufferLevel = 0;
2764 " bytes to input buffer, new fill level is now " +
toString(m_inBufferLevel) +
" bytes.", beVerboseHere);
2776 printWarning(
"stop(): Device is not running, nothing to do.");
2793 printError(
"LuxBase::stop: StopMeasure command to LD-MRS was not successful!");
0x0010 = sets a parameter in the sensor
bool cmd_setMountingPos(Position3D mp)
void setObjectId(UINT16 v)
void setScannerType(UINT8 newScannerType)
void printError(std::string message)
void setSourceId(UINT8 id)
std::string toString(const PositionWGS84::PositionWGS84SourceType &type)
bool receiveMrsReply(MrsCommandId cmd, UINT32 timeoutMs, UINT32 *value=NULL)
void setMountingPosition(const Position3D &v)
void setObjectBox(const Point2D &v)
static void readCallbackFunctionS(void *obj, BYTE *buffer, UINT32 &numOfBytes)
void makeIntValueEven(INT16 &value)
void * m_disconnectFunctionObjPtr
bool cmd_getParameter(MrsParameterId parameter, UINT32 *value)
double convertTicktsToAngle(INT16 angleTicks)
double getVAngleOfLayer(bool isRearMirrorSide, UINT8 layerNumber, double hAngle)
0x0004 = ID of the SaveConfig command
void removeDataFromInputBuffer(UINT32 bytesToBeRemoved)
value_type getX() const
x-coordinate [m] of the sensor in the vehicle coordinate system
A Position with orientation.
bool cmd_setSyncAngleOffset(double syncAngle)
void setReadCallbackFunction(ReadFunction readFunction, void *obj)
void setRelativeVelocity(const Point2D &v)
INT32 readValueLE(UINT8 *buffer, UINT8 bytes)
0x0031 = sets NTP fractional seconds
std::string m_inputFileName
double int2Celsius(double intValue)
Converts raw data to degree Celsius.
void decodeErrorMessage()
UINT16 decodeAnswerInInputBuffer()
UINT32 writeValueToBufferBE(UINT8 *buffer, UINT32 value, UINT8 bytes)
void setEndAngle(double v)
void setEchoNum(UINT8 sub)
bool cmd_saveConfiguration()
UINT16 m_FPGATimestamp[3]
void readCallbackFunction(BYTE *buffer, UINT32 &numOfBytes)
UINT32 buildDataHeader(UINT8 *buffer, UINT32 sizeofThisMsg, UINT8 deviceId, UINT16 dataType)
void(* DisconnectFunction)(void *obj)
#define printInfoMessage(a, b)
void setDeviceID(UINT8 v)
void setScanFrequency(double freq)
Set the scanner's scan frequency in [Hz]. Must be non-negative.
File::DisconnectFunction m_fileDisconnectFunction
void setAbsoluteVelocity(const Point2D &v)
void setScannerInfos(const ScannerInfoVector &v)
bool cmd_setDataOutputFlags()
void setOnScanReceiveCallbackFunction(OnScanReceiveCallbackFunction function, void *obj)
void setStartAngle(double v)
void setObjectAge(UINT32 v)
void setCenterPoint(const Point2D &v)
void setScanNumber(UINT16 v)
0x0001 = ID of the GetStatus command
void setPolar(double dist, double hAngle, double vAngle)
bool write(UINT8 *buffer, UINT32 numberOfBytes)
virtual bool initTcp(Tcp::DisconnectFunction function, void *obj)
void setEchoWidth(double echoWidth)
Set the echo pulse width, typically in [m].
void setClassificationAge(UINT32 v)
void setBoundingBoxCenter(const Point2D &v)
value_type getPitchAngle() const
Pitch angle [rad] of the sensor in the vehicle coordinate system.
value_type getYawAngle() const
Yaw angle [rad] of the sensor in the vehicle coordinate system.
bool open(std::string ipAddress, UINT16 port, bool enableVerboseDebugOutput=false)
void updateThreadFunction(bool &endThread, UINT16 &sleepTimeMs)
void setFlags(UINT16 flags)
Sets the scan point flags directly.
UINT32 readUValueLE(UINT8 *buffer, UINT8 bytes)
0x0030 = sets NTP seconds
Mutex m_updateMutex
Access mutex for update.
UINT16 m_firmwareTimestamp[3]
ScanPoint & addNewPoint()
void addContourPoint(const Point2D cp)
UINT8 m_cmdReplyBuffer[MRS_CMDREPLYBUFFERSIZE]
void removeAnswerFromInputBuffer()
UINT16 celsius2Int(double celsius)
Converts degree Celsius to raw data.
UINT32 writeValueToBufferLE(UINT8 *buffer, UINT32 value, UINT8 bytes)
bool cmd_setParameter(MrsParameterId parameter, UINT32 value)
void setClassificationQuality(double v)
void setTimestamp(const Time &v)
UINT64 readUINT64ValueLE(UINT8 *buffer)
void setDisconnectCallbackFunction(DisconnectFunction discFunction, void *obj)
UINT8 m_inputBuffer[MRS_INPUTBUFFERSIZE]
void infoMessage(std::string message, bool print)
LuxBase(Manager *manager, const UINT8 deviceID, const std::string longName, std::string ipAddress, UINT16 tcpPortNumber, double scanFrequency, double scanStartAngle, double scanEndAngle, double offsetX, double offsetY, double offsetZ, double yawAngle, double pitchAngle, double rollAngle, bool beVerbose, std::string inputFileName)
value_type getRollAngle() const
Roll angle [rad] of the sensor in the vehicle coordinate system.
0x0020 = starts the measurement with the currenly configured settings
virtual bool initFile(File::DisconnectFunction function, void *obj)
void setScanNumber(UINT16 val)
static std::string int2Version(UINT16 val)
void(* DisconnectFunction)(void *obj)
Point2D readSize2D(UINT8 *buffer)
virtual bool run(bool weWantScanData=true, bool weWantObjectData=true)
bool cmd_setScanFrequency(double scanFreq)
bool cmd_setNtpTimestamp(UINT32 seconds, UINT32 fractionalSec)
UINT32 readUValueBE(UINT8 *buffer, UINT8 bytes)
OnScanReceiveCallbackFunction m_onScanReceiveCallback
void setClosestPoint(const Point2D &v)
void setAbsoluteVelocitySigma(const Point2D &v)
void moveDataFromInputToCmdBuffer(UINT32 bytesToBeMoved)
std::vector< ScannerInfo > ScannerInfoVector
void setScanFlags(UINT32 flags)
void(* OnScanReceiveCallbackFunction)(void *)
Tcp::DisconnectFunction m_tcpDisconnectFunction
bool cmd_startMeasure(bool weWantScanData=true, bool weWantObjectData=true)
void memreadLE(BYTE *&buffer, UINT16 &value)
Point2D readPoint2D(UINT8 *buffer)
void setRelativeVelocitySigma(const Point2D &v)
void setClassification(ObjectClassification v)
void setCenterPointSigma(const Point2D &v)
void setHiddenStatusAge(UINT16 v)
#define MRS_INPUTBUFFERSIZE
void setBeamTilt(double tilt)
static std::string version2string(UINT16 version, const UINT16 timestamp[3])
void setProcessingFlags(const UINT16 processingFlags)
value_type getY() const
y-coordinate [m] of the sensor in the vehicle coordinate system
std::string getSerialNumber()
void setTimestamps(const Time &start, const Time &end)
Set the start and end timestamp of the scan received by this scanner (in terms of the host computer c...
UINT16 decodeAnswerInCmdReplyBuffer()
void setReadCallbackFunction(ReadFunction readFunction, void *obj)
bool cmd_setScanAngles(double startAngle, double endAngle)
void setFlags(UINT32 val)
void * m_onScanReceiveCallbackObjPtr
bool decodeGetParameter(UINT32 *value)
void setBoundingBox(const Point2D &v)
void setDisconnectCallbackFunction(DisconnectFunction discFunction, void *obj)
static bool isValidVersion(UINT16 version)
virtual void setSourceId(UINT16 id)
void setCourseAngle(double newCourseAngle)
void printWarning(std::string message)
0x0011 = reads a parameter from the sensor
bool open(std::string inputFileName, bool beVerbose=false)
value_type getZ() const
z-coordinate [m] of the sensor in the vehicle coordinate system
static const UINT16 Err_FlexResParameter
0x0021 = stops the measurement
void setDeviceData(BasicData *data)
bool sendMrsCommand(MrsCommandId cmd, UINT16 para=0, UINT32 value=0)