Go to Post Now, most of the replies are very tactful when they are questioning a teams' design... but some are simply stupid. Keep your heads. - Andy Baker [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 13-01-2004, 10:33
sscanf sscanf is offline
Registered User
#0061
 
Join Date: Jan 2004
Location: Blackstone Valley Regional, Upton, MA
Posts: 4
sscanf is an unknown quantity at this point
Question Questions on timers/simulator

Hi,

My name is Dan Rasmussen and I'm one of the new programmers for team 61 (Corey Schalck, an associate of mine, is the oter programmer for team 61 but in the same boat I am). I was an FLL coach and was asked a loaded question the Blackstone Valley FLL tournament in November (do you know how to program in C?). So here I am.

I have years of experience in writing C code (I wrote C exclusively from 1988 to 1993, lots of C++ after that, now using java) but I'm fairly new to PIC programming. I have dabbled in PIC assembler using MPLAB and GPASM as well as JAL and OOPIC. I have downloaded and compiled the default code for the full sized robot in MPLAB/C18 (note: I had to add a #define _FRC_BOARD to user_routines.c to get it to compile).

I seem to be finding my way around the default code (full robot controller) which is well commented but would like to hear about best practices for dead reckoning using timed operations. For example, I see that Process_Data_From_Master_uP is called every 26.2 ms. I could put a static counter in there and use it for timed operations or are polled/interrupt driven timers the only way to go?

Finally, I spoke to Mike Norton, the coach, last night and he told me that in previous years he was able to use a robot simulator against the compiled code that would give him a visual indication of the robot movement and pin state. I haven't tried the MPLAB sim but I have a feeling that it will fall short. Maybe there is something in the FIRST kit that I need (I only have the MPLAB/C18 downloaded from Microchip). Am I missing something if I only have the downloads from Microchip?

Thanks for any help.

Dan
  #2   Spotlight this post!  
Unread 13-01-2004, 10:47
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
Re: Questions on timers/simulator

We did dead reckoning last year, and as much as I advise against it, it IS the easiest (and typically fastest moving) way to go...

We had to run actual simulations As in, we test it with the robot and if it goes psycho we have to jump on top of it and cut the power. I'm sure there are more effective methods of testing it, but to be sure that it will work in the real world I would suggest your main testing tool be a piece of a field (you just need a space that's marked off with tape to signify field structures) and your robot.

(Side note: They DID give us the code for the IR beacon/sensors this year so I would really advise you take advantage of what's there...)

[Edit: The program he's referring to was RoboEmu by Rob Bayer. It ran PBASIC code, but I'm not sure he'll be making one for the C controller this year...]
__________________
GitHub - Collaborate on code, documentation, etc. - http://github.com
  #3   Spotlight this post!  
Unread 13-01-2004, 10:51
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Questions on timers/simulator

Dan,

Your team should have received a CD with their EduBot last fall. It has a slightly modified MPLAB and C18 that we are using.

The timing of given in the default code is dynamic and not good for precise timing. Use a timer interrupt (see http://www.chiefdelphi.com/forums/sh...ad.php?t=22879 and associated references for more information) for best results.
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #4   Spotlight this post!  
Unread 13-01-2004, 13:11
WizardOfAz's Avatar
WizardOfAz WizardOfAz is offline
Lead Mentor
AKA: Bill Bennett
FRC #1011 (CRUSH)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Tucson, AZ
Posts: 101
WizardOfAz will become famous soon enough
Send a message via AIM to WizardOfAz
Re: Questions on timers/simulator

Timers: I haven't done it yet, but there is information about how to use the timers (see prior post). I think it's the way to go, and we will probably create an autonomous mode environment that allows time driven elements by using one of the on-chip timers.

Simulation: look at the RoboEmu work that Rob Bayer did for the stamp RCs, and he is working on a version for the current RC. I don't know when it will be ready, but RoboEmu was extremely useful last year. There was a graphical input system for pushing the joystick and buttons, and graphical output showing drive levels on PWMs.

MPLAP SIM: I find it tedious and difficult to use. It knows nothing about RC i/o and the master/user processor setup, so getting inputs into it is a challenge (somebody who's figured it out please tell me I'm wrong). And I couldn't find any way to get it to display outputs other than it's variable watch feature. No printf display window or anthing like that. It's somewhat useful for testing/debugging functions in isolation, but not for simulating high level robot stimulus/response.

EDURC - perhaps the best way to test and debug code is to use a real RC. The EDURC is reasonably cheap, so your team could maybe afford to have a couple of them for programmer use. At least you can get a printf window that way, though no breakpoints or single step.

An alternative: we constructed an environment using another C IDE. In our case we used lcc but any good C IDE would work as well. The attraction to lcc is that it's free for non-commercial use and reasonably small and simple to install (compared to gcc). Comes from Univ of Virginia. The debugger is pretty good, breakpoints, single step, step into/over functions, watch variables, and so on. Anyway, we built a top level C program that reads an input file of a time sequence of joystick values and switch settings, runs the C code that will eventually be in the FRC, and writes the inputs and resulting outputs to another file. You can then read the output file to see if the behavior is as expected. Our environment is very specific to a prototype we built in the fall, so wouldn't directly meet the needs of any other robot. It is also incomplete - there are many things it does not simulate and we add to it almost daily to meet changing needs. But it could serve as a starting point if anybody's interested.

Bill
  #5   Spotlight this post!  
Unread 13-01-2004, 13:57
sscanf sscanf is offline
Registered User
#0061
 
Join Date: Jan 2004
Location: Blackstone Valley Regional, Upton, MA
Posts: 4
sscanf is an unknown quantity at this point
Re: Questions on timers/simulator

Hmmm... I'm not aware if we have the edu robot kit. I had assumed that it was for an alternate competition but I now realize it is for learning/prototyping/debug. I'll have to check with my team.

Because I am working remotely, I'm concerned about the long code/test/fix cycle. The RoboEmu would be nice as would be the edu kit. It seems that we will have to make due with the test driver appoach mentioned by Bill.

Are there many programmers in the same boat as us (i.e. for the programmers not to be local to the team)?

Dan
  #6   Spotlight this post!  
Unread 13-01-2004, 14:06
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,854
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Questions on timers/simulator

Quote:
Originally Posted by sscanf
Hmmm... I'm not aware if we have the edu robot kit. I had assumed that it was for an alternate competition but I now realize it is for learning/prototyping/debug. I'll have to check with my team.

Dan
The EDU controller is also necessary to drive the IR beacon for your test field.
If you can get it to develop the basic code the team will need it back if they use the IR sensors. Of course, if you don't get it then they won't be using the IR sensors I suppose.

I found it very useful in developing and testing a training series of various autonomous styles, filters, and sensor examples. I can email them if you think they'd help you.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 13-01-2004 at 14:09.
  #7   Spotlight this post!  
Unread 14-01-2004, 21:02
Steven Carmain Steven Carmain is offline
Bit Twiddler
FRC #2832
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Westland, MI
Posts: 92
Steven Carmain will become famous soon enough
Re: Questions on timers/simulator

Quote:
Originally Posted by WizardOfAz
EDURC - perhaps the best way to test and debug code is to use a real RC. The EDURC is reasonably cheap, so your team could maybe afford to have a couple of them for programmer use. At least you can get a printf window that way, though no breakpoints or single step.
The EDURC is not compatible with the full controller, though. They are configured different including different pinouts for switches and no OI to play with either.
__________________
2017 - Team 2832 Mentor
2016 - Team 6013 Mentor
2002-05 - Team 45 Software/Electrical

A robot is like a campfire: it takes a while to bulid it, and then everyone surounds it!
A world without standards is chaos. A world with standards is chaos.
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
3 Questions!!! (1/6/04) Andy Grady General Forum 13 06-01-2004 20:41
3 Questions!!! (1/5/04) Andy Grady General Forum 8 05-01-2004 16:01
$3500 limit - Who does not have questions Raul Rules/Strategy 5 12-01-2003 11:31
traction questions AlbertW Rules/Strategy 2 05-01-2003 17:58
Update 7 - Behind Schedule (or out of questions)? archiver 2000 2 23-06-2002 22:58


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

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