Accel / gyro project
Hi,
have been using MAX/MSP to produce an outlet for my IMU device (Phidget SPatial) I have incoroporated pitch and roll calculations. so can use my accel to get the values I would expect from this.
I am struggling with my gyro
I have output in deg/s
so multiplying this by interval of readings
I need a way to tally up this output - ie. keep adding the new reading onto the old reading to produce the rotation, I tried accum object. however my value returns to zero when the gyro stops moving.
What object should I use for this?
also I need a way to capture the readings say (I'll make 5 readings 20ms interval and mean to 100ms) total number of readings would be over say 3-5mins max so about 3000 readings.
Is Cellblock the way to go? I can't figure how to achieve this?
here is my patch so far.
I also tried to steer a 3d object with this but it doesn't seem to orientate correctly - but that's not a big deal for my project.
here is patch for what I have so far
Can't test your patch, but if you deal with floats, you should give your accum objects a float argument, i.e. [accum 0.]!
Depending on your needs, to capture the stream of values, you could use text, jit.matrix, etc., and even… capture.
accumulate object does not add wenn it receives float in the left inlet.
It just outputs it.
Does that mean that Your giro outputs zero when movement stops ?
About capturing - that dependends on what You want to do with the data collected...
Visual representation ? Or some kind of analysis ?
no it doesn't always return to zero, I need to work in some kind of filter - it should be a high pass for the gyro and a low pass for the accel.
the patch works pretty good at tallying up the angles. my sensor is supposed to read 20ms intervals but the numbers in the floats obviously aren't changing at 20ms intervals does that mean I am missing readings or is it just that the number animation can't keep up but the calculations still happen at right speed?
I did hope to be able to rotate a 3d object for a visual representation of the movement, but I can't seem to get the object to move in the correct angles?
But the most important part of the detail is to record the numerical outputs from pitch/roll, gyroscope Acc(x,y,z) then I was going to work out total linear acceleration vector and record this, then anything that is not 0.98 is movement other than gravity.
I want to translate it to spreadsheet format so in a manner that the results would be transferable would be good.
thanks
I would record raw data coming from the device, using timestamp output
to serve as for example address in coll, or even record it into audio buffer.
Later one can play it back, do calculations or whatever.
And ... the timing problem could be related to the filter You use -
averaging 5 readings
How do I do that?
that would be to get the raw data from my experimenting then process it from the extrapolated file.
so take the output terminals - convert to signal?
then how do I convert the audio back to numerical data?
I use buffer sometimes if massive data collection is needed.
It is a matter of scaling incoming data into floats that fit in audio buffer
using peek to read / write.
But in Your case that is not necessary.
You could use timestamp, which is as I understand in miliseconds
and use it as coll address. You can link that coll to cellblock.
I don't have any phidget to test, but there is good help at :
https://www.phidgets.com/?view=api
-----------
Here is simple patch with coll - cellblock :
Timestamp must be int, otherwise coll will not accept it for storage.
I don't know what gets out of the phidget, but if it is float,
You have to convert it to int.
I tried that patch, I can't get any numbers to input into the cellblock. do I need to do something to connect the coll to the cellblock?
the Phidget patch uses unpack to separate out the outputs there are 9 plus the timestamp
3 accel, 3 gyro and 3 magnetometer.
so I put number boxes between the unpack and the zl.rot
Is this correct?
Have a look in this patch :
The idea is to get the last item in the list, which is timestamp,
make sure that it is integer and not float, then move it from
last to first position of the list, and store the list into coll.
Coll address will become timestamp, and first column in the cell.
There would be alternative ways of doing so, like running
a metro - counter combo as timer, and use the list without timestamp.
If timestamp resets to zero every time one restarts the phidget,
than You get nice timeline.
You can play that back from coll using for example {clocker 1}
which would count in ms.
You are not understanding the way store to coll works.
Do it the way I did in the patch I posted.
Modify it only if You understand what exactly You do.
Coll address should be the timestamp, the rest data.
In Your patch it all makes no sense at all.
of course that explains why it worked and then stopped, the data I got through must have run through when I ran your patch before I modified and now that's why it's not working. I'll read more about coll and understand it so I can figure out.
thank you.
Have put the floats into a pak 0. 0. 0. 0. 0. 0.
then into your patch.
using a toggle to trigger a switch that starts the counter metronome and opens gate into the patch means I can run my sensor and control the collection of data
this works a treat thank you.
Is there a limit to how much can be stored into cellblock?
I am looking at about 2000-3000 rows of numbers?
I never got to a limit in cellblock, but You can easily test it.
Create a message $1 0.123456 0.123456 0.123456 0.123456 0.123456 0.123456 0.123456 0.123456
and run uzi 10000 to it (from uzi right outlet), connect to coll and You will see if it can store that much.
My idea was to capture exactly what the phidget sends without any filtering, averaging etc
and then play it back from coll so that one can better try to tame the sensor infos.
You can play it back in realtime using for example {clocker 1}, or metro with counter,
or line, anything that produces ramp in ms.
It is better to store coll to hard disk, and not cellblock.
So You can load any capture into coll and display it in cellblock.
Later, when You get all the averaging, filtering etc, You can do
different kind of capture- using output of all math.
That makes sense. I wanted to try and automate as much as the processing as possible as I will be dealing with large numbers of cells of data.
Each candidate in my test will need to do multiple runs of the same exercise.
I found a Java object that someone had made that transfers cellblock to .csv so that has been quite easy to then import into excel and make charts and do my analysis on.
The reality of the data I need to determine the amount of time spent moving during task completion (efficiency), moving both hands simultaneously, looking at linear and rotational acceleration - my hypothesis is that beginners rely more on the former than the latter. The linear can be a single vector score - I'm not concerned with what direction the motion is in it is in a way pendulous motion as it occurs around a fulcrum.
How do you export the data from the coll? and in what format does it export? or are you meaning to store it in Max and then process through max?
I mean to store coll data first. It stores as plain text.
Look at the coll help file or reference.
But of course You can also store Cellblock as file.
One could also "Play" captured data from Cellblock,
but it is much easier with coll, in case You want to do some visual animation
based on data captured.
P.S. one can store coll data via text object so that import
into excel as delimited text document gets really easy.
So conversion to cell , cvs etc is not necessary.
sure, I'll look at that.
thanks.
I'm going to try my rotations with the 3d blocks again.
then I also found some max objects to do image recognition - my next challenge to see if I can work in facial tracking so I can use my webcam to monitor someones gaze - ie. if they look down while they are operating.
You don't happen to know anything about that? or used before?
no, sorry