Go to Post But please, don't attempt to subvert the rules. It almost invariably becomes more trouble than it's worth. - Billfred [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 17-02-2004, 11:37
hedgehogger hedgehogger is offline
Registered User
#1348
 
Join Date: Jan 2004
Location: John F.Kennedy Highschool
Posts: 31
hedgehogger can only hope to improve
Programming Help

Hey,


We need to look at a sample piece of the main part of somebodys arm code thanks! We are using C Programming and we need just an idea on how we are gonna program it thanks
-chris
  #2   Spotlight this post!  
Unread 17-02-2004, 12:10
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,188
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Programming Help

it all depends on what you want to do..
1) What pwm output will it be on
2)Do you want it to include special functions (such as a trigger to make it go to a certain point)

These are easily modifiable in the given default code.. just goto user_routines.c in the workspace, then find where it shows the mappings of inputs (joysticks) to outputs (pwm outouts, controlling motors)
  #3   Spotlight this post!  
Unread 17-02-2004, 12:10
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: Programming Help

What do you want your arm to do? How is it wired up? Do you have any sensors doing anything? I'll post some sample code later, but the chances that it will be right for your arm are slim...
  #4   Spotlight this post!  
Unread 17-02-2004, 12:56
hedgehogger hedgehogger is offline
Registered User
#1348
 
Join Date: Jan 2004
Location: John F.Kennedy Highschool
Posts: 31
hedgehogger can only hope to improve
Re: Programming Help

the only thing the arm does that excludes the grippers is move 270 degrees. And we are using the van door motor!
  #5   Spotlight this post!  
Unread 17-02-2004, 13:00
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: Programming Help

then you are going to want to control the motor using a Victor, and thus a PWM. set the variable pwmXX (XX being the number of the output the victor is connected to) to a number from 0 to 255 - 0 is full reverse, 255 is full forward, and 127 is neutral (stopped).
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
  #6   Spotlight this post!  
Unread 17-02-2004, 13:13
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: Programming Help

If you want it to move exactly 270 degrees, you will need some sort of feedback system. I would recommend a pot - do you know how to wire one up?
  #7   Spotlight this post!  
Unread 17-02-2004, 13:52
Jeff McCune's Avatar
Jeff McCune Jeff McCune is offline
Alpha Geek
#0677 (The Wirestrippers)
Team Role: Mentor
 
Join Date: Jan 2003
Location: The Ohio State University
Posts: 67
Jeff McCune is on a distinguished road
Send a message via ICQ to Jeff McCune Send a message via AIM to Jeff McCune
Re: Programming Help

Quote:
Originally Posted by steven114
If you want it to move exactly 270 degrees, you will need some sort of feedback system. I would recommend a pot - do you know how to wire one up?
You need to read the 2004 Programming Reference guide located here:
http://www.innovationfirst.com/FIRST...10-29-2003.pdf

You also need to read the 2004 FRC Default Code Reference Guide:
http://www.innovationfirst.com/FIRST...e_2004-1-7.pdf

The second PDF document explains in detail what's going on in the default code that Innovation First provides.
__________________
Team 677 - The Wirestrippers - Columbus School for Girls and The Ohio State University
EMAIL: mccune@ling.ohio-state.edu

...And all you touch and all you see
Is all your life will ever be...
  #8   Spotlight this post!  
Unread 17-02-2004, 14:00
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,188
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Programming Help

heres a very helpful power point presentation by the people at Innovation First http://www.usfirst.org/robotics/C_help.htm
  #9   Spotlight this post!  
Unread 17-02-2004, 15:15
JoshJ JoshJ is offline
Registered User
#0316 (LuNaTeCs)
Team Role: College Student
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Salem County
Posts: 44
JoshJ is on a distinguished road
Send a message via AIM to JoshJ
Re: Programming Help

This may be oversimplified, but all you have to do is use a PWM output as a function of a joystick input. something like pwm(#)=p2_y; (or whatever port your joystick is in). U can even use the Limit_Mix function so that it reads pwm(#)=Limit_Mix(2000+p2_y);

edit: Actually if you are using a joystick, all you have to do is plug it into port2 on the OI, and ur speed controller for the globe into PWM OUT 2 and you are set to go. The y-axis controls the arm. (Default code can do wonders lol)

Last edited by JoshJ : 17-02-2004 at 15:24.
  #10   Spotlight this post!  
Unread 19-02-2004, 11:57
shsdragon shsdragon is offline
Registered User
#1345
Team Role: Programmer
 
Join Date: Jan 2004
Location: Florida
Posts: 8
shsdragon is on a distinguished road
Send a message via AIM to shsdragon Send a message via Yahoo to shsdragon
Re: Programming Help

{
static long timeCounter = 0; //this will count the number of 26.2ms ticks that have passed

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! */

if(timeCounter <= 115) //3 seconds / 26.2ms = 114.5
{
pwm13 = pwm15 = 30;
}
else if(timeCounter <= 134) //we'll give the relays about .5 seconds to switch
{
pwm13 = pwm15 = 0;
relay1_fwd = relay2_fwd = 1;
}
else
{
//put stuff to do after the other things here
//you can also add more else-if statements to time other things
}

Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
timeCounter++; //add one to the tick count
}
}
}

this should work fine - hope it helps!


mmy motoors don't move
__________________
[/font][color=Red]Jearvon Dharrie
  #11   Spotlight this post!  
Unread 19-02-2004, 12:11
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: Programming Help

Quote:
Originally Posted by shsdragon
{
static long timeCounter = 0; //this will count the number of 26.2ms ticks that have passed

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! */

if(timeCounter <= 115) //3 seconds / 26.2ms = 114.5
{
pwm13 = pwm15 = 30;
}
else if(timeCounter <= 134) //we'll give the relays about .5 seconds to switch
{
pwm13 = pwm15 = 0;
relay1_fwd = relay2_fwd = 1;
}
else
{
//put stuff to do after the other things here
//you can also add more else-if statements to time other things
}

Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
timeCounter++; //add one to the tick count
}
}
}

this should work fine - hope it helps!


mmy motoors don't move
shs, i already sent you a PM answering that question that you PMed me before you posted it here - check your PMs. but in the name of simplicity...

you need to add a call to Generate_Pwms() after the Putdata() line, like this:
Code:
void User_Autonomous_Code(void)
{
  static long timeCounter = 0; //this will count the number of 26.2ms ticks that have passed

  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! */

        if(timeCounter <= 115) //3 seconds / 26.2ms = 114.5
        {
             pwm13 = pwm15 = 30;
        }
        else if(timeCounter <= 134) //we'll give the relays about .5 seconds to switch
        {
             pwm13 = pwm15 = 0;
             relay1_fwd = relay2_fwd = 1;
        }
        else
        {
             //put stuff to do after the other things here
             //you can also add more else-if statements to time other things
        }

        Putdata(&txdata);   /* DO NOT DELETE, or you will get no PWM outputs! */
        Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
        timeCounter++; //add one to the tick count
    }
  }
}
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
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
Programming Compatition Angela06 Programming 30 08-04-2005 23:12
A few questions on programming the Control System Avarik Control System 21 08-02-2004 11:42
Pneumatics electrical wiring and programming archiver 2001 1 23-06-2002 23:10
Error found in programming for the pump and pressure switch sjharobotics Programming 4 06-02-2002 17:46
pbasic programming punarhero Programming 4 21-01-2002 23:32


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

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