Go to Post FRC: more like the real world than we could ever want. - efoote868 [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 25-01-2004, 18:53
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
FRC Code (Motors, etc...)

Ok, if my memory serves me correctly, the default code uses the PWM01 & PWM08 for motor movement. Is there a way to change this? Also, how do you use PWM's exactly (I was dropped from the programmer's group last year, so most of the stuff left my mind)?
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"
  #2   Spotlight this post!  
Unread 25-01-2004, 20:59
mtrawls's Avatar
mtrawls mtrawls is offline
I am JVN! (John von Neumann)
#0122 (NASA Knights)
Team Role: Programmer
 
Join Date: Mar 2003
Location: Hampton, VA
Posts: 295
mtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to behold
Send a message via AIM to mtrawls
Re: FRC Code (Motors, etc...)

Quote:
Originally Posted by Raven_Writer
Ok, if my memory serves me correctly, the default code uses the PWM01 & PWM08 for motor movement. Is there a way to change this? Also, how do you use PWM's exactly (I was dropped from the programmer's group last year, so most of the stuff left my mind)?
Look at their Default_Routine function in user_routines.c for their joystick code. Specifically, here:

Code:
 /*---------- 1 Joystick Drive ----------------------------------------------
  *--------------------------------------------------------------------------
  *  This code mixes the Y and X axis on Port 1 to allow one joystick drive. 
  *  Joystick forward  = Robot forward
  *  Joystick backward = Robot backward
  *  Joystick right    = Robot rotates right
  *  Joystick left     = Robot rotates left
  *  Connect the right drive motors to PWM13 and/or PWM14 on the RC.
  *  Connect the left  drive motors to PWM15 and/or PWM16 on the RC.
  */  
  pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);
  pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);
How do you use PWMs? Well, a lot could be said here, I suppose. The simple answer: set pwmXX to whatever value you want it set to! Then, make sure that you have the speed controller (or whatever else you're working with), hooked up, via a pwm cable, to the proper place on the controller (i.e., corresponding to what is used in the code, or either change which is used in the code to correspond to how you hooked up). A more specific question, (suprise), would elicit a more specific response, but ... All you really have to do is output some value to the variable pwmXX, and if you've got something plugged into the right pwm slot then it will do what it is supposed to (ideally )
  #3   Spotlight this post!  
Unread 25-01-2004, 21:02
Obi's Avatar
Obi Obi is offline
Registered User
#0870
 
Join Date: Jan 2004
Location: Southold
Posts: 18
Obi is an unknown quantity at this point
Re: FRC Code (Motors, etc...)

Quote:
Originally Posted by Raven_Writer
Ok, if my memory serves me correctly, the default code uses the PWM01 & PWM08 for motor movement. Is there a way to change this? Also, how do you use PWM's exactly (I was dropped from the programmer's group last year, so most of the stuff left my mind)?
Well let's get you aquainted to the robot and C...

The RC on the robot has multiple PIN spots, each with their own possible values. So, you can plug any speed controller / relay into any PWM. You have to make sure that you designate it in the code, though.

Here's an example: The default code mixes the X and Y values (X = Left/Right, Y = Up/Down) of one joystick on port 1. It then outputs it's values to PWM13, PWM14, PWM15, and PWM16.

And another example: Let's say that you want Tank Drive. Obviously, that means that the left motors move the same way and the right move the same way. Use the following code to get tank drive. (By the way, this assumes that you have two joysticks, each hooked up to the OI on ports 1 and 2. Also, make sure that PWMs 1 - 4 are not given values anywhere in your existing code)
Code:
pwm01 = pwm02 = p1_y; /* PWMs 1-2 are equal to each other, so put these on the left motors.  p1_y means port 1, y-axis.  So the left motors are controlled by one joystick when it is pushed forward.*/
pwm03 = pwm04 = p2_y; /* Much like the above code except that the PWMs are switched to 3-4 and p2_y is used instead.  Connect pwm3-4 to your right motors.*/
I haven't tested that one exactly, but it should work.
__________________
[hr]
Southold Robotics Team #870 (RICE)
  #4   Spotlight this post!  
Unread 26-01-2004, 07:21
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
Re: FRC Code (Motors, etc...)

Thanks to you both

I understand now (never quite understood how it all worked).
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"
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
FRC default code hedgehogger Programming 2 21-01-2004 18:41
Problem with FRC Default code AsimC Programming 2 11-01-2004 19:22
Looking for practice motors & extra tape drive parts? archiver 2000 1 23-06-2002 22:54
"Motors and Drive train edition" of Fresh From the Forum Ken Leung CD Forum Support 6 29-01-2002 12:32
Drill Motors TF8 Motors 19 12-12-2001 13:13


All times are GMT -5. The time now is 14:26.

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