Go to Post your time is better spent in the stands, watching what the robots actually do, as opposed to listening to the builders talk about what they're [I]supposed[/I] to do. - sanddrag [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 01-02-2007, 15:41
Metalgod4eva Metalgod4eva is offline
Registered User
None #0870
 
Join Date: Jan 2007
Location: Southold
Posts: 7
Metalgod4eva is an unknown quantity at this point
Function for O over a serial.

I am a happy computer programmer and well never played around with a robot before. Being a computer programmer I am use to the computer standard ways of doing things. I wrote this for the robot
Code:
 #include <stdio.h>
#define AMOUNT_OF_LINES 1
int reprint(void)
{
int i,x,r;
int farray[200],*fa;
FILE *fp;
fp = fopen("c:\\text3.txt", "r");
fa = &farray[0];

for(x=0;x<123;x++) 
{                 
                  
    *(fa+x) = (fgetc( fp ));
     printf("%s",fa+x);
}
fclose(fp);
}
int write(void)
{
 	  int c,x,i,y,n, *sp, string[200];  
      sp = &string[0];
 	  FILE *fp;
 	  fp=fopen("c:\\text3.txt", "w");
    
    for(x=0;x<3;x++){
      scanf("%s",sp+x); }
      for(n=0;n<3;n++) {
      fprintf(fp,"%s",sp+n); } 
      fclose(fp);
}
int main() {
   int x;
   write(); 
    reprint();
    scanf("%d",x);
    /* by metalgod4eva team 870 */
}
/*for loops not complete, still need to make another function */
Well as you can read its a nice file IO, I am looking to use the serial to O back to the computers hard drive and save and in looking in the source for the serial I found no O function back over its device. Maybe I just over looked it and its there or I will have to write it. If anyone has an idea or solution let me know. Also I think I might have to use fwrite instead of fprintf but no issues there. Dont complain if you do run it and find the garbage data I have not finished the fuction for the for loops yet. Thanks for your time and have a nice day!
  #2   Spotlight this post!  
Unread 01-02-2007, 18:35
bear24rw's Avatar
bear24rw bear24rw is offline
Team 11 Programming Captain
AKA: Max T
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2005
Location: Flanders, NJ
Posts: 385
bear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to behold
Send a message via AIM to bear24rw
Re: Function for O over a serial.

The code for the robot isnt exactly like standard C for a computer, you might want to look at the default code

www.kevin.org/frc

And read the programming ref guide from IFI

http://www.ifirobotics.com/docs/lega...2-apr-2004.pdf
  #3   Spotlight this post!  
Unread 01-02-2007, 20:54
chris31 chris31 is offline
Team 2021 Captain
AKA: Chris Davidson
FRC #2021 (FA Robotics)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2006
Location: Atlanta, GA/ Fredericksburg,VA
Posts: 949
chris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond repute
Send a message via AIM to chris31
Re: Function for O over a serial.

If I understand this is what you want. Just Printf all you info like you normally would. But write a custom app that reads those values and logs them to a text file. Is that what you want?
  #4   Spotlight this post!  
Unread 01-02-2007, 21:31
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: Function for O over a serial.

Even simpler, forget a custom App, depending on the kind of data you're using a properly formatted printf(), Hyperterm and Excel are your best friend.

I had to monitor the PID response for last years robot and a bunch of numbers wasn't doing it for me, so I had a printf like this:

Code:
printf("%d,%d,%d,%d,%d",kp, ki, kd, error, output); // This is a loose guess at what it was
Then I told HyperTerm to save to a file, and let the robot run, then using Notepad++ (it handles large text files better than notepad does) I trimmed out the section I needed and imported to Excel as a CSV (Comma Separated Values) file. Then I re-saved to .xls and started graphing, thanks to Mark McLeod for that awesome tip.
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
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
Dampening function for driving. Brad Voracek Programming 2 13-01-2007 14:18
Loop time for OperatorControl function? Debug blows... Chris_Elston Programming 10 13-02-2006 14:42
USB serial adapter for OSX? Validius Programming 1 05-01-2006 01:43
FIRST Over For WRONG 1430 russell General Forum 13 26-11-2005 16:01
USB to Serial converter for controller Ryan Collings Programming 10 22-01-2005 13:14


All times are GMT -5. The time now is 04: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