C++ naoqi框架如何处理RPC?
最近我正在学习nao机器人的naoqi框架。下面是如何在文档中访问自定义模块的示例。 ()C++ naoqi框架如何处理RPC?,c++,rpc,nao-robot,C++,Rpc,Nao Robot,最近我正在学习nao机器人的naoqi框架。下面是如何在文档中访问自定义模块的示例。 () #包括 #包括 #包括 int main(int argc,char*argv[]){ 如果(argc!=2) { 我建议你注册并直接在论坛上提问,在那里你会找到Naoqi开发者。Naoqi基于SOAP。。。 #include <iostream> #include <alerror/alerror.h> #include <alcommon/alproxy.h> i
#包括
#包括
#包括
int main(int argc,char*argv[]){
如果(argc!=2)
{
我建议你注册并直接在论坛上提问,在那里你会找到Naoqi开发者。Naoqi基于SOAP。。。
#include <iostream>
#include <alerror/alerror.h>
#include <alcommon/alproxy.h>
int main(int argc, char* argv[]) {
if(argc != 2)
{
std::cerr << "Wrong number of arguments!" << std::endl;
std::cerr << "Usage: testhelloworld NAO_IP" << std::endl;
exit(2);
}
const std::string robotIP = argv[1];
int port = 9559;
try {
boost::shared_ptr<AL::ALProxy> testProxy
= boost::shared_ptr<AL::ALProxy>(new AL::ALProxy("HelloWorld", robotIP, port));
/** Call the sayHello method from the module using its bound name.
* Since it returns nothing, use the callVoid method.
*/
testProxy->callVoid("sayHello");
testProxy->callVoid("sayText", std::string("This is a test."));
int sentenceLength = testProxy->call<int>("sayTextAndReturnLength",
std::string("This is another test"));
std::cout << "Sentence length is " << sentenceLength << std::endl;
}
catch (const AL::ALError& e) {
std::cerr << e.what() << std::endl;
}
}