Anonymous  [29 posts]
10 years
hello....i want to ask something that i'm not very clear,
i want to do another GUI interface using VC++. it will use as like a platform to communicate to microcontroller. for that i had prepare many module(robo file) from RR like detect obstacle, follow line, follow moving thing, etc.
the using is for the microcontroller want to choose the task from the module at certain time and it can change to another task. for example, current task is do the line following and the next task detect the object. is it correct to use the API..

any opinion or suggestion...TQ
Anonymous 10 years

Yes, you can use the API to do this. There are several ways to do it. The easiest would be to have all the module you want to run in RoboRealm at the same time BUT you would surround them with the IF_Statement module like:

if variable="task1" then
if variable="task2" then

and just use the SetVariable call in the API to change the value of the variable in RoboRealm that tells which modules to run. This will allow for very rapid switching between the module sets without reloading any robofiles and also makes for changing the robofile much easier.

Does that help?

Anonymous  [29 posts] 10 years
thanks for the info steven...

actually i dont know where to start..... i had gone through the documentation of API and also the example...but i'm just like blur....can anybody help me..make me clear.. =)
Anonymous 10 years
What language are you most comfortable with? C++, C#, Java, etc??

Anonymous  [29 posts] 10 years
Anonymous 10 years

First setup you robofile to have those if statements using some variable of your choice. Lets call that variable "task". So you robofile would look something like

if task="1" then
... modules to do task #1
if task="2" then
... modules to do task #2

etc. using the IF_STATEMENT module to surround/encapsulate other modules.

Then download the API (which you probably have already done so), load up Visual studio and access the c++/MS visual Studio/API example in the API. If you check the main.cpp file it is basically a lot of comments. Instead of using that version use the following to quickly change the value of that "task" variable. This assumes RR is already running.

int main(int argc, char *argv[])
    RR_API rr;

    if (!rr.connect(SERVER, PORTNUM))
        printf("RoboRealm does not appear to be running.");

    rr.setVariable("task", "2");


which should set the task variable in RR to 2. See how that works? To change the variable in RR you'd now just change that "2" in the above cpp file.

Hope this helps ...


This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index