|
Roborealm API problem reading COG_X and COG_Y robot guy from India [3 posts] |
15 year
|
Hi,
I am using the roborealm API in VC++6.I am not able to read COG_X and COG_Y variables continuously or even once using VC++.
Pseudo code:
rr.run("on");
rr.loadprogram("redobj.robo)";
printf("%c",rr.getVariable("COG_X",buffer,64));
I am not able to read and Print COG_X nor able to use it.Also the following way of using getVariable func is giving an error:
printf("%c",rr.getVariable("COG_X"));
Please help me out.My project deadline is approaching.Thanks in advance.
|
|
|
Anonymous |
15 year
|
Have you tried the main.cpp in the provided API.zip example? You appear to have some strange things going on in your code ... which should include an initial connection like:
int main(int argc, char *argv[])
{
char buffer[64];
RR_API rr;
rr.open("c:\\www\\RoboRealm\\bin\\RoboRealm.exe", 6060);
if (!rr.connect("localhost", 6060))
{
exit(0);
}
rr.loadProgram("c:\\what\\is\\your\\path\\redobj.robo)";
rr.getVariable("COG_X",buffer,64); // buffer contains results as a string
printf("%s",buffer);
// if you want an int then use int x = atoi(buffer);
rr.close();
}
STeven.
|
|