Go to Post I think your robot is lacking in non-threatening, huggable design. - Kevin Sevcik [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 23-11-2013, 11:57
Zaque Zaque is offline
FF: Bobo Brigade
AKA: Zachary H.
FRC #3352 (Flaming Monkeys)
Team Role: Programmer
 
Join Date: Mar 2013
Rookie Year: 2013
Location: Belvidere, Illinois
Posts: 91
Zaque has a spectacular aura aboutZaque has a spectacular aura aboutZaque has a spectacular aura about
Invert Motors Physically or in Code?

Hi all,
I was wondering if there is a "preferred" or "correct" method of inverting motors. Specifically, should it be done in code or by switching the wires, or by some other third method of which I am not aware?

Thanks,
Zaque
__________________
Zaque (Zach) H.
President
Programming/Electrical Lead
  #2   Spotlight this post!  
Unread 23-11-2013, 12:04
Pratik Kunapuli's Avatar
Pratik Kunapuli Pratik Kunapuli is offline
Probably browning-out on Astro-Turf
FRC #1648 (G3 Robotics)(EWCP)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Atlanta, GA
Posts: 143
Pratik Kunapuli is a name known to allPratik Kunapuli is a name known to allPratik Kunapuli is a name known to allPratik Kunapuli is a name known to allPratik Kunapuli is a name known to allPratik Kunapuli is a name known to all
Re: Invert Motors Physically or in Code?

I believe that the "correct" practice is to have all of the motors red-to-red and black-to-black, and then invert the direction in code.
__________________
Official Driving Record: 101-59-0
2012-2015 Student 341 Miss Daisy
2015-Current Mentor 1648 G3 Robotics
  #3   Spotlight this post!  
Unread 23-11-2013, 12:26
MichaelBick MichaelBick is online now
Registered User
FRC #1836 (MilkenKnights)
Team Role: Alumni
 
Join Date: Oct 2011
Rookie Year: 2010
Location: Los Angeles
Posts: 734
MichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant future
Re: Invert Motors Physically or in Code?

The only time we invert wires physically is if we are in a rush, but we always switch it back later. Otherwise we try to always change motors in code so that if we ever have to switch the motor nobody gets confused.
__________________
Team 1836 - The Milken Knights
2013 LA Regional Champions with 1717 and 973
2012 LA Regional Finalists with 294 and 973
To follow Team 1836 on Facebook, go to http://www.facebook.com/MilkenKnights
To go to our website, go to http://milkenknights.com/index.html
  #4   Spotlight this post!  
Unread 23-11-2013, 12:51
markgryzwa markgryzwa is offline
Registered User
FRC #3206 (Royal-T-Wrecks)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: MN
Posts: 30
markgryzwa is on a distinguished road
Re: Invert Motors Physically or in Code?

It really doesn't matter.
  #5   Spotlight this post!  
Unread 23-11-2013, 15:42
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,517
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Invert Motors Physically or in Code?

Never invert wires. Because the very first time someone has to trouble shoot something, replace a broken component, or unplug the motor, it WILL get plugged back together with colors matching (backwards).

Always invert the code.
  #6   Spotlight this post!  
Unread 23-11-2013, 19:34
Pault's Avatar
Pault Pault is offline
Registered User
FRC #0246 (Overclocked)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston
Posts: 618
Pault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond repute
Re: Invert Motors Physically or in Code?

I'm not sure if "correct" is the right word. But, I think it is worthwhile to set a standard that positive always means forward/up/right (or forward/up/left if you prefer, just choose 1 and stick to it). If the wiring is the one not following that standard, change the wiring. If the code is the one not following that standard, change the code. The key here is consistency.

Another tip is to never swap the wires leading out of the motor. Always swap the ones in between the speed controller and the motor. On top of this, make sure all of your motors are wired the same way. This way, if a motor breaks, you can swap it out and not have to worry if it is wired the same
  #7   Spotlight this post!  
Unread 23-11-2013, 19:36
Gregor's Avatar
Gregor Gregor is offline
#StickToTheStratisQuo
AKA: Gregor Browning
no team
Team Role: College Student
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Kingston, Ontario, Canada
Posts: 2,447
Gregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond repute
Re: Invert Motors Physically or in Code?

Quote:
Originally Posted by Pault View Post
I'm not sure if "correct" is the right word. But, I think it is worthwhile to set a standard that positive always means forward/up/right (or forward/up/left if you prefer, just choose 1 and stick to it). If the wiring is the one not following that standard, change the wiring. If the code is the one not following that standard, change the code. The key here is consistency.
Or you could just?

Quote:
Originally Posted by Tom Line View Post
Never invert wires. Because the very first time someone has to trouble shoot something, replace a broken component, or unplug the motor, it WILL get plugged back together with colors matching (backwards).

Always invert the code.
__________________
What are nationals? Sounds like a fun American party, can we Canadians come?
“For me, insanity is super sanity. The normal is psychotic. Normal means lack of imagination, lack of creativity.” -Jean Dubuffet
"Insanity is doing the same thing over and over again and expecting different results." -Albert Einstein
FLL 2011-2015 Glen Ames Robotics-Student, Mentor
FRC 2012-2013 Team 907-Scouting Lead, Strategy Lead, Human Player, Driver
FRC 2014-2015 Team 1310-Mechanical, Electrical, Drive Captain
FRC 2011-xxxx Volunteer
How I came to be a FIRSTer
<Since 2011
  #8   Spotlight this post!  
Unread 23-11-2013, 20:51
yash101 yash101 is offline
Curiosity | I have too much of it!
AKA: null
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: devnull
Posts: 1,191
yash101 is an unknown quantity at this point
Re: Invert Motors Physically or in Code?

I do not think that there is a correct or standard way of reversing a motor. Do it the way how you will find it easiest. If you are better at programming, use the code method. If you are good at electrical, rewire it.

Even though I am good at coding, I would prefer the rewiring method. On my VEX OmniBot, Heels, I rewired two motors backwards to allow me to use standard mecanum code for control!

Hopefully, this helps!
  #9   Spotlight this post!  
Unread 23-11-2013, 20:59
Mr V's Avatar
Mr V Mr V is offline
FIRST Senior Mentor Washington
FRC #5588 (Reign)
Team Role: Coach
 
Join Date: Feb 2011
Rookie Year: 2009
Location: Maple Valley Wa
Posts: 996
Mr V has a reputation beyond reputeMr V has a reputation beyond reputeMr V has a reputation beyond reputeMr V has a reputation beyond reputeMr V has a reputation beyond reputeMr V has a reputation beyond reputeMr V has a reputation beyond reputeMr V has a reputation beyond reputeMr V has a reputation beyond reputeMr V has a reputation beyond reputeMr V has a reputation beyond repute
Re: Invert Motors Physically or in Code?

I agree with Tom, always "invert" in code as the wiring and terminals are marked so that you can always connect them consistently no matter who replaces the motor or motor controller. In theory there is a much larger pool of people who might replace those items vs the pool of people who might change the code.

Much safer to comment the code that L drive motors are "inverted" than to make sure that everyone who could ever possibly change a motor, including people on other teams who may be lending a hand in the heat of the moment between finals rounds that the L drive motors are to be hooked red to (-) and black to (+). It could be particularly disastrous should you have a dual motor system and to wire one of the motors backwards so that they are fighting each other. Best case secnario your robot doesn't function, worst case you let the magic smoke out of both motors or motor controllers and now you've got two to change before the next round.
__________________
All statements made on Chief Delphi by me are my own opinions and are not official FIRST rulings or opinions and should not be construed as such.




https://www.facebook.com/pages/Team-...77508782410839
  #10   Spotlight this post!  
Unread 23-11-2013, 21:52
Tristan Lall's Avatar
Tristan Lall Tristan Lall is offline
Registered User
FRC #0188 (Woburn Robotics)
 
Join Date: Aug 2001
Rookie Year: 1999
Location: Toronto, ON
Posts: 2,484
Tristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond repute
Re: Invert Motors Physically or in Code?

One more vote for "invert in code". This is the more robust design practice for the many reasons enumerated above.

There are very rare exceptions like having multiple motors which need to operate on a single motor controller, but in opposite directions. Or perhaps there's nobody who knows how to manipulate code available at the moment. Absent that kind of very special situation, invert the motors in the code.
  #11   Spotlight this post!  
Unread 23-11-2013, 22:01
orangemoore orangemoore is offline
Registered User
AKA: Roger Moore
FRC #3135 (Robotic Colonels)
Team Role: College Student
 
Join Date: Dec 2012
Rookie Year: 2013
Location: Chicago
Posts: 2,308
orangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond repute
Re: Invert Motors Physically or in Code?

I think that it can really depend on the situation. For instance my FTC team 3507 has built a mecanum drive train this year. And as the programmer for it accounting for one side of the motors being reversed is easy in code. But it becomes very complicated to understand what the values sent to the motors should be. It that case I would have voted for reversing the wires.

A side note

If you swap the wires you shouldn't just make a mental note. You should have something visible that says they are swapped. In competition any knowledge like that will most likely be forgotten.
  #12   Spotlight this post!  
Unread 23-11-2013, 22:10
BBray_T1296's Avatar
BBray_T1296 BBray_T1296 is offline
I am Dave! Yognaut
AKA: Brian Bray
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Rockwall, TX
Posts: 947
BBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond repute
Re: Invert Motors Physically or in Code?

I believe in our code we have "invert" variables, one for each motor. When the code gets to the "output/write" section, all values to be output are multiplied by their "inversion" variable, which is assigned as either 1 or -1. That way if we are doing weird things such as mecanum, only a single number must be changed to guarantee an error-less inversion.
__________________
If molecular reactions are deterministic, are all universes identical?

RIP David Shafer: you will be missed


  #13   Spotlight this post!  
Unread 23-11-2013, 22:12
DampRobot's Avatar
DampRobot DampRobot is offline
Physics Major
AKA: Roger Romani
FRC #0100 (The Wildhats) and FRC#971 (Spartan Robotics)
Team Role: College Student
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Stanford University
Posts: 1,277
DampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond repute
Re: Invert Motors Physically or in Code?

We use Anderson connectors, so we cannot physically insert the connectors together the wrong way. If we've assembled it to connect red to red wires, you cannot physically connect the Anderson connectors so black goes to red without intentionally disassembling and reassembling the connector. This means that if we change the order of the wires to change the direction of the motor, it cannot get accidentally reassembled incorrectly at a later time.

If we're at the point where were actually testing a mechanism for the first time (where this type of thing tends to be an issue), I'd much rather just take 30 seconds to break the Anderson connector apart and switch the leads than spend ten minutes changing the code, recompiling, and rebooting the robot. It may not be the "right" way, but it's a lot faster.
__________________
The mind is not a vessel to be filled, but a fire to be lighted.

-Plutarch
  #14   Spotlight this post!  
Unread 23-11-2013, 22:32
MichaelBick MichaelBick is online now
Registered User
FRC #1836 (MilkenKnights)
Team Role: Alumni
 
Join Date: Oct 2011
Rookie Year: 2010
Location: Los Angeles
Posts: 734
MichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant future
Re: Invert Motors Physically or in Code?

Another good reason to switch it in code is that it copies over to our practice bot.
__________________
Team 1836 - The Milken Knights
2013 LA Regional Champions with 1717 and 973
2012 LA Regional Finalists with 294 and 973
To follow Team 1836 on Facebook, go to http://www.facebook.com/MilkenKnights
To go to our website, go to http://milkenknights.com/index.html
  #15   Spotlight this post!  
Unread 23-11-2013, 22:47
Richard Wallace's Avatar
Richard Wallace Richard Wallace is offline
I live for the details.
FRC #3620 (Average Joes)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1996
Location: Southwestern Michigan
Posts: 3,646
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: Invert Motors Physically or in Code?

Programmers are generally the last ones to touch ANY system that depends on embedded software to function correctly -- and the more time they get to play with and perfect the code, the better the system will function. There will be plenty of challenges for programmers to overcome as they get the system ready to function correctly -- there is just no excuse for making arbitrary design choices in other aspects of system design that add to the challenge by creating extra factors for programmers to keep track of.

Wiring, on the other hand, can and should be standardized, and its configuration 'frozen', as early as possible in system development. Allowing those who wire the robot to adopt any convention other than "always connect red with red, and black with black, in every power circuit" is simply creating an unnecessary opportunity to lose a match.
__________________
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)
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


All times are GMT -5. The time now is 17:28.

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