Go to Post It's a game. It's a challenge. Face it like a man, build a robot to play the game and get over it. - Arefin Bari [more]
Home
Go Back   Chief Delphi > Technical > Robotics Education and Curriculum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 13-11-2003, 20:42
Matthew_H's Avatar
Matthew_H Matthew_H is offline
Ubergeek
#1028 (Ubergeeks)
Team Role: Mentor
 
Join Date: Feb 2003
Rookie Year: 2001
Location: Huntsville,AL
Posts: 105
Matthew_H will become famous soon enough
Send a message via AIM to Matthew_H Send a message via MSN to Matthew_H
Autonomous Code Example

We seem to be have a hard time finding where to input code for any autonomous code in the 2004 Edu controller code. Is there anyone out there that would be willing to share their code they have been working to help us get started with ours?

Thanks,
Matthew

Ubergeeks
  #2   Spotlight this post!  
Unread 13-11-2003, 20:44
GregTheGreat's Avatar
GregTheGreat GregTheGreat is offline
Registered User
no team
 
Join Date: Jan 2003
Rookie Year: 2002
Location: USA
Posts: 386
GregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura about
Re: Autonomous Code Example

Quote:
Originally posted by Matthew_H
We seem to be have a hard time finding where to input code for any autonomous code in the 2004 Edu controller code. Is there anyone out there that would be willing to share their code they have been working to help us get started with ours?

Thanks,
Matthew

Ubergeeks
Here ya go... this should help.


http://www.innovationfirst.com/FIRST...umentation.htm

-Greg The Great
  #3   Spotlight this post!  
Unread 13-11-2003, 20:46
Matthew_H's Avatar
Matthew_H Matthew_H is offline
Ubergeek
#1028 (Ubergeeks)
Team Role: Mentor
 
Join Date: Feb 2003
Rookie Year: 2001
Location: Huntsville,AL
Posts: 105
Matthew_H will become famous soon enough
Send a message via AIM to Matthew_H Send a message via MSN to Matthew_H
We have been reading the manual from innovation first but I was hoping to look at some code examples of working autonomous code.
  #4   Spotlight this post!  
Unread 13-11-2003, 20:50
GregTheGreat's Avatar
GregTheGreat GregTheGreat is offline
Registered User
no team
 
Join Date: Jan 2003
Rookie Year: 2002
Location: USA
Posts: 386
GregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura about
Quote:
Originally posted by Matthew_H
We have been reading the manual from innovation first but I was hoping to look at some code examples of working autonomous code.
here is the def. if that will help....

http://www.innovationfirst.com/FIRST...10-28-2003.zip

-Greg The Great
  #5   Spotlight this post!  
Unread 13-11-2003, 20:55
Jeremy_Mc's Avatar
Jeremy_Mc Jeremy_Mc is offline
GitHubber
no team
Team Role: Mentor
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Orlando, FL
Posts: 496
Jeremy_Mc will become famous soon enoughJeremy_Mc will become famous soon enough
We have the default code.

We're having difficulties getting the RC to respond to anything. The PWM's just stay at 127 no matter what values we try to enter into them and/or change with code.

We downloaded the EduController from the White Papers and tried to dissect that, but it was a bit over our heads seeing as how we're not exactly the most experienced with C.

What we really need is to know WHAT to put...I think we've figured out where to put it (Mostly because it says "Put your own code here"...but yes.), so if anyone out there can show us a brief example of how to make the robot go forward. I think we're merely changing the wrong variables (clinging to my PBASIC p2_y and pwm02 variables...), but maybe I'm just inputting the code wrong?

Thanks for any help you can offer.
__________________
GitHub - Collaborate on code, documentation, etc. - http://github.com
  #6   Spotlight this post!  
Unread 13-11-2003, 20:59
GregTheGreat's Avatar
GregTheGreat GregTheGreat is offline
Registered User
no team
 
Join Date: Jan 2003
Rookie Year: 2002
Location: USA
Posts: 386
GregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura about
Quote:
Originally posted by Jeremy_Mc
We have the default code.

We're having difficulties getting the RC to respond to anything. The PWM's just stay at 127 no matter what values we try to enter into them and/or change with code.

We downloaded the EduController from the White Papers and tried to dissect that, but it was a bit over our heads seeing as how we're not exactly the most experienced with C.

What we really need is to know WHAT to put...I think we've figured out where to put it (Mostly because it says "Put your own code here"...but yes.), so if anyone out there can show us a brief example of how to make the robot go forward. I think we're merely changing the wrong variables (clinging to my PBASIC p2_y and pwm02 variables...), but maybe I'm just inputting the code wrong?

Thanks for any help you can offer.
If you like Pbasic, see if you can get a converter. I believe they make them...try a download site, or do a websearch. Then you can run re-declare in C. It might make things simpler on you. I really have not got into the EDU programming yet, I will look into it, but I am not making any promises.

Possibility: Maybe you have a line in your code, where you declare your variables... It might be set to neutral, and whenever you go into your loop it just keeps it at neutral. Check that first, that often is the problem.

-Greg The Great
  #7   Spotlight this post!  
Unread 13-11-2003, 21:16
Noah's Avatar
Noah Noah is offline
Code Monkey
#0861 (The Gondobots)
Team Role: Programmer
 
Join Date: Apr 2002
Location: Venice, California
Posts: 139
Noah has a spectacular aura aboutNoah has a spectacular aura about
Send a message via AIM to Noah
ok, it goes something like this (in my mind)

1. Check to see if the autonomous_mode bit is set. You may opt to skip this part while testing your auto-code, or alternatively you can try this .

2. The output variables for the PWM outputs are PWM01 - PWM08. A simple statement like
PWM01 = 255;
PWM02 = 255;
should work.

3. You might try creating functions such as
go_forward()
{
PWM01 = 255;
PWM02 = 255;
}
turn_right()
{
PWM01 = 255;
PWM02 = 0;
}

and such. Something I suggest even more is that you create your own aliases in alias.h in ways such as

#define leftDriveMotor PWM01
#define rightDriveMotor PWM02

and then use the leftDriveMotor and rightDriveMotor variables in all of your autonomous code. That way, when your electrical guy accidentally misreads the schematics and plugs the left motor into PWM 2 and the team decides its a software bug, it's all of three keystrokes to rectify. (This seems to happen a lot in my team... grrr)
__________________
"It's broken? NOOAAHH!!! This is your doing, isn't it!"

"We can fix it in the software!"
"It's a BROKEN GEAR!"
  #8   Spotlight this post!  
Unread 13-11-2003, 21:20
GregTheGreat's Avatar
GregTheGreat GregTheGreat is offline
Registered User
no team
 
Join Date: Jan 2003
Rookie Year: 2002
Location: USA
Posts: 386
GregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura about
Quote:
Originally posted by Noah
ok, it goes something like this (in my mind)

1. Check to see if the autonomous_mode bit is set. You may opt to skip this part while testing your auto-code, or alternatively you can try this .

2. The output variables for the PWM outputs are PWM01 - PWM08. A simple statement like
PWM01 = 255;
PWM02 = 255;
should work.

3. You might try creating functions such as
go_forward()
{
PWM01 = 255;
PWM02 = 255;
}
turn_right()
{
PWM01 = 255;
PWM02 = 0;
}

and such. Something I suggest even more is that you create your own aliases in alias.h in ways such as

#define leftDriveMotor PWM01
#define rightDriveMotor PWM02

and then use the leftDriveMotor and rightDriveMotor variables in all of your autonomous code. That way, when your electrical guy accidentally misreads the schematics and plugs the left motor into PWM 2 and the team decides its a software bug, it's all of three keystrokes to rectify. (This seems to happen a lot in my team... grrr)
that looks right, (just agreeing) usually problems with programs are variables are not defined, or bits on on, etc. or programs that get caught in loops, emitting certain parts.

Check the obvious before changing the program.
Did you debug?

-Greg The Great
  #9   Spotlight this post!  
Unread 13-11-2003, 21:59
Sachiel7's Avatar
Sachiel7 Sachiel7 is offline
<Yes I managed to flip it
AKA: Shayne Helms
FRC #1132 (RAPTAR Robotics)
 
Join Date: Sep 2002
Rookie Year: 2002
Location: Richmond, VA
Posts: 541
Sachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really nice
Send a message via AIM to Sachiel7
That's a nice way to start, but you have to code out your autonomous routine, and that can make it harder to tweak.
The method I use is arrays. Yes, fun old arrays.
For Example:
const int Func[13][3] = {
{84, 170, 40},
{170,170,60},
{84,170,20},
{170,170,30},
{84,170,20},
{170,170,30},
{84,170,20},
{170,170,60},
{84,170,40},
{170,170,30},
{84,170,20},
{170,170,30},
{84,170,40}
};

Then you only need a simple strand of general cod in your Process_Master_uP routine:

if (F_Count < MAX_FUNC)
{
counter ++;

if (counter > Func01[F_Count][2])
{
counter =0;
F_Count ++;
}

if (F_Count == MAX_FUNC) //Comment out this if for no loop.
{
F_Count = 0;
counter = 0;
}

pwm02 = Func01[F_Count][0];
pwm01 = Func01[F_Count][1];
}

Now, you could shorten this down to a 2D array, since all the variable in Column 2 are the same. I left it open because I change that array around alot. You could increase the dimensions so several different auto modes could be within one array, and the switch could be applied to one array element.

(BTW, for those of you out there who would like to tinker a bit, what does the array listed above do? HINT: It writes something. PWM01 is the left drive(facing reverse) and PWM02 is the right)

Now, someone may come along and tell you that it's a rough process mapping out all your array values and hard coding them in, but I solve this with my own program, that I'm working on called eduCAD. The program gets a spec sheet on your edubot, generates some basic variables for use and calculation etc. Then you draw out the path of motion for the bot. It then calculates all the data to form a final array which is dumped to a custom include file that contains different auto arrays.
I plan on posting eduCAD on CD once it's more complete. I just planned on making it more usable with the full robot as well, however, and I'm working on making it a win32 prog(rather than DOS )

Anyway, if you have any specific questions, just PM me, I'm more than willing to help with any programming issues anyone's having.
__________________
-=Sachiel7=-

There's no such thing as being too simple!
Look for Team #1132, RAPTAR Robotics at the VCU Regional this year!
  #10   Spotlight this post!  
Unread 13-11-2003, 22:03
GregTheGreat's Avatar
GregTheGreat GregTheGreat is offline
Registered User
no team
 
Join Date: Jan 2003
Rookie Year: 2002
Location: USA
Posts: 386
GregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura about
Quote:
Originally posted by Sachiel7
That's a nice way to start, but you have to code out youmodes could be within one array, and the switch could be applied to one array element.

(BTW, for those of you out there who would like to tinker a bit, what does the array listed above do? HINT: It writes something. PWM01 is the left drive(facing reverse) and PWM02 is the right)
making it a win32 prog(rather than DOS )

Anyway, if you have any specific questions, just PM me, I'm more than willing to help with any programming issues anyone's having.

Is the count automatically defined, or does it need to be custom inserted into the loop?

-Greg The Great
  #11   Spotlight this post!  
Unread 14-11-2003, 01:52
Sachiel7's Avatar
Sachiel7 Sachiel7 is offline
<Yes I managed to flip it
AKA: Shayne Helms
FRC #1132 (RAPTAR Robotics)
 
Join Date: Sep 2002
Rookie Year: 2002
Location: Richmond, VA
Posts: 541
Sachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really nice
Send a message via AIM to Sachiel7
I'm assuming you mean the counter variable. Upon initing the prog, it's set to 0. It counts up until it reaches the counter time limit for a specific function (the third array element)
MAX_FUNC is the total number of functions. You can modify the code by commenting out the reset routine so that it won't repeat.
Since this is in user_routines.c, it clocks every 17ms which means 58 cycles is about 1 second. The final array element is the number of cycles for the first two elements to be outputted to the motors.

ie: {127,130,60}
^ ^ ^
Left Out || Number of Cycles to output
Right out

If your'e talking about F_Count, that's just the function you want to start with. It's defined at the beginning as 0 usually, but you can have 2 different modes in one array by refining the F_Count's start value and the MAX_FUNCs value

I hope that answers your question.
__________________
-=Sachiel7=-

There's no such thing as being too simple!
Look for Team #1132, RAPTAR Robotics at the VCU Regional this year!
  #12   Spotlight this post!  
Unread 14-11-2003, 08:35
GregTheGreat's Avatar
GregTheGreat GregTheGreat is offline
Registered User
no team
 
Join Date: Jan 2003
Rookie Year: 2002
Location: USA
Posts: 386
GregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura about
Quote:
Originally posted by Sachiel7
I'm assuming you mean the counter variable. Upon initing the prog, it's set to 0. It counts up until it reaches the counter time limit for a specific function (the third array element)
MAX_FUNC is the total number of functions. You can modify the code by commenting out the reset routine so that it won't repeat.
Since this is in user_routines.c, it clocks every 17ms which means 58 cycles is about 1 second. The final array element is the number of cycles for the first two elements to be outputted to the motors.

ie: {127,130,60}
^ ^ ^
Left Out || Number of Cycles to output
Right out

If your'e talking about F_Count, that's just the function you want to start with. It's defined at the beginning as 0 usually, but you can have 2 different modes in one array by refining the F_Count's start value and the MAX_FUNCs value

I hope that answers your question.
Thats what I thought, Can u do a "reserve" counter like a go-sub like in P-basic? I figure that I better find these things out now before build.

Thanks,

-Greg The Great
  #13   Spotlight this post!  
Unread 14-11-2003, 10:44
Matthew_H's Avatar
Matthew_H Matthew_H is offline
Ubergeek
#1028 (Ubergeeks)
Team Role: Mentor
 
Join Date: Feb 2003
Rookie Year: 2001
Location: Huntsville,AL
Posts: 105
Matthew_H will become famous soon enough
Send a message via AIM to Matthew_H Send a message via MSN to Matthew_H
I just received this email from FIRST.
By now most teams have received the FIRST EDUrobobtics kit or the new upgraded control system. FIRST is proud to unveil the new EDUrobotics System Guide developed specifically for FIRST by Carnegie Mellon University and The National Robotics Engineering Consortium. Please go to our homepage at www.usfirst.org and under "What's New" click on the EDUrobotics System Guide to get started. This interactive website is an excellent way for your team to learn C programming and other important FIRST Robotics content as you prepare for the upcoming competition season.

The website will be adding modules in the upcoming days. Just click on Content Updates for more learning modules and other information. All teams will receive a CDrom of this material, including Challenges you can run in your own classroom, in the kit of parts in January.

We hope you find the EDUrobotics System Guide helpful not only preparing your team but also introducing robotics to others.

Go Teams!






Matthew

Ubergeeks
  #14   Spotlight this post!  
Unread 14-11-2003, 15:27
Sachiel7's Avatar
Sachiel7 Sachiel7 is offline
<Yes I managed to flip it
AKA: Shayne Helms
FRC #1132 (RAPTAR Robotics)
 
Join Date: Sep 2002
Rookie Year: 2002
Location: Richmond, VA
Posts: 541
Sachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really nice
Send a message via AIM to Sachiel7
What do you mean by "reserve" counter, and how does that relate to a gosub?
You can pretty much do everything (and more) with the new controller that the old one could do.
__________________
-=Sachiel7=-

There's no such thing as being too simple!
Look for Team #1132, RAPTAR Robotics at the VCU Regional this year!
  #15   Spotlight this post!  
Unread 14-11-2003, 17:10
GregTheGreat's Avatar
GregTheGreat GregTheGreat is offline
Registered User
no team
 
Join Date: Jan 2003
Rookie Year: 2002
Location: USA
Posts: 386
GregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura about
Quote:
Originally posted by Sachiel7
What do you mean by "reserve" counter, and how does that relate to a gosub?
You can pretty much do everything (and more) with the new controller that the old one could do.
Thats what I was refering to, having a gosub type of design as a "reserve" counter.

I am talking about compiling the code, with a "reserve" without using something simple like indicators.

-Greg The Great
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
autonomous mode problem on field Chris_C Programming 17 26-03-2003 19:11
Autonomous code tutorial miketwalker Programming 2 23-02-2003 12:28
Overcomplicated Autonomous Code EbonySeraphim Programming 33 20-02-2003 21:53
Autonomous code PBoss Programming 7 14-01-2003 15:29
Autonomous Code Adrian Wong Robotics Education and Curriculum 1 18-11-2002 22:34


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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