|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
New promised "scripts"
Having read through the code, I have encountered some problems. Me and my programming fellows tried and put the differend available scripts. (CMD_DRIVE) for example. However, we were getting many problems when compiling this with MPLAB.
Any example of using the scripting commands and where to place or modify them would be great. Also some insight in the "Commands.h" file. We want to know why there are 4 CMD_DRIVE calls and other multiple calls. Thank you -Edmund |
|
#2
|
||||
|
||||
|
Re: New promised "scripts"
Scripting is still in the developmental stage, search Kevin Watson's (the scripting developers) posts.
|
|
#3
|
|||||
|
|||||
|
Re: New promised "scripts"
The commands.h file is just a single variable. It is an array of a custon data type called commands. The commands data type has four values: an int called command which stores the command type, a long called param1 which stores the first argument for the function, and two more ints called param2 and param3 to hold more arguments if needed.
The robot.c file goes through this structure line by line and executes. For example the default code Code:
{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}
1) pause for a few loops to calibrate the gyro 2) wait for a sensor to be tripped or a button to be pushed 3) wait one second (1000 milliseconds) before executing the next command 4) drive forward 1.5 meters (1500 millimeters) and stop 5) turn clockwise (negative direction) 1.5 radians (just under 90 degrees) with a tolerance (error zone) or plus or minus 50 milliradians (.05 radians) 6) wait another 3 seconds (3000 milliseconds) 7) drive forward 2.4 meters 8) wait 4 seconds 9) turn pi/2 radians (90 degrees) counterclockwise with a tolerance of 50 milliradians 10) wait another 4 seconds 11) drive forward 2.4 meters 12) wait another 4 seconds 13) turn 1.5 radians counterclockwise with a tolerance of 50 milliradians 14) drive forward 0 millimeters. That is, stop. 15) maintain heading for 4 minutes (240000 milliseconds) with a tolerance of .1 radians. That is, if something tries to turn the robot, it will self correct to within .1 radians of where it was. 16) return to step 2 (It's called as 1 since arrays in C start with 0) and repeat. 17) the Null statement signals an end of file for the script interpreter. Eventhough it will never get ot stil line, it is still good practice to put it in. The reason the numbers are so big in the parameters are, if you haven't guessed, every thing is in thousanths. This eliminates the need for decimal math and makes the program run faster. Most of it is really straight forward, requireing only one argument. It is good practice to fill the unused paramaters with a 0, even though it doesn't matter what you put in it. The reason tolerances are needed is that the robot will rarely ever get back to where it thought it was, so if there was no tolerance, the robot would continue to twitch, thinking it was always off by a fraction of a radian. Anyways, I hope I have cleared thing up a bit. If there is anything else you need, don't hesitate to ask. -Tony K Last edited by Anthony Kesich : 13-01-2005 at 10:51. |
|
#4
|
||||
|
||||
|
Re: New promised "scripts"
Anthony, your grammer indicates that you are up past your bedtime, it is late, go to bed, and sail the silver seas of dreams.
|
|
#5
|
|||
|
|||
|
Re: New promised "scripts"
Wow! Everything is cleared up. Thanks.
One more thing. After modifying the functions and numbers in the structures, how do you add this WHOLE struct into the autonomous mode? What exactly do you type in there? We tried some different calls but they seemed to not work: "commands" "commands command_list[]" "command_list[]" (Remove the quotes of course) Please and thank you in advance. -Edmund |
|
#6
|
|||||
|
|||||
|
Re: New promised "scripts"
I have a question regarding tolerance.
What exactly is it? Is that how far the robot can deviate from the turn it's making, meaning a lower value is more precise but a higher value requires less small movements to get "back on track"? |
|
#7
|
||||
|
||||
|
Re: New promised "scripts"
Quote:
|
|
#8
|
|||||
|
|||||
|
Re: New promised "scripts"
Quote:
And Edmund: You don't call the variable, you call the function robot_control(), as CJO said. This funcation interprets the script variable you put in commands.h and executes them on the robot. -Tony K |
|
#9
|
||||
|
||||
|
Re: New promised "scripts"
The difficulty with this whole systme is that the current version of the camera control system relies on being where the robot_control() function is located. So, heres hoping the camera gets better.
|
|
#10
|
|||
|
|||
|
Re: New promised "scripts"
Quote:
Would this work? |
|
#11
|
|||||
|
|||||
|
Re: New promised "scripts"
Yes, you could make it run in robot.c. The problem is that you would need to add the camera drivers to the kickoff code, which might cause some problems. You would then have to write your own new functions in robot.c before you coudl call them in commands.h. Granted, it wouldnt be to hard, but it would still take some time and effort.
-Tony K P.S. I will post a list of all of the robot commands and parameters some time soon. |
|
#12
|
|||
|
|||
|
Re: New promised "scripts"
Viewing this system, I am frightened. This looks almost exactly like the system one of our programmers developed and tried to implement, but it was very unwieldy. If the use of this system requires the amount of sensor input I'm reading, are younger teams going to be able to implement it?
|
|
#13
|
||||
|
||||
|
Re: New promised "scripts"
The biggest problem with the comera is the serial drivers, however, never fear, Mr. Watson is hard at work, so, I am hoping that this is a porblem which can be overcome.
|
|
#14
|
||||
|
||||
|
Re: New promised "scripts"
The autonomous mode call is already there "robot_control();"
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Autonomous Commands Promised in Kickoff | schenkin | Programming | 11 | 16-01-2005 08:58 |
| CT Regional - Jess Promised She Wouldn't Delete This.... | Lora Knepper | Regional Competitions | 3 | 06-03-2004 10:03 |
| Chief Delphi 47 | archiver | 2001 | 5 | 24-06-2002 01:08 |
| She's ALIVE!!! | archiver | 2000 | 19 | 23-06-2002 23:08 |