Ive looked at the API example on getting variables from roborealm but am having problems using these values once I have used the GetVariables function to get them. How do you save the array pointer results from getvariables into a char array so that you can use the values in c++. This is my funstion for getting values from Roborealm:
void Robovariables(char input[5][32])
{
//Initialises results pointer and a buffer resultBuffer to get variables from Roborealm
char resultsBuffer[300]=("");
char *variables[6];
variables[0]=resultsBuffer;
variables[1]=&resultsBuffer[32];
variables[2]=&resultsBuffer[64];
variables[3]=&resultsBuffer[98];
variables[4]=&resultsBuffer[128];
variables[5]=&resultsBuffer[192];
//Gets the Variable values from Roborealm using the Roborealm API
if (rr.getVariables("laser1, laser2, FACE_POSITION, turn_bias, COLOUR_COG_X, FACE_POSITION", variables,300, 6)!=6)
{
System::Windows::Forms::MessageBox::Show(L"Error Receiving variables from Roborealm",
L"RoboRealm Error", MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
exit(0);
}
else
{
int i;
int j;
//Loops through wariables 2d array pointer and allocates these values to the input pointer
for(i=0; i<6;i++)
{
for(j=0;j<32;j++)
{
input[i][j]=variables[i][j];
}
}
}
}
Am I doing this the best way? I know that this isnt the proper way to do this so what is? I looked at the API main.cpp to do this
|
|