本文整理汇总了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;
}
示例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);
}
示例3: space
void InputHandler::space(void)
{
ArNetPacket packet;
packet.doubleToBuf(0.00001);
myClient->requestOnce("setVel", &packet);
myClient->requestOnce("deltaHeading", &packet);
}
示例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);
}
示例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);
}
示例6: sendData
void sendData(ArServerClient* client, ArNetPacket*) {
ArNetPacket reply;
reply.doubleToBuf(findObject);
client->sendPacketUdp(&reply);
}
示例7: right
void InputHandler::right(void)
{
ArNetPacket packet;
packet.doubleToBuf(-3.2);
myClient->requestOnce("deltaHeading", &packet);
}
示例8: down
void InputHandler::down(void)
{
ArNetPacket packet;
packet.doubleToBuf(-25);
myClient->requestOnce("deltaVel", &packet);
}
示例9: on_btnStop_clicked
void MainWindow::on_btnStop_clicked()
{
ArNetPacket packet;
packet.doubleToBuf(0);
client->requestOnce("enable", &packet);
}