Go to Post Robots aside, how we handle these situations, communicate with one another, resolve differences and potential conflict, and overcome obstacles defines us all as people. Remember the big picture and have fun. - Rich Kressly [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 Rating: Thread Rating: 8 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 16-12-2008, 22:50
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: I'm trying not to hate labview but...

Quote:
Originally Posted by sparrowkc View Post
I'm getting really frustrated trying to modify the default code. I have no interest in using a pre made 2 wheel drive code block; I want to control motors individualy. Do I really have to add a motordevref block to the robotdata control for every motor I want to control? I'm thinking there has to be a way to create a bundle without specifying default values, but I cannot figure it out. I have labview with the first update installed, is the current code template necessarily the last one?
If you open up the pre made 2 wheel drive subVI, it creates two motor dev refs and builds an array from them. You can follow this lead and have a single array entry in the robotdata which holds all of your motor refs. The slight downside to using an array is remembering what slot in the array is for what motor. There are plenty of ways for handling that, or you could build a cluster -- similar to a struct or record in other languages -- and there you can give the elements of the cluster descriptive names. The default value as the controls are dropped should be fine as their value will really be defined by the Open. All LV controls except refnums support a default value, and it is quite useful, but not always necessary.

Greg McKaskle
Reply With Quote
  #2   Spotlight this post!  
Unread 17-12-2008, 23:11
sparrowkc sparrowkc is offline
Registered User
AKA: Mark
FRC #1986 (Team Titanium)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Lees Summit
Posts: 114
sparrowkc is a splendid one to beholdsparrowkc is a splendid one to beholdsparrowkc is a splendid one to beholdsparrowkc is a splendid one to beholdsparrowkc is a splendid one to beholdsparrowkc is a splendid one to beholdsparrowkc is a splendid one to beholdsparrowkc is a splendid one to behold
Re: I'm trying not to hate labview but...

Yup, arrays are the way to go. Create an array in begin.vi with all your motordevrefs wired into it, right click on the output terminal, and create a constant. Copy paste the constant into the robotdata global type def. The array can be grown and shrunk in begin.vi by creating more inputs on the build array block, and the constant won't need to be changed and won't take up three screens worth of space when you use all 20 pwm ports.

Why isn't there a way to create clusters like this? I keep wishing for a build cluster block that simply builds a cluster with n number of named elements from n number of inputs, instead of one that replaces elements in a constant.
Reply With Quote
  #3   Spotlight this post!  
Unread 19-12-2008, 09:19
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: I'm trying not to hate labview but...

Quote:
Originally Posted by sparrowkc View Post
Why isn't there a way to create clusters like this? I keep wishing for a build cluster block that simply builds a cluster with n number of named elements from n number of inputs, instead of one that replaces elements in a constant.
Good question. I suppose one reason is that when you look at a cluster of identical elements, and an array of the same elements, they are very similar, and can in fact be converted back and forth pretty easily.

I'm not sure if it is done in the dashboard, but it is pretty common to take an array datatype, cast to a cluster of say eight elements, and display in a cluster arranged in an octagon or something. The math on the diagram can now work on the array, often more easily than the cluster, but the user sees the discrete elements arranged in a meaningful way. If you decide to do this, beware that the LV node to convert from array to cluster has no way of knowing how many elements may be in the array or how big to make the cluster, so there is a popup menu item for setting the size of the cluster.

Also, rereading your question, maybe you are looking for the old fashioned bundle node rather then the newer bundle by name. The bundle does work like the build array, you grow it and wire stuff up. It has a middle terminal in case you are simply replacing elements, but doesn't require it as the bundle by name does. The advantages to the named node are that it is more verbose and somewhat more documented code, and when the cluster changes, it does a better job of using the names to match up the elements. The replace mode of the bundle only works well when adding to the end of your cluster type.

Greg McKaskle
Reply With Quote
  #4   Spotlight this post!  
Unread 22-12-2008, 22:41
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: I'm trying not to hate labview but...

Quote:
Originally Posted by Greg McKaskle View Post
If you open up the pre made 2 wheel drive subVI, it creates two motor dev refs and builds an array from them. You can follow this lead and have a single array entry in the robotdata which holds all of your motor refs. The slight downside to using an array is remembering what slot in the array is for what motor. There are plenty of ways for handling that, or you could build a cluster -- similar to a struct or record in other languages -- and there you can give the elements of the cluster descriptive names. The default value as the controls are dropped should be fine as their value will really be defined by the Open. All LV controls except refnums support a default value, and it is quite useful, but not always necessary.

Greg McKaskle
To cause less mistakes in the implementation of the array of Motor TypeDefs, you can create a ring terminal TypeDef (Strict), and use it as a constant on the block diagram. It's effectively the same as unbundling a cluster by name on the block diagram, but it's much neater on the Front Panel.
__________________
-- Marshal Horn
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
I'm Trying to Mirror a Rig Popper99 3D Animation and Competition 3 09-02-2008 20:17
pic: i'm on the loose, but.. thatphotochick Extra Discussion 4 22-05-2006 17:31
frc_camera not working but labview does Issues Programming 7 18-01-2006 19:23
Some things i'm trying to understand on Kevin's Accelerometer Code Squall Programming 2 03-02-2005 12:01
I'm trying to contact Teams 234 and 269... archiver 2001 1 24-06-2002 03:23


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