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;
}
Ejemplo n.º 2
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);

}
Ejemplo n.º 3
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());


}
Ejemplo n.º 4
0
AREXPORT ArLaser::ArLaser(
	int laserNumber, const char *name, 
	unsigned int absoluteMaxRange, bool locationDependent, 
	bool appendLaserNumberToName) :
  ArRangeDeviceThreaded(
	  361, 200, name, absoluteMaxRange,
	  0, 0, 0, locationDependent)
{
  myLaserNumber = laserNumber;

  if (appendLaserNumberToName)
  {
    char buf[1024];
    snprintf(buf, sizeof(buf) - 20, "%s", name);
    sprintf(buf, "%s_%d", buf, myLaserNumber);
    myName = buf;
  }
  else
  {
    if (laserNumber != 1)
      ArLog::log(ArLog::Verbose, "ArLaser::%s: Laser created with number %d, but the number is not appended to the name which may break things (especially since this number is greater than 1_", name, laserNumber);

    myName = name;
  }


  laserSetName(myName.c_str());

  myAbsoluteMaxRange = absoluteMaxRange;
  myMaxRangeSet = false;

  setSensorPosition(0, 0, 0, 0);
  myTimeoutSeconds = 8;

  myHaveSensorPose = false;

  myFlipped = false;
  myFlippedSet = false;

  myCanSetDegrees = false;
  myStartDegreesMin = HUGE_VAL;
  myStartDegreesMax = -HUGE_VAL;
  myStartDegreesSet = false;
  myStartDegrees = 0;
  myEndDegreesMin = HUGE_VAL;
  myEndDegreesMax = -HUGE_VAL;
  myEndDegreesSet = false;
  myEndDegrees = 0;

  myCanChooseDegrees = false;
  myDegreesChoiceDouble = -HUGE_VAL;

  myCanSetIncrement = 0;
  myIncrementMin = HUGE_VAL; 
  myIncrementMax = -HUGE_VAL; 
  myIncrementSet = false;
  myIncrement = 0;

  myCanChooseIncrement = false; 
  myIncrementChoiceDouble = -HUGE_VAL;

  myCanChooseUnits = false;

  myCanChooseReflectorBits = false;

  myCanSetPowerControlled = false;
  myPowerControlled = true;
  myPowerControlledSet = false;

  myCanChooseStartingBaud = false;

  myCanChooseAutoBaud = false;
  
  myDefaultTcpPort = 8102;

  myInfoLogLevel = ArLog::Verbose;
  myRobotRunningAndConnected = false;
}
Ejemplo n.º 5
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);

}