LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Shift Registers

I am trying to create an algorithm that timestamps when a subject's arm is raised. The subject has a bluetooth accelerometer attached to their arm and y acceleration=0 when raised and y=1 when lowered. We want to timestamp the raise. Right now we have (using shift registers) that when Yaccel <0.2 and Yaccel-1>0.2 and Yaccel-2>0.2, write to file (In Case Structure).

 

We used 2 shift registers to get the Yaccel-1 and Yaccel-2 values.The problem is: any jerk in the direction of the y axis causes the acceleration in this direction to go to 0 momentarily. We need to look at a longer running list (about 1 second or 100 data points) of data to assure that this isn't a jerk but a raise. However, we can't have 100 shift registers as that would be crowded.. What can we do?

 

Thanks,

 

-Adam

0 Kudos
Message 1 of 6
(2,681 Views)

How about using one shift register but make it an array.  Each time you add a pt to the end, take the first one off (after you take 100 pts).  Then you can take the average of the last 100 pts.

 

Is that good enough or do you need an example?

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 2 of 6
(2,680 Views)

That sounds right. Could you help me with an example? I tried creating the array, but couldn't get it to append a 101st value than delete the 1st value correctly.  I'd really appreciate it.

 

Thanks,

 

-Adam 

 

 I need to be able to apply conditional statements to certain values in the array of the last 100 points. Ex. If the last value (100 points back) >0.2 and the 99th through 1st values are all <0.2, condition=true. 

  

 

0 Kudos
Message 3 of 6
(2,631 Views)
I'll try to send you one later tonight when I get home...  If I forget, remind me.
-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 4 of 6
(2,628 Views)

You can look at the enclosed example which relies on time of 1sec interval, however I just considered Yaccel - 1 for demonstration, you may include others later.

The timer is set(just double click on it) to 1 sec and time duration been scrutinised to make a decision of using the data or scrap it off. If time goes above 1sec(no jerks occured), values are retained and ticks to state-0(you may code here, to write the data to the FILE), where if time is <1sec(jerky behaviour) and data is discarded by moving to state-2.

 

The reason to do the time check in side the case structure is that, we don't want to loose the data till first second if the check is positive. To conclude, the structure starts gathering values when Yaccel - 1 goes >0.2 and also makes decision to write or not by checking the timer value inside it.

 

Hope it gives some idea.

Message Edited by Parny on 03-02-2009 11:38 PM
Download All
0 Kudos
Message 5 of 6
(2,598 Views)

Just got home and it looks like Parny has taken care of an example.  Thanks Parny.

 

So... is this good enough?  Or do you need more help?

 

 

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 6 of 6
(2,585 Views)