Go to Post The FIRST World has your back. - MishraArtificer [more]
Home
Go Back   Chief Delphi > Technical > Programming
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 26-12-2005, 21:22
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Lightbulb New script system

I'm working on a new scripting framework (inspired by the premise of the navigation code of yesteryear, but implemented radically differently). I've completed basic coding but have not had the chance to test it on real hardware (I'm working on getting real hardware).

What I'm wondering is how many people would be interested in helping me test it before I release it? I plan on releasing it as freely (open source) as allowed.

"scripting" is a bit of a mis-nomer. It's created in such a way as to allow a mixture of C and script. It (hopefully) addresses some of the issues of the navigation code (esp. when you have multiple scripts loaded at once). Instead of having to iterate through an array and read the data (which has two setbacks: indirect referencing and preventing certain optimizations), it creates function calls.

How is this implemented? Preprocessor voodoo.

Here is an example command:
Code:
COMMAND cmd_wait(dTIME time)
{
	long int end_time = robot_time + time;
	bool done = FALSE;
	COMMAND_LOOP(done) {
		CMDHEARTBEAT;
		if (robot_time > end_time)
			done = TRUE;
	}
    printf("Done CMD_WAIT\n");
    CMD_RETURN;
}
And an example script (it should look familiar):
Code:
SCRIPT example_script() {
	while (autonomous_mode) {
		CMD_GYRO_BIAS();
		CMD_WAIT_FOR_BUMP(100);
		CMD_WAIT(1000);
		CMD_DRIVE(1500);
		CMD_WAIT(4000);
		CMD_TURN(-1500, 40);
		CMD_WAIT(3000);
		CMD_DRIVE(2400);
		CMD_WAIT(4000);
		CMD_TURN(PI_ANGLE / 2, 50);
		CMD_WAIT(4000);
		CMD_DRIVE(2400);
		CMD_TURN(-1500, 40);
		CMD_WAIT(1000);
		CMD_DRIVE(0);
		CMD_KEEP_HEADING(240000, 100);
	}
}
I should also note that I barrowed some details of implementation from the navigation code, but did not include gyro/encoder/pid stuff, so some of the higher-level stuff is still in the air.
  #2   Spotlight this post!  
Unread 27-12-2005, 08:23
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: New script system

Wow... that's a pretty nice. I would offer to help, but we unfortunately don't have quadrature encoders on our robot right now. (I'm assuming you need 'em. Do you?)
__________________

  #3   Spotlight this post!  
Unread 27-12-2005, 13:43
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: New script system

Quote:
Originally Posted by Ryan M.
Wow... that's a pretty nice. I would offer to help, but we unfortunately don't have quadrature encoders on our robot right now. (I'm assuming you need 'em. Do you?)
Only for commands dealing with distance.

I've tried to make it as open-ended as possible, so you don't have to use my encoder/gyro implementation. The easiest way to insert your code is to add hooks in script_every_cycle(), and have your routines update my variables.

I will, however, probably include Kevin's gyro/encoder code as a default implementation. (If I can clear it with him, that is.)

Last edited by Astronouth7303 : 27-12-2005 at 13:47.
  #4   Spotlight this post!  
Unread 27-12-2005, 15:22
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Talking Re: New script system

I've now got full implementation using Kevin's gyro and encoder code (unmodified). I still have not had the opportunity to test or debug this code.

You can grab the code from my site (1.32MB). I used Eclipse to create this from the beginning, so no MPLAB project is included. (Although some of us may consider that a good thing...)
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
Students, what is your fantasy education system? Ken Leung General Forum 28 04-01-2006 09:20
Boilermaker Regional Wireless Scouting System. Josh Hambright Regional Competitions 4 21-03-2005 19:48
**FIRST EMAIL**/A note on the FRC scoring system sanddrag FIRST E-Mail Blast Archive 13 17-03-2005 04:37
guidelines for modifying the linker script??? gnormhurst Programming 2 06-03-2005 02:03
control system worth more than $500 archiver 2001 8 24-06-2002 02:00


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

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