本文整理汇总了C++中ArServerBase::open方法的典型用法代码示例。如果您正苦于以下问题:C++ ArServerBase::open方法的具体用法?C++ ArServerBase::open怎么用?C++ ArServerBase::open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArServerBase
的用法示例。
在下文中一共展示了ArServerBase::open方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
Aria::init();
ArGlobalFunctor2<ArServerClient *, ArNetPacket *> testCB(&testFunction);
ArServerBase server;
//ArLog::init(ArLog::StdOut, ArLog::Verbose);
ArNetPacket packet;
server.addData("test", "some wierd test", &testCB, "none", "none");
server.addData("test2", "another wierd test", &testCB, "none", "none");
server.addData("test3", "yet another wierd test", &testCB, "none", "none");
if (!server.open(7273))
{
printf("Could not open server port\n");
exit(1);
}
server.runAsync();
while (server.getRunningWithLock())
{
ArUtil::sleep(1000);
server.broadcastPacketTcp(&packet, "test3");
}
Aria::shutdown();
return 0;
}
示例2: main
int main(int argc, char **argv)
{
Aria::init();
ArServerBase server;
//ArLog::init(ArLog::StdOut, ArLog::Verbose);
ArConfig *config;
config = Aria::getConfig();
ArRobotP3DX dx;
//dx.writeFile("dx.txt");
*Aria::getConfig() = dx;
//Aria::getConfig()->writeFile("dxcopy.txt");
if (!server.open(7272))
{
printf("Could not open server port\n");
exit(1);
}
ArServerHandlerConfig configHandler(&server, Aria::getConfig());
server.run();
Aria::shutdown();
return 0;
}
示例3: main
int main(int argc, char **argv)
{
Aria::init();
ArServerBase server;
ArConfig *config;
config = Aria::getConfig();
std::string section;
char joy[512];
sprintf(joy, "Joy");
section = "section1";
config->addParam(ArConfigArg("int", new int, "fun int", 0), section.c_str(), ArPriority::NORMAL);
config->addParam(ArConfigArg("double", new double, "fun double", 0, 1), section.c_str(), ArPriority::NORMAL);
config->addParam(ArConfigArg("bool", new bool, "fun bool"), section.c_str(), ArPriority::IMPORTANT);
config->addParam(ArConfigArg("string", joy, "fun string", sizeof(joy)), section.c_str(), ArPriority::TRIVIAL);
section = "section8";
config->addParam(ArConfigArg("int", new int, "fun int", 0), section.c_str(), ArPriority::NORMAL);
config->addParam(ArConfigArg("double", new double, "fun double", 0, 1), section.c_str(), ArPriority::NORMAL);
config->addParam(ArConfigArg("doubleFOUR", (double).4, "fun double", 0.0, 1.0), section.c_str(), ArPriority::NORMAL);
config->addParam(ArConfigArg("double three", new double, "fun double", 0, 1), section.c_str(), ArPriority::NORMAL);
config->addParam(ArConfigArg("double two", new double, "fun double", 0, 1), section.c_str(), ArPriority::NORMAL);
config->addParam(ArConfigArg("double one", new double, "fun double", 0, 1), section.c_str(), ArPriority::NORMAL);
config->addParam(ArConfigArg("double", new double, "fun double", 0, 1), section.c_str(), ArPriority::NORMAL);
config->addParam(ArConfigArg("bool", new bool, "fun bool"), section.c_str(), ArPriority::IMPORTANT);
config->addParam(ArConfigArg("string", joy, "fun string", sizeof(joy)), section.c_str(), ArPriority::TRIVIAL);
section = "some section";
config->setSectionComment("some section", "this is a random section with 4 ints");
config->addParam(ArConfigArg("int1", new int, "fun int"), section.c_str(), ArPriority::TRIVIAL);
config->addParam(ArConfigArg("int2", new int, "fun int", -1, 1200), section.c_str(), ArPriority::NORMAL);
config->addParam(ArConfigArg("int3", new int, "fun int"), section.c_str(), ArPriority::IMPORTANT);
config->addParam(ArConfigArg("int4", new int, "fun int"), section.c_str(), ArPriority::NORMAL);
config->addParam(ArConfigArg("int4", new int, "fun int"), section.c_str(), ArPriority::NORMAL);
config->addParam(ArConfigArg("int1", new int, "fun int"), section.c_str(), ArPriority::TRIVIAL);
section = "another section";
config->setSectionComment("another section", "this is another section with 1 of each type");
config->addParam(ArConfigArg("inta", new int, "fun int"), section.c_str(), ArPriority::NORMAL);
config->addParam(ArConfigArg("doublea", new double, "fun double"), section.c_str(), ArPriority::NORMAL);
config->addParam(ArConfigArg("boola", new bool, "fun bool"), section.c_str(), ArPriority::NORMAL);
config->addParam(ArConfigArg("stringa", new char[512], "fun string", 512), section.c_str(), ArPriority::NORMAL);
if (!server.open(7272))
{
printf("Could not open server port\n");
exit(1);
}
config->setBaseDirectory("./");
config->writeFile("default.txt");
config->parseFile("modified.txt");
config->writeFile("modifiedModified.txt");
ArServerHandlerConfig configHandler(&server, Aria::getConfig(),
"default.txt");
server.run();
Aria::shutdown();
return 0;
}
示例4: main
int main(int argc, char **argv)
{
Aria::init();
ArServerBase robotServer;
if (!robotServer.open(5000))
{
printf("Could not open robot server port\n");
Aria::exit(1);
}
ArServerBase clientServer;
if (!clientServer.open(7272))
{
printf("Could not open robot server port\n");
Aria::exit(1);
}
ArCentralManager switchManager(&robotServer, &clientServer);
switchManager.addForwarderAddedCallback(
new ArGlobalFunctor1<ArCentralForwarder *>(&forwarderAdded),
100);
switchManager.addForwarderRemovedCallback(
new ArGlobalFunctor1<ArCentralForwarder *>(&forwarderRemoved),
100);
// Start a small handler to monitor communication between the server and
// client.
ArServerHandlerCommMonitor commMonitor(&clientServer);
ArServerHandlerCommands commands(&clientServer);
commands.setPrefix("CentralServer");
ArServerSimpleServerCommands serverCommands(&commands, &clientServer,
false);
commands.addCommand(
"NetworkLogConnections", "Logs the connections to the central server, and to all the forwarded connections",
new ArFunctorC<ArCentralManager>
(&switchManager, &ArCentralManager::logConnections));
clientServer.runAsync();
robotServer.run();
Aria::exit(0);
}
示例5: main
int main(int argc, char **argv)
{
Aria::init();
ArServerBase server;
if (!server.open(7272))
{
printf("Could not open server port\n");
exit(1);
}
server.run();
return 0;
}
示例6: main
int main(int argc, char **argv)
{
Aria::init();
ArServerBase server;
if (!server.open(7272))
{
printf("Could not open server port\n");
exit(1);
}
ArServerFileLister fileLister(&server, ".");
ArServerFileToClient fileToClient(&server, ".");
ArServerFileFromClient fileFromClient(&server, ".", "/tmp");
ArServerDeleteFileOnServer fileDeleter(&server, ".");
server.run();
}
示例7: main
int main(int argc, char **argv)
{
Aria::init();
ArServerBase server;
ArGlobalFunctor2<ArServerClient *, ArNetPacket *> sendEmptyCB(&sendEmpty);
if (!server.open(7272))
{
printf("Could not open server port\n");
exit(1);
}
ArServerInfoDrawings drawing(&server);
ArDrawingData arrows("polyarrow", ArColor(0, 0, 255), 5, 50);
ArDrawingData dots("polydots", ArColor(0, 255, 0), 12, 50);
drawing.addDrawing(&arrows, "arrows", &sendEmptyCB);
drawing.addDrawing(&dots, "dots", &sendEmptyCB);
server.run();
}
示例8: main
int main(int argc, char **argv)
{
Aria::init();
//ArLog::init(ArLog::StdOut, ArLog::Verbose);
// robot
ArRobot robot;
/// our server
ArServerBase server;
// set up our parser
ArArgumentParser parser(&argc, argv);
// set up our simple connector
ArSimpleConnector simpleConnector(&parser);
// set up a gyro
ArAnalogGyro gyro(&robot);
// load the default arguments
parser.loadDefaultArguments();
// parse the command line... fail and print the help if the parsing fails
// or if the help was requested
if (!simpleConnector.parseArgs() || !parser.checkHelpAndWarnUnparsed())
{
simpleConnector.logOptions();
exit(1);
}
if (!server.loadUserInfo("userServerTest.userInfo"))
{
printf("Could not load user info, exiting\n");
exit(1);
}
server.logUsers();
// first open the server up
if (!server.open(7272))
{
printf("Could not open server port\n");
exit(1);
}
// sonar, must be added to the robot
ArSonarDevice sonarDev;
// add the sonar to the robot
robot.addRangeDevice(&sonarDev);
ArIRs irs;
robot.addRangeDevice(&irs);
ArBumpers bumpers;
robot.addRangeDevice(&bumpers);
// a laser in case one is used
ArSick sick(361, 180);
// add the laser to the robot
robot.addRangeDevice(&sick);
// attach stuff to the server
ArServerInfoRobot serverInfoRobot(&server, &robot);
ArServerInfoSensor serverInfoSensor(&server, &robot);
ArServerInfoDrawings drawings(&server);
drawings.addRobotsRangeDevices(&robot);
// ways of moving the robot
ArServerModeStop modeStop(&server, &robot);
ArServerModeDrive modeDrive(&server, &robot);
ArServerModeRatioDrive modeRatioDrive(&server, &robot);
ArServerModeWander modeWander(&server, &robot);
modeStop.addAsDefaultMode();
modeStop.activate();
// set up the simple commands
ArServerHandlerCommands commands(&server);
// add the commands for the microcontroller
ArServerSimpleComUC uCCommands(&commands, &robot);
// add the commands for logging
ArServerSimpleComMovementLogging loggingCommands(&commands, &robot);
// add the commands for the gyro
ArServerSimpleComGyro gyroCommands(&commands, &robot, &gyro);
// add the commands to enable and disable safe driving to the simple commands
modeDrive.addControlCommands(&commands);
// Forward any video if we have some to forward.. this will forward
// from SAV or ACTS, you can find both on our website
// http://robots.activmedia.com, ACTS is for color tracking and is
// charged for but SAV just does software A/V transmitting and is
// free to all our customers... just run ACTS or SAV before you
// start this program and this class here will forward video from it
// to MobileEyes
ArHybridForwarderVideo videoForwarder(&server, "localhost", 7070);
// make a camera to use in case we have video
ArPTZ *camera = NULL;
ArServerHandlerCamera *handlerCamera = NULL;
//.........这里部分代码省略.........
示例9: sick
int
main(int argc, char *argv[])
{
// Initialize location of Aria, Arnl and their args.
Aria::init();
Arnl::init();
// The robot object
ArRobot robot;
#ifndef SONARNL
// The laser object
ArSick sick(181, 361);
#endif
// Parse them command line arguments.
ArArgumentParser parser(&argc, argv);
// Set up our simpleConnector
ArSimpleConnector simpleConnector(&parser);
// Load default arguments for this computer
parser.loadDefaultArguments();
// Parse its arguments for the simple connector.
simpleConnector.parseArgs();
// sonar, must be added to the robot, for teleop and wander
ArSonarDevice sonarDev;
// add the sonar to the robot
robot.addRangeDevice(&sonarDev);
ArMap arMap;
#ifndef SONARNL
// Initialize the localization
ArLocalizationTask locTask(&robot, &sick, &arMap);
// Make the path task
ArPathPlanningTask pathTask(&robot, &sick, &sonarDev, &arMap);
#else
// Initialize the localization
ArSonarLocalizationTask locTask(&robot, &sonarDev, &arMap);
// Make the path task
ArPathPlanningTask pathTask(&robot, NULL, &sonarDev, &arMap);
#endif
// Stop the robot as soon as localization fails.
ArFunctor1C<ArPathPlanningTask, int>
locaFailed(&pathTask, &ArPathPlanningTask::trackingFailed);
locTask.addFailedLocalizationCB(&locaFailed);
// Read in param files.
Aria::getConfig()->useArgumentParser(&parser);
if (!Aria::getConfig()->parseFile(Arnl::getTypicalParamFileName()))
{
printf("Trouble loading configuration file, exiting\n");
exit(1);
}
// Warn about unknown params.
if (!parser.checkHelpAndWarnUnparsed())
{
printf("\nUsage: %s -map mapfilename\n\n", argv[0]);
simpleConnector.logOptions();
exit(2);
}
// Our server
ArServerBase server;
// First open the server up
if (!server.open(7272))
{
printf("Could not open server port\n");
exit(1);
}
// Connect the robot
if (!simpleConnector.connectRobot(&robot))
{
printf("Could not connect to robot... exiting\n");
Aria::shutdown();
return 1;
}
robot.com2Bytes(31, 14, 0);
robot.com2Bytes(31, 15, 0);
ArUtil::sleep(100);
robot.com2Bytes(31, 14, 1);
robot.com2Bytes(31, 15, 1);
robot.enableMotors();
robot.clearDirectMotion();
#ifndef SONARNL
// Set up the laser before handing it to the laser mode
simpleConnector.setupLaser(&sick);
// Add the laser to the robot
robot.addRangeDevice(&sick);
#endif
// Start the robot thread.
//.........这里部分代码省略.........