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


C++ ArNetPacket::doubleToBuf方法代码示例

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


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

示例1: sendInput

void AriaClientDriver::sendInput()
{
  /* This method is called by the main function to send a ratioDrive
   * request with our current velocity values. If the server does
   * not support the ratioDrive request, then we abort now: */
  if(!myClient->dataExists("ratioDrive")) return;

  /* Construct a ratioDrive request packet.  It consists
   * of three doubles: translation ratio, rotation ratio, and an overall scaling
   * factor. */



  ArNetPacket packet;
  packet.doubleToBuf(myTransRatio);
  packet.doubleToBuf(myRotRatio);
  packet.doubleToBuf(myMaxVel); // use half of the robot's maximum.
  packet.doubleToBuf(myLatRatio);
  if (myPrinting)
    printf("Sending\n");
  myClient->requestOnce("ratioDrive", &packet);
  myTransRatio = 0;
  myRotRatio = 0;
  myLatRatio = 0;
}
开发者ID:sendtooscar,项目名称:ariaClientDriver,代码行数:25,代码来源:ariaClientDriversim.cpp

示例2: batteryInfo

AREXPORT void ArServerInfoRobot::batteryInfo(ArServerClient *client, 
					     ArNetPacket *packet)
{
  ArNetPacket sending;

  myRobot->lock();
  if (myRobot->haveStateOfCharge())
  {
    // this is a temporary workaround since the config packet reader
    // in this aria doesn't get these values from the firmware
    if (myRobot->getStateOfChargeLow() <= 0 && 
	myRobot->getStateOfChargeShutdown() <= 0)
    {
      sending.doubleToBuf(20);
      sending.doubleToBuf(3);
    }
    else
    {
      sending.doubleToBuf(myRobot->getStateOfChargeLow());
      sending.doubleToBuf(myRobot->getStateOfChargeShutdown());
    }
    // voltage is really state of charge
    sending.uByteToBuf(1);
  }
  else
  {
    const ArRobotConfigPacketReader *reader;
    reader = myRobot->getOrigRobotConfig();
    if (reader != NULL && reader->hasPacketArrived())
    {
      if (reader->getLowBattery() != 0)
	sending.doubleToBuf(reader->getLowBattery() * .1);
      else
	sending.doubleToBuf(11.5);
      if (reader->getShutdownVoltage() != 0)
	sending.doubleToBuf(reader->getShutdownVoltage() * .1);
      else
	sending.doubleToBuf(11);
    }
    else
    {
      sending.doubleToBuf(11.5);
      sending.doubleToBuf(11);
    }
    // voltage is voltage, not state of charge
    sending.uByteToBuf(0);
  }
  
  myRobot->unlock();
  client->sendPacketTcp(&sending);

}
开发者ID:sanyaade-research-hub,项目名称:aria,代码行数:52,代码来源:ArServerInfoRobot.cpp

示例3: space

void InputHandler::space(void)
{
  ArNetPacket packet;
  packet.doubleToBuf(0.00001);
  myClient->requestOnce("setVel", &packet);
  myClient->requestOnce("deltaHeading", &packet);
}
开发者ID:sendtooscar,项目名称:ariaClientDriver,代码行数:7,代码来源:standaloneClientDemo.cpp

示例4: sendPoseRobot

void sendPoseRobot(ArServerClient* client, ArNetPacket* packet) {
	ArNetPacket reply;
	ArPose pose = gotoGoal.getPose();
	reply.doubleToBuf(pose.getX());
	reply.doubleToBuf(pose.getY());
    client->sendPacketUdp(&reply);
}
开发者ID:quoioln,项目名称:my-thesis,代码行数:7,代码来源:Tracking7.cpp

示例5: batteryInfo

AREXPORT void ArServerInfoRobot::batteryInfo(ArServerClient *client, 
					     ArNetPacket *packet)
{
  ArNetPacket sending;

  myRobot->lock();
  if (myRobot->haveStateOfCharge())
  {
    sending.doubleToBuf(myRobot->getStateOfChargeLow());
    sending.doubleToBuf(myRobot->getStateOfChargeShutdown());
    // voltage is really state of charge
    sending.uByteToBuf(1);
  }
  else
  {
    const ArRobotConfigPacketReader *reader;
    reader = myRobot->getOrigRobotConfig();
    if (reader != NULL && reader->hasPacketArrived())
    {
      if (reader->getLowBattery() != 0)
	sending.doubleToBuf(reader->getLowBattery() * .1);
      else
	sending.doubleToBuf(11.5);
      if (reader->getShutdownVoltage() != 0)
	sending.doubleToBuf(reader->getShutdownVoltage() * .1);
      else
	sending.doubleToBuf(11);
    }
    else
    {
      sending.doubleToBuf(11.5);
      sending.doubleToBuf(11);
    }
    // voltage is voltage, not state of charge
    sending.uByteToBuf(0);
  }
  
  myRobot->unlock();
  client->sendPacketTcp(&sending);

}
开发者ID:PipFall2015,项目名称:Ottos-Cloud,代码行数:41,代码来源:ArServerInfoRobot.cpp

示例6: sendData

void sendData(ArServerClient* client, ArNetPacket*) {
	ArNetPacket reply;
	reply.doubleToBuf(findObject);
    client->sendPacketUdp(&reply);
}
开发者ID:quoioln,项目名称:my-thesis,代码行数:5,代码来源:Tracking7.cpp

示例7: right

void InputHandler::right(void)
{
  ArNetPacket packet;
  packet.doubleToBuf(-3.2);
  myClient->requestOnce("deltaHeading", &packet);
}
开发者ID:sendtooscar,项目名称:ariaClientDriver,代码行数:6,代码来源:standaloneClientDemo.cpp

示例8: down

void InputHandler::down(void)
{
  ArNetPacket packet;
  packet.doubleToBuf(-25);
  myClient->requestOnce("deltaVel", &packet);
}
开发者ID:sendtooscar,项目名称:ariaClientDriver,代码行数:6,代码来源:standaloneClientDemo.cpp

示例9: on_btnStop_clicked

void MainWindow::on_btnStop_clicked()
{
    ArNetPacket packet;
    packet.doubleToBuf(0);
    client->requestOnce("enable", &packet);
}
开发者ID:quoioln,项目名称:my-thesis,代码行数:6,代码来源:mainwindow.cpp


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