Go to Post MORAL: Always wear safety glasses when you're putting on your safety glasses. ;) - Joel Glidden [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 30-08-2010, 20:49
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Encoder v.s. Steering

I'll start with your "bit switch".

This could be more efficient and easier to read by bundling the boolean values into an array and using the function "boolean array to number" (found in the boolean pallette):

What would make it better still is to use the refnum registry (as opposed to allocating and deallocating the channels each time), and to put the whole thing in a subVI:


Also notice the use of the FOR loop and the string array constant make the code smaller and cleaner. If nothing is wired to the N terminal on a FOR loop but you wire an array to it, it will execute for every element in that array.
I added a comment for why the values are inverted. To someone not familiar with the digital sidecar, this would not be obvious.


Are you comfortable with all of this?
__________________
-- Marshal Horn
Reply With Quote
  #17   Spotlight this post!  
Unread 30-08-2010, 20:54
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Encoder v.s. Steering

Here's a simple change:
You know you "OperationMode" input for selecting between Autonomous and Teleop?
You could reduce coding errors by changing that to an enumerated variable. (With enumerated variables, the options are selected from a menu instead of being typed in)
For an example of an enumerated variable, look at the "DerivedRobotState" control in Teleop.vi

You could do the same with your "kickposition" input.

Make sure they are typedefs when you save them, and not regular controls. (As typedefs, when you change the functional properties of the control file, all instances of that control are changed accordingly. That means if you add a new option to the enumerated variable, that option will exist in all instances of it as soon as you save the file.)
__________________
-- Marshal Horn

Last edited by kamocat : 30-08-2010 at 20:58.
Reply With Quote
  #18   Spotlight this post!  
Unread 31-08-2010, 19:42
QCEliteTeam648 QCEliteTeam648 is offline
Registered User
FRC #0648
 
Join Date: Aug 2010
Location: Quad Cities
Posts: 7
QCEliteTeam648 is an unknown quantity at this point
Re: Encoder v.s. Steering

Thank you!! Our encoder and steering are now working together. Also thank you Kamocat for your suggestions. I'm working on the bit switch as I type but I am a bit confused on the second post. Since I'm new to Labview and programming in general I don't know what you mean by an enumerated value or typedefs.
Reply With Quote
  #19   Spotlight this post!  
Unread 31-08-2010, 21:59
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Encoder v.s. Steering

The LabVIEW Wiki actually has better information on this than the LabVIEW Help.
enumerated variables: http://labviewwiki.org/Enum
typedefs: http://labviewwiki.org/Typedef

Note that the control must be in a .ctl file to become a typedef. There's two different ways to do that.

Create a new control by going to file menu and selecting "New...". The following dialog will pop up. Select "control" and click OK.


OR

From an existing control, right click on the control, hover over the "advanced" item on the right-click menu, and select "customize".

This will still create a new control, but it will be the control you selected (though you can always delete it and place down something else).
__________________
-- Marshal Horn
Reply With Quote
  #20   Spotlight this post!  
Unread 07-09-2010, 18:20
QCEliteTeam648 QCEliteTeam648 is offline
Registered User
FRC #0648
 
Join Date: Aug 2010
Location: Quad Cities
Posts: 7
QCEliteTeam648 is an unknown quantity at this point
Re: Encoder v.s. Steering

K I'll see if I can do that. Sorry for not posting in a while. Our team has been busy with parades. Just posting to let you know that I am still here and reading replies/suggestions.
Reply With Quote
Reply


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
Car Steering... tuna.and.cheese Programming 3 25-02-2009 21:51
Encoder for Crab Steering Alphabet OJ Programming 4 09-02-2009 20:49
Screwing Encoder into Encoder Mount? Adrien Electrical 3 25-01-2009 18:14
Steering Wheels Chris_Elston Programming 3 17-01-2005 15:31
need glp programing steering with a steering wheel Matchew Programming 2 10-02-2003 14:20


All times are GMT -5. The time now is 04:34.

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