Go to Post I can't believe that I said the CD community could be patient - in December. - JaneYoung [more]
Home
Go Back   Chief Delphi > Technical > National Instruments LabVIEW and Data Acquisition
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 09-02-2008, 11:11
Tanner's Avatar
Tanner Tanner is offline
Registered User
FRC #1261 (Roblions)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Suwanee, GA
Posts: 311
Tanner is a splendid one to beholdTanner is a splendid one to beholdTanner is a splendid one to beholdTanner is a splendid one to beholdTanner is a splendid one to beholdTanner is a splendid one to behold
Aquiring Sensor Data

Hi all,

This year we've decided to use the LabView stuff to get some debug/info data from our robot using the link between the operator interface and the computer. I've created a little dashboard interface for our little test robot that tells us batteries info and PWM output. We'd like to have sensor data too, ex: encoder counts, gyro angle, etc... However, I can not find a way to read that data in using this template/toolkit in our dashboard:

http://www.chiefdelphi.com/forums/sh...ad.php?t=50742

I've attached the file of my dashboard, as I still do not understand all the LabView lingo quite yet.

Any help would be appreciated.

Cheers
-Tanner
Attached Files
File Type: zip Tanner Dash.zip (14.3 KB, 92 views)
Reply With Quote
  #2   Spotlight this post!  
Unread 10-02-2008, 00:13
Danny Diaz's Avatar
Danny Diaz Danny Diaz is offline
Smooth Operator
AKA: FrankenMentor
None #0418
Team Role: Alumni
 
Join Date: Apr 2005
Rookie Year: 2003
Location: Manchester, NH
Posts: 545
Danny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond repute
Send a message via AIM to Danny Diaz
Re: Aquiring Sensor Data

You have to understand what the Dashboard is doing - it is sniffing the communications between the OI and the RC. The sensor data doesn't get transmitted between the RC and the OI.

However, there are 6 user bytes in the communications stream (the UserByteX bytes, where X is 1 through 6) that you can fill in yourself in order to get your data up to the OI. In your robot code, you need to fill in the data into the user bytes. Then, in your LabVIEW code, you can read those user bytes. And VIOLA! You've just gotten your data up and you can display the data.

If you need more of an explanation, just let me know.

-Danny
__________________
Danny Diaz
Former Lead Technical Mentor, FRC 418
Reply With Quote
  #3   Spotlight this post!  
Unread 10-02-2008, 00:19
Danny Diaz's Avatar
Danny Diaz Danny Diaz is offline
Smooth Operator
AKA: FrankenMentor
None #0418
Team Role: Alumni
 
Join Date: Apr 2005
Rookie Year: 2003
Location: Manchester, NH
Posts: 545
Danny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond repute
Send a message via AIM to Danny Diaz
Re: Aquiring Sensor Data

Oh, also I noticed you are trying to use OI data as well as RC data in your dashboard. Realize you will only get the kind of data that your jumper on your OI allows (there's a jumper on your OI to select between RC data and OI data). I recommend RC data so you can see user bytes and PWM data and the like.

-Danny
__________________
Danny Diaz
Former Lead Technical Mentor, FRC 418
Reply With Quote
  #4   Spotlight this post!  
Unread 10-02-2008, 12:15
Tanner's Avatar
Tanner Tanner is offline
Registered User
FRC #1261 (Roblions)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Suwanee, GA
Posts: 311
Tanner is a splendid one to beholdTanner is a splendid one to beholdTanner is a splendid one to beholdTanner is a splendid one to beholdTanner is a splendid one to beholdTanner is a splendid one to behold
Re: Aquiring Sensor Data

Hm. Interesting. So if I had some data stored in variable X, and I wanted to pass it to user byte 1, then:
UserByte1 = X;

Correct?

I'll have to see if I can get this working today.

Thanks for the help
-Tanner
Reply With Quote
  #5   Spotlight this post!  
Unread 10-02-2008, 17:48
Abrakadabra Abrakadabra is offline
Here We Go !!!
AKA: Scott Kukshtel, Mr. K
FRC #3467 (The Windham Windup!)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2002
Location: Windham, New Hampshire
Posts: 159
Abrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant future
Re: Aquiring Sensor Data

If you run out of User bytes, another trick you can use is to stuff your sensor data into unused PWM data slots (i.e. make sure there is nothing connected to those PWM ports!). Then your dashboard can read the PWM data slots and make the conversion to sensor data.
Reply With Quote
  #6   Spotlight this post!  
Unread 11-02-2008, 01:33
Danny Diaz's Avatar
Danny Diaz Danny Diaz is offline
Smooth Operator
AKA: FrankenMentor
None #0418
Team Role: Alumni
 
Join Date: Apr 2005
Rookie Year: 2003
Location: Manchester, NH
Posts: 545
Danny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond reputeDanny Diaz has a reputation beyond repute
Send a message via AIM to Danny Diaz
Re: Aquiring Sensor Data

Quote:
Originally Posted by Tanner View Post
Hm. Interesting. So if I had some data stored in variable X, and I wanted to pass it to user byte 1, then:
UserByte1 = X;

Correct?
Yes, that's correct! Now, something very important to keep in mind about user variables - user variables are only 8 bits wide (one byte, range 0-255). If you pull in an analog sensor value, they are 10 bits wide (more than one byte, range 0-1023). If you want to preserve all 10 bits, you need to store the values in 2 user bytes - 8 bits in one, and 2 bits in the other. If you have multiples, you can "bundle" the 2 bits from 4 user bytes together (to send 4 analog values at once), but if you have just 1 then grabbing 2 8-bit chunks is easy enough. Here's how you do it:

Code:
unsigned int analogValue = GetAnalogValue( rc_ana_in01 ); // analog input port 1
UserByte3 = (char)analogValue;  // Pulls low 8 bits
UserByte4 = (char)(analogValue >> 8); // Grabs high 8 bits
and attached is what the LabVIEW code would look like on the other end to put it back together (remember, the values you pull out of the user byte are 32 bit representations, you have to cast each to 8 bits for the "Join Numbers" primitive to join them into a 16-bit value correctly). I have attached both an image of the code AND I attached the VI.

Quote:
Originally Posted by Abrakadabra View Post
If you run out of User bytes, another trick you can use is to stuff your sensor data into unused PWM data slots (i.e. make sure there is nothing connected to those PWM ports!). Then your dashboard can read the PWM data slots and make the conversion to sensor data.
Yes! This is a useful little trick, especially for dedicating slots for data that changes rapidly (like gyro data). If you multiplex data using user bytes you really need to have some kind of key to let you know what data you're seeing on the LabVIEW side - if you can dedicate unused PWM values that takes a burden off of the "cleverness" of your code. However, my team has found that we rarely have leftover PWM slots, though this year may be different since we're using pneumatics and relays instead of PWM and motors for a lot of things.

-Danny
Attached Thumbnails
Click image for larger version

Name:	AnalogRecombination.JPG
Views:	100
Size:	70.1 KB
ID:	6249  
Attached Files
File Type: vi SampleDashboard.vi (28.3 KB, 87 views)
__________________
Danny Diaz
Former Lead Technical Mentor, FRC 418
Reply With Quote
  #7   Spotlight this post!  
Unread 18-02-2008, 18:35
robogeek753's Avatar
robogeek753 robogeek753 is offline
Droid Master
AKA: Bradley
FRC #0753 (The High Desert Droids)
Team Role: Leadership
 
Join Date: Jan 2007
Rookie Year: 2004
Location: Bend Oregon
Posts: 61
robogeek753 is an unknown quantity at this point
Re: Aquiring Sensor Data

Anyone know how to do this in ROBOT C?
__________________
Really, simpler is better; really, I swear
WHY DON'T YOU BELIEVE ME???
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
data bus sciguy125 Electrical 10 06-09-2007 20:53
pic: CD Aquiring usfirst.org? Pat McCarthy Extra Discussion 7 15-11-2006 18:56
Dashboard, The Comp and sensor data... Kevin Karan Programming 7 28-01-2004 21:31
Sensor or no Sensor For Autonomous mode Kyle1010 Programming 14 22-01-2003 13:10


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