Go to Post ...playing hard and impressing teams is way more valuable than trying to play god with the rankings. - JamesBrown [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 16-01-2006, 16:43
railerobotics's Avatar
railerobotics railerobotics is offline
Registered User
FRC #0935
 
Join Date: Jan 2006
Location: Newton, KS
Posts: 190
railerobotics will become famous soon enough
Controlling motors

What part of the code controls the the motors. Our speed controls are calibrated but the motors do not spin when we use the joysticks. I'm guessing its somewhere in the programming.
  #2   Spotlight this post!  
Unread 16-01-2006, 16:45
Andrew Blair's Avatar
Andrew Blair Andrew Blair is offline
SAE Formula is FIRST with Gasoline.
FRC #0306 (CRT)
Team Role: Alumni
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Corry
Posts: 1,193
Andrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond repute
Send a message via AIM to Andrew Blair Send a message via Yahoo to Andrew Blair
Re: Controlling motors

The standard is in the "default routine" function, in user_routines.c. There, you assign operator inputs to pwm outputs. Also, in the "user initialization" function, make sure that the "default routine" function is not commented out.
__________________
Reading makes a full man, conference a ready man, and writing an exact man.
-Sir Francis Bacon

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."
-Albert Einstein
  #3   Spotlight this post!  
Unread 16-01-2006, 17:16
Jake M Jake M is offline
void* Jake;
FRC #1178 (DURT)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Missouri
Posts: 118
Jake M has a spectacular aura aboutJake M has a spectacular aura about
Re: Controlling motors

In the defualt code, it goes as such.....

main()->Process_Data_From_Master_uP()->Default_Routine()

The second two can be found in user_routines.c. Default_Routine() is not called from User_Initialization() by default.

If you're using the 'bells and whistles' version of Kevin Watson's camera code, Default_Routine() is probably still commented out.

To use the joysticks, the variables you need are p1_y and p1_x, where 1 is the number of whichever port your joystick is plugged into. The default code includes tank drive through pwm01 and pwm02, by assigning p1_y and p2_y to them, respectively. It also provides single joystick drive through pwm13 and pwm14 for the right wheel, and pwm15 and pwm16 for the left wheel. Although, some problems with this may arise from the fact that PWMs 13 - 16 are generated by the code and not by the microprocessor. If you want to use single joystick drive, I'd recommend assigning the equations that calculate the motor values to another set of PWMs.
__________________
Code:
void function(void)
 {
  function();
 }
  #4   Spotlight this post!  
Unread 16-01-2006, 17:25
railerobotics's Avatar
railerobotics railerobotics is offline
Registered User
FRC #0935
 
Join Date: Jan 2006
Location: Newton, KS
Posts: 190
railerobotics will become famous soon enough
Re: Controlling motors

I am trying to set up a two joystick drive(tank drive) but I am a little confusing on how to actually go about doing this.
  #5   Spotlight this post!  
Unread 16-01-2006, 17:34
Mike's Avatar
Mike Mike is offline
has common ground with Matt Krass
AKA: Mike Sorrenti
FRC #0237 (Sie-H2O-Bots (See-Hoe-Bots) [T.R.I.B.E.])
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: Watertown, CT
Posts: 1,003
Mike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond repute
Re: Controlling motors

Quote:
Originally Posted by railerobotics
I am trying to set up a two joystick drive(tank drive) but I am a little confusing on how to actually go about doing this.
Ok, you may have noticed the four ports on the operator interface. Find out which two your two joysticks are plugged in.

pX_y is the value that we want. It's the value of the y axis on the joystick plugged into port X. So if you want to find the value of the y axis on a joystick plugged into port 1, it would be p1_y. These values are between 0 and 254. 127 is neutral, 0 is full reverse and 254 is full forward.

Now look on your robot controller. There is a set of 16 3-pin male headers. This is where your motors are connected. They are labeled 1-16. Find out which one the motor you wish to control is on. You can set these motors to a value between 0 and 254, same as the joysticks. The macro for these is pwmXX where XX is a value between 01 and 16. To set it to a value you simply do pwmXX = 127;

Now, linking them together. If a motor can take in a value between 0 and 254, and a joystick can output a value between 0 and 254, this becomes very easy.
pwmXX = pZ_y;
Where XX is the value between 01 and 16; depending on what port your motor is connected to. Z is varying depending on what port your joystick is connected to.

Good luck.
__________________
http://www.mikesorrenti.com/
  #6   Spotlight this post!  
Unread 16-01-2006, 18:06
railerobotics's Avatar
railerobotics railerobotics is offline
Registered User
FRC #0935
 
Join Date: Jan 2006
Location: Newton, KS
Posts: 190
railerobotics will become famous soon enough
Re: Controlling motors

Thanks for all of your help. I got that to work but now how to I reverse one of the joysticks axis. One the right side of the robot when I move the joystick forward it makes the wheels on that side go in reverse.
  #7   Spotlight this post!  
Unread 17-01-2006, 17:17
viewtyjoe viewtyjoe is offline
Code Monkey
AKA: Nathaniel Davis
no team
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2003
Location: West Chester
Posts: 14
viewtyjoe is an unknown quantity at this point
Send a message via AIM to viewtyjoe
Re: Controlling motors

That would be because your gearboxes or motors are mounted in opposite directions. The easiest way to remedy this problem is just to do something like this:

pwm01 = 254 - p1_y

This would reverse the input from your joystick, but the problem that you'll run into is that the motors don't run in the same speeds forward and reverse, or even two motors going forward. You may have to develop a control system that tries to remedy this situation if it is really bad.
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
6 CIM Motors? psquared89 Kit & Additional Hardware 16 09-01-2006 08:47
2 Globe Motors??? ChuckDickerson Motors 18 25-01-2005 15:53
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 04:31.

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