Hi folks,
I got the raspberry pi connector on top of bittle, set up and everything works. I can send commands to from python, and Bittle mostly does them. Now, a few problems:
- the interface from Python is extremely coarse - you can give commands and some time (in seconds), but a better one would be "run x instances of the loop". Is that not available yet, or did I miss it?
- the communication is also very error-prone. I get into modes where the skills don't work, but things like turn off/balance do. How do I know the status of the channel, and is there a way to reset it without a more general reset?
Generally though, should I be investing in the serial communication, or should I start looking into i2c (and flip that switch) which I presume means driving the servos directly?
If this question is answered/portable from a different Petoi platform, I can crib from there, just point me to it please - couldn't find it on my own.
Thanks,
Bear.
PS: posting to the forum seems broken, the "select your post category" can't select any option, so "publish" is grayed out.
I think found my problem. in OpenCat.ino, line 632 you have:
if (strcmp(newCmd, "") && strcmp(newCmd, lastCmd) ) {
but the treatment is inconsistent for skills. Balance, specifically, writes something else in lastCmd even though it's a skill. Check out line 711:
strcpy(lastCmd, "balance");
So that strips the "k", meaning you can send "kbalance" in a row, whereas if you send other skills like crawl forward, etc. it gets ignored. Makes sense I guess if you're on a remote that keeps sending the same command over and over again, you don't want to restart the sequence.
Somehow - haven't finished tracing all the code (like around line 650), if you have a sequence over serial like "kcrF" -> "kbalance" -> "kcrF", the second "kcrF" will get eaten.
Would be nice to document the state machine explicitly, clean it up a bit and break up the code into more functions - but I can't complain, it works and wouldn't have wrote it myself, so here we are.