Export variables from a CHOP Execute DAT to a Constant CHOP?

So I used a CHOP Execute DAT hooked up to a Timer CHOP to grab the position values from my Kinect CHOP every 1/4th of a second and used this data to calculate the velocity of p1’s right hand. I’m a really big noob when it comes to DATs and Python in general so I was wondering if there’s a way to take one of the variables from my CHOP Execute DAT and output it to a Constant CHOP? Basically I want to take totalVelocity from inside the CHOP Execute DAT and export that value in realtime to the Constant CHOP I’ve labelled handVelocity.

All the nodes in question are located in the lower-left corner of my project comp. (sorry its a little messy!)
IP_Thesis_3-16_multiSqueeze.toe (17.5 KB)

op(‘handVelocity’).par.value0 = totalVelocity

1 Like

So that line already exists in my CHOP Execute DAT. It’s not putting the value into the Constant CHOP.

it’s hard to say then, i’m not seeing any DATs in the attached .toe

my bad - uploaded a previous version of my project by mistake. Here’s the actual file, with the DAT located in the lower left region of the main project container. Updated the OP too
IP_Thesis_3-16_multiSqueeze.toe (17.5 KB)

You likely do not need a CHOP Execute DAT. After you set the Timer CHOP‘s On Done parameter to re-start, you can put your code in the Timer CHOP‘s onDone() function.

or better, put the code in onCycle() and set the timer to cycle forever.

I don’t have your network in front of me, but variables in the Execute DATs don‘t get saved the next time it runs, so you have to save your previous value somewhere else, like in your Constant CHOP.

but why not send your Kinect channel to a Filter CHOP set to 1/4 second?

As always, several ways to do the same thing.

Thanks! Putting the code in onCycle() is sort of working… I’m still not getting any values in the handVelocity Constant CHOP though. There’s probably something wrong with my array/math… Attached the file.

I’m not sure how this would help me achieve my goal… Wouldn’t the Filter CHOP just get me the average value for the hand_r_tx & hand_r_ty coords? I don’t want the data smoothed out, I’m trying to basically put the values coming in from the Kinect into an array, and get the absolute value of the distance between the last number in the array [-1] to the second to last number in the array [-2], then I can use those values in the velocity equation. But if you could explain how just using the Filter CHOP would work, I’d much rather use more nodes than continue to struggle with Python :laughing:
IP_Thesis_3-16_multiSqueeze.1.toe (16.9 KB)