I am working with the API to control my Create using the module. Here is a snippet from the .robo file:
<IRobot_Create>
<start_oi_mode>3</start_oi_mode>
<Advance_Button>AdvButton</Advance_Button>
</IRobot_Create>
and my API code:
rr.getParameter("IRobot_Create",0,"start_oi_mode", buffer, sizeof buffer);
cout << buffer << endl;
// rr.setParameter("IRobot_Create",0,"start_oi_mode", "2");
rr.getParameter("IRobot_Create",0,"start_oi_mode", buffer, sizeof buffer);
cout << buffer << endl;
for (int i = 0; i < 100; i++)
{
rr.getVariable("AdvButton", buffer, sizeof buffer);
cout << buffer << endl;
::Sleep(100);
}
This runs fine with the state of the Advance Button reported. But if the line setting the start_oi_mode module parameter runs the association of "AdvButton" name with Advance Button is lost. The state of the button is not returned.
An associated question is whether you can change the operating mode (safe, full) through a variable. I don't see a variable which is why this code use the module parameter change.
Another point is that changing the mode in the module dialog doesn't always change the mode on the Create.
RR Version 2.11.3
|
|