Go to Post Is it weird we think speed controllers are sexy? - vivek16 [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-07-2006, 18:40
Eric W. Jones's Avatar
Eric W. Jones Eric W. Jones is offline
Rack & Roll, baby!
FRC #1646 (Precision Guessworks)
Team Role: Programmer
 
Join Date: Jun 2006
Rookie Year: 2006
Location: Lafayette, Indiana
Posts: 231
Eric W. Jones will become famous soon enoughEric W. Jones will become famous soon enough
Globe Motor Programming Questions

I am the (extremely) green head student programmer for 1646. I have very little practical experience programming in C, and I would appreciate any help anyone can provide.

::Long Intake of Breath::

Now for the question. We have recently installed a globe motor onto our robot and I need to know how to program it. I would greatly appreciate any advice or links provided by more experienced programmers.
  #2   Spotlight this post!  
Unread 17-07-2006, 18:52
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: Globe Motor Programming Questions

First you need to wire the globe motor to a speed controller, then connect a PWM wire from the speed controller to one of the PWM output on the robot controller... to controller the motor from your program you set the PWM output to a certain value..

Assuming you connected the speed controller to PWM output 1
pwm01 = 0; // Full backward
pwm01 = 127; // Neutral (motor doesnt move)
pwm01 = 255; // Full foward

If you connect it to another output just change the pwm number (pwm01, pwm02, pwm03, etc...)

You can choose any value between 0 and 255 to move the motor at different speeds and directions...

You can also map it to a joystick..
pwm01 = p1_y;
This is set the motor speed to the value of the y axis on port 1

Hope that enough to get you started...
  #3   Spotlight this post!  
Unread 17-07-2006, 19:04
Eric W. Jones's Avatar
Eric W. Jones Eric W. Jones is offline
Rack & Roll, baby!
FRC #1646 (Precision Guessworks)
Team Role: Programmer
 
Join Date: Jun 2006
Rookie Year: 2006
Location: Lafayette, Indiana
Posts: 231
Eric W. Jones will become famous soon enoughEric W. Jones will become famous soon enough
Re: Globe Motor Programming Questions

Thanks a lot. This should be very helpful.
  #4   Spotlight this post!  
Unread 17-07-2006, 23:37
Pat Fairbank's Avatar
Pat Fairbank Pat Fairbank is offline
Circuit Breaker
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2001
Location: San Jose, CA
Posts: 2,132
Pat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond repute
Send a message via MSN to Pat Fairbank
Re: Globe Motor Programming Questions

Quote:
Originally Posted by bear24rw
Assuming you connected the speed controller to PWM output 1
pwm01 = 0; // Full backward
pwm01 = 127; // Neutral (motor doesnt move)
pwm01 = 255; // Full foward
A word of correction - the full forward value should be 254, not 255. This is because the control system uses two values of 255 to mark the beginning of a radio packet, so if you assign 255 to a PWM output variable it will wreak havoc with the radio communications.
__________________
Patrick Fairbank
Team 254 | Mentor (2012-)
Team 1503 | Mentor (2007-2011)
Team 296 | Alumnus (2001-2004) | Mentor (2005-2006)

patfairbank.com
  #5   Spotlight this post!  
Unread 18-07-2006, 01:10
MattD's Avatar
MattD MattD is offline
Registered User
AKA: Matthew Douglas
FRC #0228 (GUS Robotics)
Team Role: Alumni
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Indianapolis, IN
Posts: 185
MattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to behold
Send a message via AIM to MattD
Re: Globe Motor Programming Questions

On my team we have set PWM outputs to 255 and there were no known problems that occured because of it. It may be because PWM 1 to PWM 10 all have some other byte that is sent before it and none of them were ever valued at 0xFF, or maybe it is automatically adjusted in the Putdata function.

I am relatively new at this, so I'm not really sure what if what I am talking about here is entirely correct.
__________________
GUS Robotics Team 228

2010 WPI Engineering Inspiration Award
2010 WPI Regional Champions (Thanks 230 & 20!)
2010 CT VEX Champions
2010 CT VEX Innovate Award
2009 QCC VEX Champions
2009 CT Motorola Quality Award
2007 CT J&J Sportsmanship Award
2006 CT Best Website Award
  #6   Spotlight this post!  
Unread 18-07-2006, 09:36
Richard Wallace's Avatar
Richard Wallace Richard Wallace is online now
I live for the details.
FRC #3620 (Average Joes)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1996
Location: Southwestern Michigan
Posts: 3,666
Richard Wallace has a reputation beyond reputeRichard Wallace has a reputation beyond reputeRichard Wallace has a reputation beyond reputeRichard Wallace has a reputation beyond reputeRichard Wallace has a reputation beyond reputeRichard Wallace has a reputation beyond reputeRichard Wallace has a reputation beyond reputeRichard Wallace has a reputation beyond reputeRichard Wallace has a reputation beyond reputeRichard Wallace has a reputation beyond reputeRichard Wallace has a reputation beyond repute
Re: Globe Motor Programming Questions

All the responses here so far have been generally applicable to any of the motors in the FRC kit of parts. Do you still have a question that relates specifically to the Globe motor?
__________________
Richard Wallace

Mentor since 2011 for FRC 3620 Average Joes (St. Joseph, Michigan)
Mentor 2002-10 for FRC 931 Perpetual Chaos (St. Louis, Missouri)
since 2003

I believe in intuition and inspiration. Imagination is more important than knowledge. For knowledge is limited, whereas imagination embraces the entire world, stimulating progress, giving birth to evolution. It is, strictly speaking, a real factor in scientific research.
(Cosmic Religion : With Other Opinions and Aphorisms (1931) by Albert Einstein, p. 97)
  #7   Spotlight this post!  
Unread 18-07-2006, 14:29
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: Globe Motor Programming Questions

Quote:
Originally Posted by Pat Fairbank
A word of correction - the full forward value should be 254, not 255. This is because the control system uses two values of 255 to mark the beginning of a radio packet, so if you assign 255 to a PWM output variable it will wreak havoc with the radio communications.
I set motors to 255 all the time and have had no problem with it...
  #8   Spotlight this post!  
Unread 19-07-2006, 08:57
Daniel_LaFleur's Avatar
Daniel_LaFleur Daniel_LaFleur is offline
Mad Scientist
AKA: Me
FRC #2040 (DERT)
Team Role: Engineer
 
Join Date: Apr 2005
Rookie Year: 2003
Location: Peoria, IL
Posts: 1,972
Daniel_LaFleur has a reputation beyond reputeDaniel_LaFleur has a reputation beyond reputeDaniel_LaFleur has a reputation beyond reputeDaniel_LaFleur has a reputation beyond reputeDaniel_LaFleur has a reputation beyond reputeDaniel_LaFleur has a reputation beyond reputeDaniel_LaFleur has a reputation beyond reputeDaniel_LaFleur has a reputation beyond reputeDaniel_LaFleur has a reputation beyond reputeDaniel_LaFleur has a reputation beyond reputeDaniel_LaFleur has a reputation beyond repute
Send a message via MSN to Daniel_LaFleur
Re: Globe Motor Programming Questions

We do not use 255 for a pwm output since it may cause an issue.

Also be aware that there is a dead band of ~ 4 pwm counts around the neutral (pwmXX=127) position. Thus 123-131 tend not to move the motor.

Also, The speed of the motor going full forward may (probably will) differ from full speed reverse.
  #9   Spotlight this post!  
Unread 19-07-2006, 20:34
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Globe Motor Programming Questions

Quote:
Originally Posted by Daniel_LaFleur
We do not use 255 for a pwm output since it may cause an issue.

Also be aware that there is a dead band of ~ 4 pwm counts around the neutral (pwmXX=127) position. Thus 123-131 tend not to move the motor.

Also, The speed of the motor going full forward may (probably will) differ from full speed reverse.
I just do this:

Code:
...
if ((pwm01 > 127) && (pwm01 < 251)) pwm01+=4;

else if ((pwm01 < 127) && (pwm01 > 3)) pwm01-=4;
...
-Q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08

Last edited by Qbranch : 19-07-2006 at 21:03.
  #10   Spotlight this post!  
Unread 19-07-2006, 20:37
Pat Fairbank's Avatar
Pat Fairbank Pat Fairbank is offline
Circuit Breaker
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2001
Location: San Jose, CA
Posts: 2,132
Pat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond repute
Send a message via MSN to Pat Fairbank
Re: Globe Motor Programming Questions

Quote:
Originally Posted by Qbranch
I just do this:
Code:
...
if (pwm01 > 127) pwm01+=4;

else if (pwm01 < 127) pwm01-=4;
...
Um... wouldn't that cause pwm01 to overflow at values near 254? (and underflow at values near 0?)
__________________
Patrick Fairbank
Team 254 | Mentor (2012-)
Team 1503 | Mentor (2007-2011)
Team 296 | Alumnus (2001-2004) | Mentor (2005-2006)

patfairbank.com
  #11   Spotlight this post!  
Unread 19-07-2006, 21:00
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Globe Motor Programming Questions

Yeah it does, i was originally only referring to taking out the deadband. I just edited my post and added the limit code in.

-Q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #12   Spotlight this post!  
Unread 20-07-2006, 04:00
Matt H. Matt H. is offline
Long Distance Mentor
FRC #1726 (N.E.R.D.S.)
Team Role: Alumni
 
Join Date: May 2006
Rookie Year: 2007
Location: Sierra Vista, AZ
Posts: 238
Matt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond repute
Re: Globe Motor Programming Questions

To respond to the original question; the type of motor is not incredibly important as long as it runs on a PWM signal. What you need to do is set your PWMs as shown in the first response and assuming you are using the FRC robot controller and default MP labs code it will convert that data into a usable signal for any standard PWM motor.
  #13   Spotlight this post!  
Unread 02-08-2006, 19:04
Eric W. Jones's Avatar
Eric W. Jones Eric W. Jones is offline
Rack & Roll, baby!
FRC #1646 (Precision Guessworks)
Team Role: Programmer
 
Join Date: Jun 2006
Rookie Year: 2006
Location: Lafayette, Indiana
Posts: 231
Eric W. Jones will become famous soon enoughEric W. Jones will become famous soon enough
Re: Globe Motor Programming Questions

We've generally avoided getting the pwms too close to 255. We just put in some code that says something like:

if(p1_y >= 250)
pwm01 = 250

this has worked well for us in the past, as if the pwm output exeeds 255, then it will loop back onto itself and tear up your motors. A pwm output of 256 is essentially 0.

If I'm wrong, please correct me.
  #14   Spotlight this post!  
Unread 03-08-2006, 08:37
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,856
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: Globe Motor Programming Questions

You're correct that if pwm01 gets set to a number greater than 255 it will wrap around to zero and you'll suddenly go from full forward to full reverse.

A note on using a pwm value of 255.

The reason to avoid using the value 255 is that sequential 255's in a transmission packet is the standard indication of the beginning of a packet, so if pwm03 and pwm04 (which are side-by-side in the transmission packet) were both transmitted as 255 the packet handler would think pwm05 was really the start of a transmission packet and the OI would be handed really bogus data.

Those of you allowing 255 are protected from the adverse effects, because the Master code takes all your carefully set values of 255 and changes them to 254 anyway. You can test this by setting the pwm values to 255 in your code, then using the Dashboard to see what values actually arrives at the OI.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #15   Spotlight this post!  
Unread 04-08-2006, 20:40
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 7,011
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Globe Motor Programming Questions

Quote:
Originally Posted by Matt H.
To respond to the original question; the type of motor is not incredibly important as long as it runs on a PWM signal. What you need to do is set your PWMs as shown in the first response and assuming you are using the FRC robot controller and default MP labs code it will convert that data into a usable signal for any standard PWM motor.
Please note that the motors here run on Direct Current. They are NOT "PWM" Motors. We use a PWM signal to control a Motor Speed Controller (such as a Victor) which varies the DC current* to the motor, making it move at different speeds and such.

However, the point that the motor type is not particularly important is absolutely correct.

*Technically speaking, it is a pulsating signal at a relatively high frequency, so high that the motor reacts to the current as it would react to a variable DC signal.
__________________

I am N2IRZ - What's your callsign?
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
globe motors arabsponsor Motors 16 29-01-2005 00:12
2 Globe Motors??? ChuckDickerson Motors 18 25-01-2005 15:53
Globe Motors? Brett W General Forum 3 10-01-2003 21:13
Globe Motors archiver 2000 1 24-06-2002 00:15
Spare Globe Motors archiver 2000 9 23-06-2002 22:48


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