Arena to Unity streaming

NatNet, VRPN, TrackD, and Plugins
Quen
Posts: 14
Joined: Wed Jun 02, 2010 7:22 am
Location: Hamburg, Germany

Re: Arena to Unity streaming

Post by Quen »

Thanks for your reply, Morgan!
I will check my scripts next week and report the result here. :-)
shiny987
Posts: 8
Joined: Wed Nov 21, 2012 4:43 am
Location: United Kingdom, Hertforshire, Hatfield

Re: Arena to Unity streaming

Post by shiny987 »

Thank you morgan, can i have one more information? With the direct depacketization do i need unity pro and to import the natnetml.dll?
morgan
NaturalPoint Employee
NaturalPoint Employee
Posts: 199
Joined: Tue Jun 24, 2008 2:01 pm
Location: Corvallis, OR, USA
Contact:

Re: Arena to Unity streaming

Post by morgan »

No - the direct depacketization script is a script only solution, so it does not require Unity Pro or the NatNetML.dll.
shiny987
Posts: 8
Joined: Wed Nov 21, 2012 4:43 am
Location: United Kingdom, Hertforshire, Hatfield

Re: Arena to Unity streaming

Post by shiny987 »

As I thought, thank you for your fast reply. I'll try to modify that script (i have arena 1.7.x) to work with my data. I'll let you know if I have some specific problem
shiny987
Posts: 8
Joined: Wed Nov 21, 2012 4:43 am
Location: United Kingdom, Hertforshire, Hatfield

Re: Arena to Unity streaming

Post by shiny987 »

Hello I'm sorry that i'm bothering you again. I modified the previous script to give in output e store in one object the same data of the natnet example packetclient. Now i would like to know the meaning of the following data (they are from the natnet example) because actually i can move my first person camera in unity using the X axis but i cannot figure out how to move the camera in the Y axis if i don't know in which format the coordinates are sent to me. So can anyone explain me which is the meaning of the bold part of the following captured data?
Begin Packet
-------
Message ID : 7
Byte count : 172
Frame # : 1390
Marker Set Count : 1
Model Name: All
Marker Count : 3
Marker 0 : [x=-46.90,y=408.69,z=-74.99]
Marker 1 : [x=-22.31,y=-409.19,z=-82.11]
Marker 2 : [x=-0.01,y=0.24,z=0.00]

Unidentified Marker Count : 0
Rigid Body Count : 1
ID : 65537
pos: [-616.15,1144.64,478.98]
ori: [-0.09,0.29,0.02,0.95]

Marker Count: 3
Marker 0: id=0 size=0.0 pos=[-617.08,1563.51,464.11]
Marker 1: id=0 size=0.0 pos=[-586.47,754.26,330.56]
Marker 2: id=0 size=0.0 pos=[-616.15,1144.64,478.98]

Mean marker error: 0.00


Begin Packet
-------
Message ID : 7
Byte count : 172
Frame # : 1391
Marker Set Count : 1
Model Name: All
Marker Count : 3
Marker 0 : [x=-46.89,y=408.60,z=-74.98]
Marker 1 : [x=-22.22,y=-409.22,z=-81.90]
Marker 2 : [x=-0.01,y=0.32,z=0.00]

Unidentified Marker Count : 0
Rigid Body Count : 1
ID : 65537
pos: [-613.91,1144.71,479.40]
ori: [-0.09,0.29,0.02,0.95]

Marker Count: 3
Marker 0: id=0 size=0.0 pos=[-614.83,1563.59,464.54]
Marker 1: id=0 size=0.0 pos=[-584.39,754.34,330.94]
Marker 2: id=0 size=0.0 pos=[-613.91,1144.71,479.40]

Mean marker error: 0.00
morgan
NaturalPoint Employee
NaturalPoint Employee
Posts: 199
Joined: Tue Jun 24, 2008 2:01 pm
Location: Corvallis, OR, USA
Contact:

Re: Arena to Unity streaming

Post by morgan »

Arena streams out marker data in multiple formats. For your sample packet, there is "Marker Set" markers (the first one) and "Rigid Body" markers (the second one).

"Marker Set" markers are markers associated with a "marker set", such as a skeleton. In Arena there is also always an "all" marker set, which is all labeled markers, as shown in your packet above.

"Rigid Body" markers are the list of markers associated with a defined rigid body, in your case the rigid body with id 65537.

These are the same markers, but the values can differ based upon settings in the Arena -> Streaming panel settings.

They will either represent "global/world" or "local/relative/parent".

"global" is the position of the marker in global (or "world") coordinate space, i.e. relative to wherever you place the L-frame during calibration.

However, if you have checked (on the Arena streaming tab) "local marker pos", then the value will be relative to its parent.

In your case, the "rigid body" markers appear to be in the global coordinate system, while the "marker set" markers are in the "local" coordinate system (i.e. relative to your rigid body's pos/ori). See marker 2 for example. That marker must be very close to the root of your rigid body?
shiny987
Posts: 8
Joined: Wed Nov 21, 2012 4:43 am
Location: United Kingdom, Hertforshire, Hatfield

Re: Arena to Unity streaming

Post by shiny987 »

Thank you for your reply and for your infos but to figure out how to use those data i need to know in which format they are sent through the network. I mean are they sent in radiant or vector 3d or quarterion or ...?

In the end i need to transform those data in Euler angles and that's why i need to know the source format.

Thank you in advance for your help :)

P.S. can u explain me what's the meaning of the parameters pos and ori in the following data (a portion of the previous post)?
ID : 65537
pos: [-613.91,1144.71,479.40]
ori: [-0.09,0.29,0.02,0.95]


Can it be that ori means orientation (quarterion in radiant) and pos represent the vector [roll(x), yaw(y), pitch(z)] in radiants?
morgan
NaturalPoint Employee
NaturalPoint Employee
Posts: 199
Joined: Tue Jun 24, 2008 2:01 pm
Location: Corvallis, OR, USA
Contact:

Re: Arena to Unity streaming

Post by morgan »

pos is position of the origin of the rigid body, in world space ( that is to say relative to the L-frame you used during calibration), in millimeters.

ori is the orientation, as a quaternion.

Since quaternions can be decoded into eulers in a variety of different conventions, we provide a quatToEuler conversion routine in the NatNet samples. See the SampleClient3D source in the NatNet sdk (NatUtils.cpp), which has a variety of quaternion decomposition routines.

morgan
shiny987
Posts: 8
Joined: Wed Nov 21, 2012 4:43 am
Location: United Kingdom, Hertforshire, Hatfield

Re: Arena to Unity streaming

Post by shiny987 »

Hello, thanks to your infos i managed to move my main camera in unity according to my tracked bow movements. Now i wanted to shoot an arrow but whenever i bend my real bow i lose the rigidbody in arena and so no streaming data are sent. I read that you can stream unlabeled markers in arena and my question is: "Is it possible to stream data of markers that change the relative position respect each other?"

In other words i need to track 3 points of my bow separately, do u think that create 3 rigidbody for a single bow is a good solution? (i'm asking because actually i cannot work with my optitrack system until the 5th january but i have this problem in my mind)

Thank you in advance for your help. Cheers.
morgan
NaturalPoint Employee
NaturalPoint Employee
Posts: 199
Joined: Tue Jun 24, 2008 2:01 pm
Location: Corvallis, OR, USA
Contact:

Re: Arena to Unity streaming

Post by morgan »

3 rigid bodies might be your better approach. This is how we tend to track golf clubs. Gives us a very exact mechanism for measuring shaft deflection - would be same for your bow. Challenge is getting good physical marker positions - on clubs we tend to use standoffs (posts). Not sure if this is an option for your setup. This approach would also provide more stable rigid bodies to define the overall pos/ori of the bow.

1 rigid body is also still doable - in Tracking Tools you can try adjusting the dynamic constraints of the rigid body to allow more flexibility and still track. Not sure however how well this is going to affect the overall stability of your bow's pos/ori. If you are calculating the pos/ori yourself from marker data then this would be up to your code.

hope this helps

Morgan
Post Reply