当前位置: 首页>>代码示例>>C++>>正文


C++ ArSerialConnection::getBaud方法代码示例

本文整理汇总了C++中ArSerialConnection::getBaud方法的典型用法代码示例。如果您正苦于以下问题:C++ ArSerialConnection::getBaud方法的具体用法?C++ ArSerialConnection::getBaud怎么用?C++ ArSerialConnection::getBaud使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArSerialConnection的用法示例。


在下文中一共展示了ArSerialConnection::getBaud方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: params

AREXPORT bool ArUrg_2_0::setParamsBySteps(int startingStep, int endingStep, 
				      int clusterCount, bool flipped)
{
  if (startingStep > endingStep || clusterCount < 1)
  {
    ArLog::log(ArLog::Normal, 
	       "%s::setParamsBySteps: Bad params (starting %d ending %d clusterCount %d)",
	       getName(), startingStep, endingStep, clusterCount);
    return false;
  }

  if (startingStep < myAMin)
    startingStep = myAMin;
  if (endingStep > myAMax)
    endingStep = myAMax;

  myDataMutex.lock();
  myStartingStep = startingStep;
  myEndingStep = endingStep;
  myClusterCount = clusterCount;
  myFlipped = flipped;
  //sprintf(myRequestString, "G%03d%03d%02d", myStartingStep, endingStep,
  //clusterCount);

  int baudRate = 0;
  ArSerialConnection *serConn = NULL;
  serConn = dynamic_cast<ArSerialConnection *>(myConn);
  if (serConn != NULL)
    baudRate = serConn->getBaud();

  // only use the three data bytes if our range needs it, and if the baud rate can support it
  if (myMaxRange > 4095 && (baudRate == 0 || baudRate > 57600))
  {
    myUseThreeDataBytes = true;
    sprintf(myRequestString, "MD%04d%04d%02d%01d%02d", 
	    myStartingStep, myEndingStep, myClusterCount, 
	    0, // scan interval
	    0 // number of scans to send (forever)
	);
  }
  else
  {
    myUseThreeDataBytes = false;
    if (myMaxRange > 4094) 
      myMaxRange = 4094;
    sprintf(myRequestString, "MS%04d%04d%02d%01d%02d", 
	    myStartingStep, myEndingStep, myClusterCount, 
	    0, // scan interval
	    0 // number of scans to send (forever)
	);
  }

  myClusterMiddleAngle = 0;
  if (myClusterCount > 1)
    //myClusterMiddleAngle = myClusterCount * 0.3515625 / 2.0;
    myClusterMiddleAngle = myClusterCount * myStepSize / 2.0;

  if (myRawReadings != NULL)
  {
    ArUtil::deleteSet(myRawReadings->begin(), myRawReadings->end());
    myRawReadings->clear();
    delete myRawReadings;
    myRawReadings = NULL;
  }

  myRawReadings = new std::list<ArSensorReading *>;
  

  ArSensorReading *reading;
  int onStep;
  double angle;

  for (onStep = myStartingStep; 
       onStep < myEndingStep; 
       onStep += myClusterCount)
  {
    /// FLIPPED
    if (!myFlipped)
      //angle = ArMath::subAngle(ArMath::subAngle(135, 
      //                                          onStep * 0.3515625),
      angle = ArMath::subAngle(ArMath::subAngle(myStepFirst, 
						onStep * myStepSize),
			       myClusterMiddleAngle);
    else
      //angle = ArMath::addAngle(ArMath::addAngle(-135, 
      //                                          onStep * 0.3515625), 
      angle = ArMath::addAngle(ArMath::addAngle(-myStepFirst, 
						onStep * myStepSize), 
			       myClusterMiddleAngle);
			       
    reading = new ArSensorReading;
    reading->resetSensorPosition(ArMath::roundInt(mySensorPose.getX()),
				 ArMath::roundInt(mySensorPose.getY()),
				 ArMath::addAngle(angle, 
						  mySensorPose.getTh()));
    myRawReadings->push_back(reading);
    //printf("%.1f ", reading->getSensorTh());
  }


//.........这里部分代码省略.........
开发者ID:sendtooscar,项目名称:ariaClientDriver,代码行数:101,代码来源:ArUrg_2_0.cpp


注:本文中的ArSerialConnection::getBaud方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。