I was hoping some of the better programmers out there might be able to point me in the right direction to programming a cyclic routine on my Axon using webbotlib.
I need to periodically read sensor values, make small adjustments then store them for other routines to use as needed. I need some kind of interrupt driven function that will call itself every so often.
I understand all the theory behind interrupts but have never actually tried to code them.
I am currently using the scheduler in webbotlib to get my cyclic routines since reading sensor values isn't very high up on my list of priorities of things to do. Here is the associated code:
void readSensors(SchedulerData data, TICK_COUNT lastTime, TICK_COUNT overflow)
{
//read sensors and adjust if needed
adjustX = a2dConvert10bit(posX) - 78;
adjustY = a2dConvert10bit(posY) - 90;
scheduleJob(&readSensors, &adjustX, lastTime, 50000);
}
Now I ask for help on better ways to do this because the &adjustX attribute is only there for show, which makes me think webbot planned for this to be used in smarter ways.
Can anyone tell me if there is a smarter or more efficient way to periodic read sensor and do minor adjustments?