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; }
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); }
void InputHandler::space(void) { ArNetPacket packet; packet.doubleToBuf(0.00001); myClient->requestOnce("setVel", &packet); myClient->requestOnce("deltaHeading", &packet); }
void sendPoseRobot(ArServerClient* client, ArNetPacket* packet) { ArNetPacket reply; ArPose pose = gotoGoal.getPose(); reply.doubleToBuf(pose.getX()); reply.doubleToBuf(pose.getY()); client->sendPacketUdp(&reply); }
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); }
void sendData(ArServerClient* client, ArNetPacket*) { ArNetPacket reply; reply.doubleToBuf(findObject); client->sendPacketUdp(&reply); }
void InputHandler::right(void) { ArNetPacket packet; packet.doubleToBuf(-3.2); myClient->requestOnce("deltaHeading", &packet); }
void InputHandler::down(void) { ArNetPacket packet; packet.doubleToBuf(-25); myClient->requestOnce("deltaVel", &packet); }
void MainWindow::on_btnStop_clicked() { ArNetPacket packet; packet.doubleToBuf(0); client->requestOnce("enable", &packet); }