/** @param currentBufferSize number of readings to store in the current buffer @param cumulativeBufferSize number of readings to store in the cumulative buffer @param name the name of this device @param maxRange the maximum range of this device. If the device can't find a reading in a specified section, it returns this maxRange @param maxSecondsToKeepCurrent this is the number of seconds to keep current readings in the current buffer. If less than 0, then readings are not automatically removed based on time (but can be replaced or removed for other reasons). @param maxSecondsToKeepCumulative this is the number of seconds to keep cumulative readings in the cumulative buffer. If less than 0 then readings are not automatically based on time (but can be replaced or removed for other reasons). @param maxDistToKeepCumulative if cumulative readings are further than this distance from the current robot pose, then they are removed. If this is less than 0 they are not removed because of this @param locationDependent if the data in this range device is dependent on the robot's location or not... For instance, a laser would not be dependent on location, because it'll be correct in a relative manner, whereas forbidden lines are dependent on location, because if the robot isn't where it thinks it is then the forbidden lines will be avoided in the wrong spots... this is mainly just a flag for other things to use when deciding what range devices to avoid @param planar if the range device is planar or not... planar range devices are ones like the Sick LMS200 that are only in one plane and and are all measured from a single point... Where you can use the beams of the current reading to filter out any cumulative readings that are close to the beam... these range devices need to simply build a set of raw readings and then call 'planarProcessReadings' for this filtering to work **/ AREXPORT ArRangeDevice::ArRangeDevice(size_t currentBufferSize, size_t cumulativeBufferSize, const char *name, unsigned int maxRange, int maxSecondsToKeepCurrent, int maxSecondsToKeepCumulative, double maxDistToKeepCumulative, bool locationDependent) : myCurrentBuffer(currentBufferSize), myCumulativeBuffer(cumulativeBufferSize), myFilterCB(this, &ArRangeDevice::filterCallback) { myDeviceMutex.setLogName("ArRangeDevice::myDeviceMutex"); myRobot = NULL; myName = name; myMaxRange = maxRange; myRawReadings = NULL; myAdjustedRawReadings = NULL; setMaxSecondsToKeepCurrent(maxSecondsToKeepCurrent); setMinDistBetweenCurrent(0); setMaxSecondsToKeepCumulative(maxSecondsToKeepCumulative); setMaxDistToKeepCumulative(maxDistToKeepCumulative); setMinDistBetweenCumulative(0); setMaxInsertDistCumulative(0); myCurrentDrawingData = NULL; myOwnCurrentDrawingData = false; myCumulativeDrawingData = NULL; myOwnCumulativeDrawingData = false; myIsLocationDependent = locationDependent; //setMinDistBetweenCurrent(); //setMinDistBetweenCumulative(); }
AREXPORT ArUrg::ArUrg(int laserNumber, const char *name) : ArLaser(laserNumber, name, 4095), mySensorInterpTask(this, &ArUrg::sensorInterp), myAriaExitCB(this, &ArUrg::disconnect) { clear(); myRawReadings = NULL; Aria::addExitCallback(&myAriaExitCB, -10); laserSetName(getName()); setParams(); setSensorPosition(0, 0, 0); laserAllowSetDegrees(-120, -135, 135, // default, min and max start degrees 120, -135, 135); // default, min and max end degrees laserAllowSetIncrement(1, 0, 135); std::list<std::string> baudChoices; baudChoices.push_back("019200"); baudChoices.push_back("057600"); baudChoices.push_back("115200"); baudChoices.push_back("250000"); baudChoices.push_back("500000"); baudChoices.push_back("750000"); laserAllowStartingBaudChoices("019200", baudChoices); laserAllowAutoBaudChoices("057600", baudChoices); setMinDistBetweenCurrent(0); setMaxDistToKeepCumulative(4000); setMinDistBetweenCumulative(200); setMaxSecondsToKeepCumulative(30); setMaxInsertDistCumulative(3000); setCumulativeCleanDist(75); setCumulativeCleanInterval(1000); setCumulativeCleanOffset(600); resetLastCumulativeCleanTime(); setCurrentDrawingData( new ArDrawingData("polyDots", ArColor(0, 0xaa, 0xaa), 70, // mm diameter of dots 77), true); setCumulativeDrawingData( new ArDrawingData("polyDots", ArColor(0, 0x55, 0x55), 100, // mm diameter of dots 62), true); //myLogMore = false; myLogMore = true; }
AREXPORT ArLMS1XX::ArLMS1XX(int laserNumber, const char *name) : ArLaser(laserNumber, name, 20000), mySensorInterpTask(this, &ArLMS1XX::sensorInterp), myAriaExitCB(this, &ArLMS1XX::disconnect) { clear(); myRawReadings = new std::list<ArSensorReading *>; Aria::addExitCallback(&myAriaExitCB, -10); setInfoLogLevel(ArLog::Normal); laserSetName(getName()); laserAllowSetPowerControlled(false); laserAllowSetDegrees(-135, -135, 135, // start degrees 135, -135, 135); // end degrees std::map<std::string, double> incrementChoices; incrementChoices["half"] = .5; incrementChoices["quarter"] = .25; laserAllowIncrementChoices("half", incrementChoices); laserSetDefaultTcpPort(2111); laserSetDefaultPortType("tcp"); myLogLevel = ArLog::Verbose; setMinDistBetweenCurrent(50); setMaxDistToKeepCumulative(4000); setMinDistBetweenCumulative(200); setMaxSecondsToKeepCumulative(30); setMaxInsertDistCumulative(3000); setCumulativeCleanDist(75); setCumulativeCleanInterval(1000); setCumulativeCleanOffset(600); resetLastCumulativeCleanTime(); setCurrentDrawingData( new ArDrawingData("polyDots", ArColor(0, 0, 255), 80, // mm diameter of dots 75), // layer above sonar true); setCumulativeDrawingData( new ArDrawingData("polyDots", ArColor(125, 125, 125), 100, // mm diameter of dots 60), // layer below current range devices true); }
AREXPORT ArLaserFilter::ArLaserFilter( ArLaser *laser, const char *name) : ArLaser(laser->getLaserNumber(), name != NULL && name[0] != '\0' ? name : laser->getName(), laser->getAbsoluteMaxRange(), laser->isLocationDependent(), false), myProcessCB(this, &ArLaserFilter::processReadings) { myLaser = laser; if (name == NULL || name[0] == '\0') { std::string filteredName; filteredName = "filtered_"; filteredName += laser->getName(); laserSetName(filteredName.c_str()); } myRawReadings = new std::list<ArSensorReading *>; char buf[1024]; sprintf(buf, "%sProcessCB", getName()); myProcessCB.setName(buf); myAngleToCheck = 1; myAnyFactor = -1; myAllFactor = -1; myMaxRange = -1; setCurrentDrawingData( new ArDrawingData(*(myLaser->getCurrentDrawingData())), true); setCumulativeDrawingData( new ArDrawingData(*(myLaser->getCumulativeDrawingData())), true); // laser parameters setInfoLogLevel(myLaser->getInfoLogLevel()); setConnectionTimeoutSeconds(myLaser->getConnectionTimeoutSeconds()); setCumulativeCleanDist(myLaser->getCumulativeCleanDist()); setCumulativeCleanInterval(myLaser->getCumulativeCleanInterval()); setCumulativeCleanOffset(myLaser->getCumulativeCleanOffset()); setSensorPosition(myLaser->getSensorPosition()); laserSetAbsoluteMaxRange(myLaser->getAbsoluteMaxRange()); setMaxRange(myLaser->getMaxRange()); // base range device parameters setMaxSecondsToKeepCurrent(myLaser->getMaxSecondsToKeepCurrent()); setMinDistBetweenCurrent(getMinDistBetweenCurrent()); setMaxSecondsToKeepCumulative(myLaser->getMaxSecondsToKeepCumulative()); setMaxDistToKeepCumulative(myLaser->getMaxDistToKeepCumulative()); setMinDistBetweenCumulative(myLaser->getMinDistBetweenCumulative()); setMaxInsertDistCumulative(myLaser->getMaxInsertDistCumulative()); setCurrentDrawingData(myLaser->getCurrentDrawingData(), false); setCumulativeDrawingData(myLaser->getCumulativeDrawingData(), false); // now all the specific laser settings (this should already be taken // care of when this is created, but the code existed for the // simulated laser so I put it here too) if (myLaser->canSetDegrees()) laserAllowSetDegrees( myLaser->getStartDegrees(), myLaser->getStartDegreesMin(), myLaser->getStartDegreesMax(), myLaser->getEndDegrees(), myLaser->getEndDegreesMin(), myLaser->getEndDegreesMax()); if (myLaser->canChooseDegrees()) laserAllowDegreesChoices(myLaser->getDegreesChoice(), myLaser->getDegreesChoicesMap()); if (myLaser->canSetIncrement()) laserAllowSetIncrement(myLaser->getIncrement(), myLaser->getIncrementMin(), myLaser->getIncrementMax()); if (myLaser->canChooseIncrement()) laserAllowIncrementChoices(myLaser->getIncrementChoice(), myLaser->getIncrementChoicesMap()); if (myLaser->canChooseUnits()) laserAllowUnitsChoices(myLaser->getUnitsChoice(), myLaser->getUnitsChoices()); if (myLaser->canChooseReflectorBits()) laserAllowReflectorBitsChoices(myLaser->getReflectorBitsChoice(), myLaser->getReflectorBitsChoices()); if (canSetPowerControlled()) laserAllowSetPowerControlled(myLaser->getPowerControlled()); if (myLaser->canChooseStartingBaud()) laserAllowStartingBaudChoices(myLaser->getStartingBaudChoice(), myLaser->getStartingBaudChoices()); if (myLaser->canChooseAutoBaud()) laserAllowAutoBaudChoices(myLaser->getAutoBaudChoice(), myLaser->getAutoBaudChoices()); laserSetDefaultTcpPort(myLaser->getDefaultTcpPort()); laserSetDefaultPortType(myLaser->getDefaultPortType()); }
AREXPORT ArSZSeries::ArSZSeries(int laserNumber, const char *name) : ArLaser(laserNumber, name, 16382), mySensorInterpTask(this, &ArSZSeries::sensorInterp), myAriaExitCB(this, &ArSZSeries::disconnect) { //ArLog::log(ArLog::Normal, "%s: Sucessfully created", getName()); clear(); myRawReadings = new std::list<ArSensorReading *>; Aria::addExitCallback(&myAriaExitCB, -10); setInfoLogLevel(ArLog::Normal); //setInfoLogLevel(ArLog::Terse); laserSetName( getName()); laserAllowSetPowerControlled(false); laserSetDefaultPortType("serial422"); std::list < std::string > baudChoices; baudChoices.push_back("9600"); baudChoices.push_back("19200"); baudChoices.push_back("38400"); baudChoices.push_back("57600"); baudChoices.push_back("115200"); //baudChoices.push_back("125000"); baudChoices.push_back("230400"); baudChoices.push_back("460800"); //laserAllowStartingBaudChoices("9600", baudChoices); laserAllowStartingBaudChoices("38400", baudChoices); // PS 9/9/11 - don't allow auto baud for his laser //laserAllowAutoBaudChoices("57600", baudChoices); laserAllowSetDegrees(-135, -135, -135, 135, 135, 135); laserAllowSetIncrement(0.5, 0.5, 0.5); //myLogLevel = ArLog::Verbose; //myLogLevel = ArLog::Terse; myLogLevel = ArLog::Normal; setMinDistBetweenCurrent(0); setMaxDistToKeepCumulative(4000); setMinDistBetweenCumulative(200); setMaxSecondsToKeepCumulative(30); setMaxInsertDistCumulative(3000); setCumulativeCleanDist(75); setCumulativeCleanInterval(1000); setCumulativeCleanOffset(600); resetLastCumulativeCleanTime(); setCurrentDrawingData( //new ArDrawingData("polyDots", ArColor(255, 204, 153), 75, // mm diameter of dots new ArDrawingData("polyDots", ArColor(255,102,0), 75, // mm diameter of dots 76), // layer above sonar true); setCumulativeDrawingData( new ArDrawingData("polyDots", ArColor(255,153,0), 95, // mm diameter of dots 61), // layer below current range devices true); }