AREXPORT ArLaserReflectorDevice::ArLaserReflectorDevice(ArRangeDevice *laser,
							ArRobot *robot,
							const char *name) :
  /*
  ArRangeDevice(laser->getCurrentRangeBuffer()->getSize(), 
		laser->getCumulativeRangeBuffer()->getSize(), name,
		laser->getMaxRange()), */
  // MPL 12/11/12 this is how it was... but the part I'm putting in was above commented out, so this may go wrong
  //ArRangeDevice(361, 361, name, 32000),
  ArRangeDevice(laser->getCurrentRangeBuffer()->getSize(), 
		laser->getCumulativeRangeBuffer()->getSize(), name,
		laser->getMaxRange()), 
  myProcessCB(this, &ArLaserReflectorDevice::processReadings)
{
  myLaser = laser;
  myRobot = robot;
  if (myRobot != NULL)
    myRobot->addSensorInterpTask(myName.c_str(), 10, &myProcessCB);
  setCurrentDrawingData(new ArDrawingData("polyDots", 
                                          ArColor(0xb0, 0xb0, 0xff), 
                                          60,  // mm length of arrow
                                          77,  // above the normal laser
					  200, // default refresh
					  "DefaultOff"), // defaults to off but can be turned on
			true);
  myReflectanceThreshold = 31;
}
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;
}
Example #3
0
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);

}
Example #4
0
AREXPORT ArIRs::ArIRs(size_t currentBufferSize, size_t cumulativeBufferSize,
                      const char *name, int maxSecondsToKeepCurrent) :
    ArRangeDevice(currentBufferSize, cumulativeBufferSize, name, 5000, maxSecondsToKeepCurrent),
    myProcessCB(this, &ArIRs::processReadings)
{
    setCurrentDrawingData(new ArDrawingData("polyArrows", ArColor(255, 255, 0),
                                            120, // mm diameter of dots
                                            80), // layer above sick and sonar below bumpers
                          true);
}
Example #5
0
AREXPORT ArBumpers::ArBumpers(size_t currentBufferSize, size_t cumulativeBufferSize, 
		     const char *name, int maxSecondsToKeepCurrent, double angleRange) :
  ArRangeDevice(currentBufferSize, cumulativeBufferSize, name, 5000, maxSecondsToKeepCurrent), 
  myProcessCB(this, &ArBumpers::processReadings)
{
  myBumpMask = (ArUtil::BIT1 | ArUtil::BIT2 | ArUtil::BIT3 | ArUtil::BIT4 | 
		ArUtil::BIT5 | ArUtil::BIT6 | ArUtil::BIT7 | ArUtil::BIT8); 

  myAngleRange = angleRange;

  setCurrentDrawingData(new ArDrawingData("polyDots", ArColor(0, 0, 0),
					  120, // mm diameter of dots
					  83), // layer above most everything else
			true);
}
AREXPORT ArSonarDevice::ArSonarDevice(size_t currentBufferSize,
			     size_t cumulativeBufferSize, const char *name) :
  ArRangeDevice(currentBufferSize, cumulativeBufferSize, name, 5000), 
  myProcessCB(this, &ArSonarDevice::processReadings)
{
  setMaxDistToKeepCumulative(3000); 
  myFilterNearDist = 50;	// 50 mm between cumulative readings, at least
  myFilterFarDist = 3000;       // throw out cumulative readings this far
                                // from robot
  setMaxSecondsToKeepCurrent(5);
  setMaxSecondsToKeepCumulative(15);
  setCurrentDrawingData(new ArDrawingData("polyArrows", 
                                          ArColor(0x33, 0xCC, 0xFF), 
                                          200,  // mm length of arrow
                                          70),  // first sensor layer
                        true);
}
Example #7
0
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());


}
Example #8
0
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);

}