I'm working on a new scripting framework (inspired by the premise of the navigation code of yesteryear, but implemented radically differently). I've completed basic coding but have not had the chance to test it on real hardware (I'm working on getting real hardware).
What I'm wondering is how many people would be interested in helping me test it before I release it? I plan on releasing it as freely (open source) as allowed.
"scripting" is a bit of a mis-nomer. It's created in such a way as to allow a mixture of C and script. It (hopefully) addresses some of the issues of the navigation code (esp. when you have multiple scripts loaded at once). Instead of having to iterate through an array and read the data (which has two setbacks: indirect referencing and preventing certain optimizations), it creates function calls.
How is this implemented? Preprocessor voodoo.
Here is an example command:
Code:
COMMAND cmd_wait(dTIME time)
{
long int end_time = robot_time + time;
bool done = FALSE;
COMMAND_LOOP(done) {
CMDHEARTBEAT;
if (robot_time > end_time)
done = TRUE;
}
printf("Done CMD_WAIT\n");
CMD_RETURN;
}
And an example script (it should look familiar):
Code:
SCRIPT example_script() {
while (autonomous_mode) {
CMD_GYRO_BIAS();
CMD_WAIT_FOR_BUMP(100);
CMD_WAIT(1000);
CMD_DRIVE(1500);
CMD_WAIT(4000);
CMD_TURN(-1500, 40);
CMD_WAIT(3000);
CMD_DRIVE(2400);
CMD_WAIT(4000);
CMD_TURN(PI_ANGLE / 2, 50);
CMD_WAIT(4000);
CMD_DRIVE(2400);
CMD_TURN(-1500, 40);
CMD_WAIT(1000);
CMD_DRIVE(0);
CMD_KEEP_HEADING(240000, 100);
}
}
I should also note that I barrowed some details of implementation from the navigation code, but did not include gyro/encoder/pid stuff, so some of the higher-level stuff is still in the air.