Login | Register 
FEATURES
APPLICATIONS
DOWNLOADS
EDUCATION
BLOG
WIKI
FORUM
STORE

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

Still a little green? Ask your beginner's questions here

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

Postby maddilelli » Sun Mar 24, 2019 4:11 pm

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!)
Attachments
IP_Thesis_3-16_multiSqueeze.toe
(17.52 KiB) Downloaded 56 times
Last edited by maddilelli on Mon Mar 25, 2019 9:14 am, edited 1 time in total.
maddilelli
 
Posts: 12
Joined: Thu Feb 16, 2017 11:56 am

Re: Export variables from a CHOP Execute DAT to a Constant C

Postby CorbinWhite » Sun Mar 24, 2019 5:36 pm

op('handVelocity').par.value0 = totalVelocity
CorbinWhite
 
Posts: 128
Joined: Sun Aug 16, 2015 2:49 pm

Re: Export variables from a CHOP Execute DAT to a Constant C

Postby maddilelli » Sun Mar 24, 2019 6:00 pm

CorbinWhite wrote:op('handVelocity').par.value0 = totalVelocity


So that line already exists in my CHOP Execute DAT. It's not putting the value into the Constant CHOP.
maddilelli
 
Posts: 12
Joined: Thu Feb 16, 2017 11:56 am

Re: Export variables from a CHOP Execute DAT to a Constant C

Postby CorbinWhite » Sun Mar 24, 2019 7:59 pm

it's hard to say then, i'm not seeing any DATs in the attached .toe
CorbinWhite
 
Posts: 128
Joined: Sun Aug 16, 2015 2:49 pm

Re: Export variables from a CHOP Execute DAT to a Constant C

Postby maddilelli » Mon Mar 25, 2019 9:13 am

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
Attachments
IP_Thesis_3-16_multiSqueeze.toe
(17.52 KiB) Downloaded 54 times
maddilelli
 
Posts: 12
Joined: Thu Feb 16, 2017 11:56 am

Re: Export variables from a CHOP Execute DAT to a Constant C

Postby greg » Mon Mar 25, 2019 9:24 am

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.
User avatar
greg
Staff
 
Posts: 552
Joined: Tue Nov 13, 2007 1:08 am

Re: Export variables from a CHOP Execute DAT to a Constant C

Postby maddilelli » Mon Mar 25, 2019 10:00 am

greg wrote: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.


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.

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


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 :lol:
Attachments
IP_Thesis_3-16_multiSqueeze.1.toe
(16.9 KiB) Downloaded 61 times
maddilelli
 
Posts: 12
Joined: Thu Feb 16, 2017 11:56 am


Return to Beginners

Who is online

Users browsing this forum: No registered users and 15 guests