View Single Post
  #11   Spotlight this post!  
Unread 23-01-2012, 22:49
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,113
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: Jaguar Direction Control

That will work, but think about what you're doing. You're checking if a value is equal to zero - if it is, then use a different zero constant for your motor output. If it's not equal to zero, then set it to that value.

Here's a question for you: why do you need that case structure? Is it necessary or a waste of processor cycles? How can you write that to be the most efficient?

when you program long enough, you eventually view everything in terms of processor cycles and efficiency...


EDIT: in response to above, case structures in LabVIEW are actually extremely powerful. They can function as both an if/else as well as switch statement (to compare to C(++)), depending on what you wire into it. Read about it.

Edit 2: Oh, and one more thing. On your most recent screenshot, on your 1 and -1 constants, see the little red dots? They're called coercion dots. They happen when LabVIEW automatically changes a datatype of something (in this case from int to double). You want to avoid those, if possible, as they unnecessarily drain resources (it's not a big draw, but an avoidable one). Right click on your int constants, and under Representation, choose DBL (for double) to make the wire orange/keep one constant datatype.
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android

Last edited by plnyyanks : 23-01-2012 at 22:54.
Reply With Quote