本文整理汇总了C++中aris::core::MSG::GetLength方法的典型用法代码示例。如果您正苦于以下问题:C++ MSG::GetLength方法的具体用法?C++ MSG::GetLength怎么用?C++ MSG::GetLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aris::core::MSG
的用法示例。
在下文中一共展示了MSG::GetLength方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: On_VS_DataReceived
int On_VS_DataReceived(Aris::Core::CONN *pConn, Aris::Core::MSG &data)
{
cout<<"receive data from visual system"<<endl;
double *map = new double [data.GetLength()/sizeof(double)];
memcpy(map, data.GetDataAddress(), data.GetLength() );
static double currentH[6],nextH[6];
memcpy(nextH,map,sizeof(nextH));
HexIII.MotionPlanWithKinect(currentH,nextH,*Gait_Calculated_From_Map);
memcpy(currentH,nextH,sizeof(nextH));
delete[] map;
for(int j=0;j<GAIT_ADAPTIVEWALK_LEN;j++)
{
for(int i=0;i<GAIT_WIDTH;i++)
{
CGait::GaitAdaptiveWalk[j][i]=-(int)(Gait_Calculated_From_Map[j][i]);
}
}
Aris::Core::MSG controldata;
controldata.SetMsgID(WALKADAPTIVE);
cs.NRT_PostMsg(controldata);
return 0;
}
示例2: show
int show(const Aris::Core::MSG &msg)
{
cout << "Msg Length:" << msg.GetLength()<<endl;
cout << "Msg MsgID :" << msg.GetMsgID()<<endl;
//cout << "Msg Type :" << msg.GetType()<<endl;
cout << "Msg Data :" << msg.GetDataAddress()<<endl<<endl;
return 0;
}
示例3:
int Aris::RT_CONTROL::ACTUATION::NRT_PostMsg(Aris::Core::MSG &p_data)
{
int ret;
//printf("sizeof %d\n",sizeof(p_data));
//p_data.SetMsgID((int)Aris::RT_CONTROL::CM_CUS_MESSAGE);
ret=sysBase->NRT_SendDataRaw(p_data._pData,p_data.GetLength()+MSG_HEADER_LENGTH);
//printf("NRT_SendData is me :%d\n",ret);
return 0;
}//ok
示例4: OnVisualSystemDataNeeded
int OnVisualSystemDataNeeded(Aris::Core::MSG &msg)
{
static int i = 0;
cout<<"Capture "<<i<<" begin!!!"<<endl;
visionsensor.capture(&i);
while(1)
{
if(i>40)
{
Kinect::ControlCommand = NoValidCommand;
Aris::Core::MSG data;
data.SetLength(1 * sizeof(int));
memset(data.GetDataAddress(), 0, data.GetLength());
data.Copy(&Kinect::ControlCommand, sizeof(i));
pVisualSystem->SendData(data);
break;
}
else
{
if(Kinect::IsCaptureEnd == true)
{
Kinect::IsCaptureEnd = false;
Aris::Core::MSG data;
data.SetLength(1 * sizeof(int));
memset(data.GetDataAddress(), 0, data.GetLength());
data.Copy(&Kinect::ControlCommand, sizeof(i));
pVisualSystem->SendData(data);
break;
}
}
}
return 0;
}
示例5: On_CS_DataReceived
int On_CS_DataReceived(Aris::Core::CONN *pConn, Aris::Core::MSG &data)
{
int cmd_id=data.GetMsgID();
Aris::Core::MSG CMD;
CMD.SetMsgID(CS_CMD_Received);
CMD.SetLength(sizeof(int));
CMD.Copy(&cmd_id,sizeof(int));
// if the cmd has data, it should be repost together
CMD.CopyMore(data.GetDataAddress(), data.GetLength());
cout<<"received CMD is "<<cmd_id<<endl;
PostMsg(CMD);
return 0;
}
示例6: SendRequest
int SendRequest(int argc, char *argv[], const char *xmlFileName)
{
/*需要去除命令名的路径和扩展名*/
std::string cmdName(argv[0]);
#ifdef PLATFORM_IS_WINDOWS
if (cmdName.rfind('\\'))
{
cmdName = cmdName.substr(cmdName.rfind('\\') + 1, cmdName.npos);
}
#endif
#ifdef PLATFORM_IS_LINUX
if (cmdName.rfind('/'))
{
cmdName = cmdName.substr(cmdName.rfind('/') + 1, cmdName.npos);
}
#endif
if (cmdName.rfind('.'))
{
cmdName = cmdName.substr(0, cmdName.rfind('.'));
}
/*添加命令的所有参数*/
for (int i = 1; i < argc; ++i)
{
cmdName = cmdName + " " + argv[i];
}
/*构造msg,这里需要先copy命令名称,然后依次copy各个参数*/
Aris::Core::MSG msg;
msg.Copy(cmdName.c_str());
/*连接并发送msg*/
Aris::Core::DOCUMENT doc;
if (doc.LoadFile(xmlFileName) != 0)
throw std::logic_error("failed to read configuration xml file");
std::string ip = doc.RootElement()->FirstChildElement("Server")->FirstChildElement("Connection")->Attribute("IP");
std::string port = doc.RootElement()->FirstChildElement("Server")->FirstChildElement("Connection")->Attribute("Port");
Aris::Core::CONN conn;
while (true)
{
try
{
conn.Connect(ip.c_str(), port.c_str());
break;
}
catch (std::exception &)
{
std::cout << "failed to connect server, will retry in 1 second" << std::endl;
Aris::Core::Sleep(1000);
}
}
Aris::Core::MSG ret = conn.SendRequest(msg);
/*错误处理*/
if (ret.GetLength() > 0)
{
std::cout << "cmd has fault, please regard to following information:" << std::endl;
std::cout << " " << ret.GetDataAddress() << std::endl;
}
else
{
std::cout << "send command successful" << std::endl;
}
return 0;
}
示例7: On_VS_DataReceived
int On_VS_DataReceived(Aris::Core::CONN *pConn, Aris::Core::MSG &data)
{
cout<<"Calibration Singnal Recieved"<<endl;
int num;
memcpy(&num,data.GetDataAddress(),data.GetLength());
//stop num >= 54
if (num >= 62 )
{
cout<<"Calibration finished"<<endl;
CGait::IsAutoCalibrateRegistered = false;
}
else
{
ifstream inf;
stringstream filenum;
string filename;
filenum<<(num-1);
filename = "./calibration_txt/"+filenum.str() + "F.txt";
inf.open(filename);
int Line_Num;
double temp;
for(int i=0;i<GAIT_AUTOCALIB_LEN/2;i++)
{
inf>>Line_Num;
for(int j=0;j<GAIT_WIDTH;j++)
{
inf>>temp;
CGait::GaitAutoCalib[i][j]=-(int)temp;
}
}
inf.close();
filenum.str("");
filename.clear();
filenum<<num;
filename = "./calibration_txt/"+filenum.str()+".txt";
inf.open(filename);
for(int i=GAIT_AUTOCALIB_LEN/2;i<GAIT_AUTOCALIB_LEN;i++)
{
inf>>Line_Num;
for(int j=0;j<GAIT_WIDTH;j++)
{
inf>>temp;
CGait::GaitAutoCalib[i][j]=-(int)temp;
}
}
inf.close();
cout<<"Calibration "<<num<<" begin"<<endl;
cout<<CGait::GaitAutoCalib[3999][0]<<endl;
EGAIT cmd=GAIT_AUTO_CALIBRATION;
Aris::Core::MSG data;
data.SetLength(sizeof(cmd));
data.Copy(&cmd,sizeof(cmd));
cout<<"Send Message to CS"<<endl;
cs.NRT_SendData(data);
}
return 0;
}