[X3D-Public] Accelerometer environment sensor

Don Brutzman brutzman at nps.edu
Wed Nov 18 09:53:34 PST 2009


Keith Victor wrote:
> Hey Don:
>  
> I think it might look like this:
>  
> SFBool   InputOutput   enabled    // typical Sensor Node field
> SFVec3f    outputOnly    acceleration_changed    // the acceleration 
> vector, in Gs.
>  
> Simple enough?

thanks Keith.  so far so good...

> One simple example usage:
> Then just Route that into a Script, do an atan2( accel.y, accel.x ) to 
> get an angle.
> SetOrientation(  0,0,1, atan2( ... ) )
>  
> Set the orientation of a Transform that is inside a Billboard, and the 
> content will remain plum as you rotate the device around.

aha this is where it gets trickier.  we likely don't want users to
write Script nodes to integrate accelerations and moments (linear
and rotational forces) into velocities.  too hard, too error prone.
so adding another similar SFVec3f field for velocity_changed is
likely justifiable.

it looks like the CSS example goes one integration step further and
provides orientation angles.  which is most helpful for a scene author
to use.  presumably we can set the initial orientation as zero when the
node becomes enabled, allowing author control (enable/disable) if a
reset capability is needed.

folowing Keith's lead, here is a fuller possible signature:

22 Environmental sensor component

AccelerationSensor: X3DSensorNode {
   SFBool [in,out]  enabled  TRUE
   SFVec3f [out]    acceleration_changed [m/s^2]
   SFVec3f [out]    velocity_changed     [m/s]
   SFRotation [out] orientation_changed
   SFNode [in,out]  metadata NULL [X3DMetadataObject]
   SFBool [out]     isActive
}

p.s. it would be helpful if someone actually looked at the Mozilla
implementation, we wouldn't have to speculate as much about what
they are doing.  anybody out there?

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br           brutzman at nps.edu
Watkins 270   MOVES Institute, Monterey CA 93943-5000 USA  work +1.831.656.2149
X3D, virtual worlds, underwater robots, XMSF  http://web.nps.navy.mil/~brutzman




More information about the X3D-Public mailing list