Go to Post [I] [/I]I think this may be some kind of record. We got through 9 entire posts before someone mangled the spelling of mecanum. [I] [/I] - Ether [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
  #1   Spotlight this post!  
Unread 18-01-2010, 14:59
Pausert Pausert is offline
Registered User
FRC #1727 (REX)
Team Role: Leadership
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Maryland
Posts: 69
Pausert is an unknown quantity at this point
Refnum Defining

I'm having difficulty with having my sensors read to my front panel. I know that the sensors function because they work in the front panel of the example VIs for digital inputs. I've managed to find an error message that tells me that the refnum I'm calling for my "get" statement does not exist. I had thought that I had created the refnum because I followed these instructions:
Quote:
1. In the Project Explorer window of the FRC robot project, within the
Team Code folder under the RT CompactRIO Target, double-click
the Begin.vi item to open the Begin VI.
2. Select Window»Show Block Diagram or press the <Ctrl-E> keys to
view the block diagram.
Notice that references have already been set for Camera, Watchdog,
Left and Right Motors, and Joystick 1.
3. Add a Gyro Open VI to the block diagram below the Joystick 1 reference.
4. Right-click the Analog Input terminal of the Gyro Open VI and select
Create»Constant from the shortcut menu.
5. Add a Gyro RefNum Registry Set VI to the block diagram to the right
of the Gyro Open VI.
6. Right-click the refnum name input of the Gyro RefNum Registry Set
VI and select Create»Constant from the shortcut menu.
7. Type the name you want to assign to this reference, such as Gyro 1.
8. Wire the GyroDevRef output of the Gyro Open VI to the GyroDevRef
input of Gyro RefNum Registry Set VI.
9. Wire the error out output of the Gyro Open VI to the error in input
of the Gyro RefNum Registry Set VI.
Is there some other step or setting for creating a refnum?
Reply With Quote
  #2   Spotlight this post!  
Unread 18-01-2010, 19:28
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Refnum Defining

What you describe seems correct, but it would be a lot easier to verify if you posted a picture of your code.

Also show us the code where you're doing the Get so we can make sure you're doing that properly as well.
Reply With Quote
  #3   Spotlight this post!  
Unread 19-01-2010, 14:43
Pausert Pausert is offline
Registered User
FRC #1727 (REX)
Team Role: Leadership
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Maryland
Posts: 69
Pausert is an unknown quantity at this point
Re: Refnum Defining

Here is the code. If you need more I'll post it. I'm going to try to create a devref for something other than DIO today and see how that works.

UPDATE: I tried using a joystick devref and it gave me the same error in the error console.


Last edited by Pausert : 19-01-2010 at 17:32.
Reply With Quote
  #4   Spotlight this post!  
Unread 19-01-2010, 22:55
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Refnum Defining

Nothing strikes me as obviously wrong with what you posted. How are you running the code?
Reply With Quote
  #5   Spotlight this post!  
Unread 20-01-2010, 09:02
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: Refnum Defining

Because the image in the post is clipped, I can't see what the switch statement has wired to it, but the sensor read and the indicator update are conditional. Is it possible that the code in that case of the switch isn't running because of the logic wired to it?

Greg McKaskle
Reply With Quote
  #6   Spotlight this post!  
Unread 20-01-2010, 10:58
Pausert Pausert is offline
Registered User
FRC #1727 (REX)
Team Role: Leadership
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Maryland
Posts: 69
Pausert is an unknown quantity at this point
Re: Refnum Defining

The case statement is definitely active. Other things in the case statement function correctly. I know that the error stems from a bad refnum because I created an indicator on the refnum call function and it told me that the refnum I was calling does not exist. I even went as far as to create a constant on the case structure for the case in which I have the sensor code because I was running low on new ideas.
Reply With Quote
  #7   Spotlight this post!  
Unread 20-01-2010, 11:03
Doug Norman's Avatar
Doug Norman Doug Norman is offline
Registered User
no team (National Instruments)
Team Role: Engineer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Austin, TX
Posts: 134
Doug Norman will become famous soon enoughDoug Norman will become famous soon enough
Re: Refnum Defining

Because the RefNum Get is outside the case structure, it seems it should be getting called - and the error makes me think it is. One thing to try might be to actually make a copy of the "Sensor" text constant wired to the RefNum Set, and wire that into the RefNum Get. This would be just to make sure the names are identical and there isn't some hidden or nonprintable text.
Reply With Quote
  #8   Spotlight this post!  
Unread 20-01-2010, 11:55
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,557
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Refnum Defining

Quote:
Originally Posted by Doug Norman View Post
Because the RefNum Get is outside the case structure, it seems it should be getting called - and the error makes me think it is. One thing to try might be to actually make a copy of the "Sensor" text constant wired to the RefNum Set, and wire that into the RefNum Get. This would be just to make sure the names are identical and there isn't some hidden or nonprintable text.
It would be really helpful if the error message included the name of the refnum it couldn't get. I can imagine helping a team at a regional having this problem where the main indication is an error on the diagnostics tab, and not really knowing where to start looking, especially if there are a lot of refnums.

Last edited by Joe Ross : 20-01-2010 at 12:19.
Reply With Quote
  #9   Spotlight this post!  
Unread 20-01-2010, 12:20
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,557
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Refnum Defining

Quote:
Originally Posted by Pausert View Post
The case statement is definitely active. Other things in the case statement function correctly. I know that the error stems from a bad refnum because I created an indicator on the refnum call function and it told me that the refnum I was calling does not exist. I even went as far as to create a constant on the case structure for the case in which I have the sensor code because I was running low on new ideas.
It would probably be helpful if you posted your VIs, since often times you can find things wrong that you can't see in a picture (at least until NI gives us LabVIEW 2009).

Last edited by Joe Ross : 20-01-2010 at 12:30.
Reply With Quote
  #10   Spotlight this post!  
Unread 20-01-2010, 14:31
Pausert Pausert is offline
Registered User
FRC #1727 (REX)
Team Role: Leadership
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Maryland
Posts: 69
Pausert is an unknown quantity at this point
Re: Refnum Defining

Quote:
Originally Posted by Doug Norman View Post
Because the RefNum Get is outside the case structure, it seems it should be getting called - and the error makes me think it is. One thing to try might be to actually make a copy of the "Sensor" text constant wired to the RefNum Set, and wire that into the RefNum Get. This would be just to make sure the names are identical and there isn't some hidden or nonprintable text.
This is good advice, but I've tried this too! It didn't seem to fix the problem.

Attached is my code and a picture of the error message.

Attached Files
File Type: zip Encoder2.zip (254.4 KB, 18 views)

Last edited by Pausert : 20-01-2010 at 14:33.
Reply With Quote
  #11   Spotlight this post!  
Unread 20-01-2010, 18:22
Pausert Pausert is offline
Registered User
FRC #1727 (REX)
Team Role: Leadership
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Maryland
Posts: 69
Pausert is an unknown quantity at this point
Re: Refnum Defining

UPDATE: I have reinstalled LabVIEW with the update and it has not solved the issue. Additionally, I tried another laptop and that gave me the same error.
Reply With Quote
  #12   Spotlight this post!  
Unread 20-01-2010, 21:09
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Refnum Defining

How are you running the code? I don't see a Robot Main vi window open anywhere.
Reply With Quote
  #13   Spotlight this post!  
Unread 20-01-2010, 21:43
Pausert Pausert is offline
Registered User
FRC #1727 (REX)
Team Role: Leadership
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Maryland
Posts: 69
Pausert is an unknown quantity at this point
Re: Refnum Defining

From the teleop loop. Should I be running it from main? i thought that running it from teleop wouldn't be a problem as the other refnums didn't return errors...
Reply With Quote
  #14   Spotlight this post!  
Unread 20-01-2010, 23:39
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Refnum Defining

If you don't run the Robot Main vi, the Begin vi doesn't get called. I think that should adequately explain the problem you've been having.
Reply With Quote
  #15   Spotlight this post!  
Unread 21-01-2010, 19:53
elmer_fud elmer_fud is offline
mentor/code monkey
FRC #2859
Team Role: Mentor
 
Join Date: Jul 2009
Rookie Year: 2009
Location: co
Posts: 18
elmer_fud is an unknown quantity at this point
Re: Refnum Defining

Quote:
Originally Posted by Alan Anderson View Post
If you don't run the Robot Main vi, the Begin vi doesn't get called. I think that should adequately explain the problem you've been having.
This is your problem. The program you run is Robot Main and it calls all the other sub VI's as they are needed or to run them.

Also your indicator is going to appear in the teleop front pannel not the driver station or robot main front pannels. You can have these front pannels open when the program is running though without any problems
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
refnum registry location Wendy Holladay NI LabVIEW 1 17-01-2010 22:11
Defining a joystick dr_jack3l National Instruments LabVIEW and Data Acquisition 1 12-02-2009 09:59
Defining First code? mormannoob Programming 4 17-01-2008 23:36
Defining Leadership Bomberofdoom General Forum 8 17-09-2007 14:58
Defining file name? Mike Programming 2 08-02-2006 17:28


All times are GMT -5. The time now is 08:51.

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