Using REAL ENGLISH in autonomous mode???

:confused: At the kickoff, they were saying that you could use real english to program in autonomous mode, but there is nothing supporting that statement. They said you could do this:

Drive forward 1000mm
Turn left
Drive forward 1000mm

There is nothing on the CD or in the MPLAB software to enable you to do this, so how does it work?

You’ll find the forum discussions on this at:
http://www.chiefdelphi.com/forums/showthread.php?t=32870

The scripting code is located at http://kevin.org/frc/

I looked at all of that, and then I went to www.kevin.org/frc and there was nothing about using the plain english to run the controller. Please help. I will look at the link you gave me again, hoping for an answer.

I think you’re misunderstanding exactly what it is they’re providing. In the navigation code on the kevin.org site, you will find a file called “commands.h” that contains this:


struct commands command_list] = {

/*   Command              parm 1     parm 2   parm 3   */
/*
{CMD_GYRO_BIAS,               0,        0,      0},
{CMD_WAIT_FOR_BUMP,         100,        0,      0},
{CMD_WAIT,                 1000,        0,      0},
{CMD_TURN,       -1571L,      100,      0},
{CMD_WAIT_FOR_BUMP,         100,        0,      0},
{CMD_WAIT,                 1000,        0,      0},
{CMD_TURN,        1571,      100,      0},
{CMD_JUMP,                    1,        0,      0},
{NULL,                        0,        0,      0}
*/

{CMD_GYRO_BIAS,               0,        0,      0},
{CMD_WAIT_FOR_BUMP,         100,        0,      0},
{CMD_WAIT,                 1000,        0,      0},
{CMD_DRIVE,                1500,        0,      0},
{CMD_WAIT,                 4000,        0,      0},
{CMD_TURN,       (-1500),       50,      0},
{CMD_WAIT,                 3000,        0,      0},
{CMD_DRIVE,                2400,        0,      0},
{CMD_WAIT,                 4000,        0,      0},
{CMD_TURN,        (PI_MRAD / 2),       50,      0},
{CMD_WAIT,                 4000,        0,      0},
{CMD_DRIVE,                2400,        0,      0},
{CMD_WAIT,                 4000,        0,      0},
{CMD_TURN,       (-1500),       50,      0},
{CMD_WAIT,                 1000,        0,      0},
{CMD_DRIVE,                   0,        0,      0},
{CMD_KEEP_HEADING,       240000,      100,      0},
{CMD_JUMP,                    1,        0,      0},
{NULL,                        0,        0,      0}

};

This scripting language is what they were referring to at kickoff. It’s not “plain english” but it’s much closer than regular C code ;).

Well, Dave Lavery stretched the truth a bit when he said it was plain english. Your:

Drive forward 1000mm
Turn left
Drive forward 1000mm

would be

{CMD_DRIVE, 1000, 0, 0},
{CMD_TURN, (PI_MRAD / 2), 50, 0},
{CMD_DRIVE, 1000, 0, 0},
{NULL, 0, 0, 0}

in commands.h

So if i want to use that in autonomous, do i just write that in the autonomous part in user_routines_fast.c?

Thank you both for your help. What I did not understand is where these commands were being called from. I have one last question: With gyro.c/h and commands.c/h, how does it know which PWMs your motors are on? Yes, your robot could get bumped, but if your drive motors are on PWM3 and PWM4 and it is trying to control PWM1 and PWM2, how would it know?

Yes. I knew you could do that all along, but I was having problems understanding where it was calling it from which I now know as commands.h, and what PWM it is controlling.

On your OI board, you have the pins indicating which pwm you are plugging your motors into. In the program you specify the pwms you are sending the signal to.

Actually, we have some code that includes far more complex commands that we may or may not release in the future. Right now I’m working on the “CMD_ORDER_MORE_PIZZA” command. For a laugh, last night we used the newly finished “CMD_STOP_AND_CATCH_FIRE” command on some unsuspecting freshmen <evil grin>.

-Kevin

NICE! :smiley: :smiley: :slight_smile:
If only those really worked, I would love it. Just somehow hook a Cordless phone to a PWM in and PWM out, and have it actually call Pizza Hut and order a pizza. I wonder if they accept digital robot money :confused:

But I am still wondering how it knows which PWM to control. It is set in the program, but where? Unless it is COMPLETELY different from EDU Programming, as that is all I really have experience with, as this is my rookie year.

From the pid.h file:

/* Define your pwm values for the left and right wheels. */
#define wheel_l pwm01
#define wheel_r pwm03

-Kevin

Thanks

So…your supposed to be able to just type in user_routines_fast.c :
{CMD_DRIVE, 1000, 0, 0},
{CMD_TURN, (PI_MRAD / 2), 50, 0},
{CMD_DRIVE, 1000, 0, 0},
{NULL, 0, 0, 0

and your auto works??

No. Technically speaking, the script is read, not executed. If you look through the navigation code (specifically, robot.c and robot.h), you will find that it is actually a large conglomeration of a bunch of state machines.

The sample script is in commands.h. There is no commands.c.