Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   2005 Autonomous Scripting Manual (http://www.chiefdelphi.com/forums/showthread.php?t=32870)

Anthony Kesich 19-01-2005 01:22

Re: Autonomous Scripting Manual
 
Quote:

Originally Posted by Tom Bottiglieri
I might have been able to answer you, if i was using the scripting option. The options you are given with it are very narrow. I know that you can write your own code to be available for scripts, but I dont see the point of the extra work.

Can someone prove me wrong?

Reusability. And ease of reading. Last year I was our teams only programmer. Other guys knew C, but I was the one that wrote all the code. We won a birth at nationals and decided to go. Everything was set. Then my grandfather died. I went to Seattle for his funeral while the guys were at Nationals. They needed to change the autonomous there. I had used some obscure coding techniques and they had to rewrite it all. If i had this scripting language, even though it would have been more initial work for me, it would have been a lot less work for the guys later on.

With scripting, I can change my autonomous code on the fly now. All i need is to have 2 or 3 or 4 or however many structures in the commands.h file and uncomment the one i want to use. No sifting through pages of code to change a single number or uncomment one block. No using multiple workspaces. If i want to delay my code three seconds, I add one scripting command. If i want to use more commands, I write them myself.

I see the scripting as a powerful tool for both rookies and veterans. Rookies have an easy system where they don't have to get too deep into interrupts and the like. Veterans can write their own calls and functions. They can write camera code that can be implemented with a single call in a header. They can change their entire autonomous with a flip of a switch without putting in a lot of if-elses or ternary operators (make the command array 2 dimensional and have one of the variables in robot.c be a switch position).

All-in-all, the scripting feature is powerful and useful in my opinion. Don't disregard it or throw it away just because it makes life too easy. We're here to build engineers and programmers. Use the tools available. No one ever won a prize for reinventing the wheel.

-Tony K

russell 19-01-2005 01:37

Re: Autonomous Scripting Manual
 
All of this just makes me want to find the nearest brick wall and bash my head repeatedly on it. I have not the faintest clue what the terminology for any of the stuff I am doing is, and I am not even testing it, Im just writing code based upon the stuff I see in the default code and hoping it will work on one of the first three thousand tries. :rolleyes:

Anthony Kesich 19-01-2005 17:59

Re: Autonomous Scripting Manual
 
Russell, that's what we're here for. Ask anything. Anything at all and don't feel stupid about it. I knew almost anothing about programming when I first joined robotics. The extent of my experience was playing with basic on the calculator. Fortunately, the other programmers on Chief Delphi where nice enough to help me out. So feel free to ask away. No one will think the lesser of you. The only stupid question is the one not asked.

-Tony K

iscrc2 22-01-2005 02:19

Re: 2005 Autonomous Scripting Manual
 
I'm having a hard time seeing how cmd_drive causes any action to occur. It looks like after calculating counts in START the IN_PROGRESS just shuts down. Should there be something there that gets encoder counts and looks for when its reaching the calculated value?

[answer: yes, using set_vel calls in START and then IN_PROGRESS state check encoders counts against calculated counts, dont call pid_stop until you are ready to stop, can hack it by doing a --count if no encoder is avail'

While testing the command I had an additional problem in that the static state variable acts as if its getting initialized each time the function gets called. I'm using C18 v2.4 and IDE v7.0. Has any one else had this problem?

[answer: not an issue, but in the script command array remember that it is zero based and to return to first script command do a jump to 0]

russell 22-01-2005 02:24

Re: 2005 Autonomous Scripting Manual
 
I bet I can prove your stupid question theory wrong. I got one just now. Last year we put autonomous code into a file that was called like autonomous.c or something, but this year there does not seem to be any such file. Do I just say while (autonomous_mode) { }, then put my autonomous stuff in the brackets? And if so does the rest of the program also run while in autonomous mode, or is it just the stuff that is in those brackets?

iscrc2 22-01-2005 03:00

Re: 2005 Autonomous Scripting Manual
 
Russell, in the user_routines_fast.c file there is a function called:
void User_Autonomous_Code(void)

In that function there is a comment line:
/* Add your own autonomous code here. */

You can put code there. Dimond is going to be working tomorrow around noon rm109 come by and we can go over programming.

russell 23-01-2005 04:47

Re: 2005 Autonomous Scripting Manual
 
Thanks for the offer, but I probably wont be able to make it. I managed to make that code I was working on today work sort of. I just want to make the robot always stop in the same place relative to the target, but thats just fudging numbers. Right now I have it set up so when it gets to about eight feet it slows, then when it gets to around one foot it stops altogether. Now I just have to figure out how to put it all together for autonomous. Thanks for showing me where to put it, I was really lost for a bit there.

695programmer 09-02-2005 19:20

Re: 2005 Autonomous Scripting Manual
 
I have a question that may or may not be stupid. When i run the default code the comterminal gives me values for the x and y axis. The y axis changes when i move the joystick, but not the x. I've tried hooking up two joysticks and playing around with them to no avail. Am i just missing somthing?

Elemist315 09-02-2005 22:23

Re: 2005 Autonomous Scripting Manual
 
I'm having trouble with the delays provided in the default code, and time is running thin fast. I just can't figure out how to use them or get them to work (I have a feeling I'm not calling them right). Would it be easier to try to integrate Kevin's code or figure out the delays, I'm really new to c (little c++ experience).

brownster 12-02-2005 23:30

Re: 2005 Autonomous Scripting Manual
 
Hey, I had a question about Autonomous scripting, I downloaded the code from kevins site and i just can't seem to get it to do anything in autonomous. I have the automous calling the Robot_control() function and from there it just waits for a bump...the commands defined in commands.h don't seem to be working for me...am i doing something wrong?

Moloch 17-02-2005 10:24

Re: 2005 Autonomous Scripting Manual
 
I dont understand how to call the robot_control() function. I dont know much about C at all. I need someone to tell me how to call the robot.c function desperatly. If I understand correctly you have to call the robot_control() function, which will in turn start robot.c to sift through the command.h script. I have not a single clue as to how to get this started! I need lots of help, I am the only programmer on the team willing to try anything!

Mark McLeod 17-02-2005 14:08

Re: 2005 Autonomous Scripting Manual
 
Quote:

Originally Posted by Moloch
I dont understand how to call the robot_control() function. I dont know much about C at all. I need someone to tell me how to call the robot.c function desperatly. If I understand correctly you have to call the robot_control() function, which will in turn start robot.c to sift through the command.h script. I have not a single clue as to how to get this started! I need lots of help, I am the only programmer on the team willing to try anything!

There are a couple of things you'll have to do.
robot_control() should be called from User_Autonomous_Code() in the file user_routines_fast.c
If you look there in the Navigation s/w you'll see it commented out. Just add it back in.

For those of you who don't have encoders or gyros you'll need to write your own time based drive functions.

Moloch 17-02-2005 14:24

Re: 2005 Autonomous Scripting Manual
 
We have encoders....but thats all I have to do, then write the scripts?

Mark McLeod 17-02-2005 14:30

Re: 2005 Autonomous Scripting Manual
 
Quote:

Originally Posted by Moloch
We have encoders....but thats all I have to do, then write the scripts?

You'll need to tune the control PID algorithms to match the characteristics and behavior of your robot. See the descriptions and directions in the file pid.h for help in doing this.

P.S.
If you are using the Navigation code as-is, then you will need to add the Default_Routine() function in user_routines.c from the IFI default code to allow your humans to drive the robot. Add the call to Default_Routine() in Process_Data_From_Master_uP().

You also need to comment out the call to robot_control() in the routine
Process_Data_From_Master_uP() in the file user_routines.c


Moloch 17-02-2005 16:55

Re: 2005 Autonomous Scripting Manual
 
This is all I will have to do in user_fast:

while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata); /* DO NOT DELETE, or you will be stuck here forever! */

/* Add your own autonomous code here. */

if(rc_dig_in16 == 1){

robot_control();
}
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);

Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
}
}
}


That just seems to easy to me...


All times are GMT -5. The time now is 22:22.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi