Hey,
I was just wondering if something like that ever happend to anybody before and there is already a solution to my problem:
What I did was looking at Kevin's Code an stealing the Interpretor Idea but I wrote different function (to make it work with dead raconing just for now) and changed gave the constants different names and so on.
Everything worked really good until I tried to add a CMD_DIFFTURN Command to my Library that was supposed to make one Wheel slower in order to turn (instead of reversing them against each other like my CMD_TURN function does).
But whenever I use CMD_TURN and CMD_DIFFTURN together my first Command (here CMD_WAIT) gets the VALUE 8292 instead of 1 (#define CMD_WAIT 1). All other Values stay untouched. I was tring arround for nearly the entire day and couldn't figure out why and HOW something like this could happen, but what I found was that this number 8292 is appearing 2 times in the Assembler code which made me somewhat confused ...
So my question is did anybody else experience something like this before (maybe with another Value then 8292) or did I discover a new bug / way to trick myself ...
Ah and before I forget, I was testing this code withthe EduRC.
Code:
#define ROBOT_SPEED 10
#define DRIVE_TIME 2000
#define TURN_TIME 1200
#define TURN_SPEED 20
#define TURN_DIFF 10
struct commands command_list[] = {
/*Command parm 1 parm 2 parm 3 */
{CMD_WAIT, 5000, 0, 0},
{CMD_DIFFTURN, TURN_TIME, TURN_SPEED, TURN_LEFT * TURN_DIFF}, // Time, Speed, Direction/Drift
{CMD_DRIVE, DRIVE_TIME, FORWARD * ROBOT_SPEED, 0}, // Time, Speed/Direction
{CMD_DIFFTURN, TURN_TIME, TURN_SPEED, TURN_LEFT * TURN_DIFF}, // Time, Speed, Direction/Drift
{CMD_DRIVE, DRIVE_TIME, FORWARD * ROBOT_SPEED, 0}, // Time, Speed/Direction
{CMD_TURN, TURN_TIME, TURN_LEFT * 20, 0},
{NULL, 0, 0, 0}
};