@@ -9,7 +9,6 @@ namespace ProBridgeSenors.Tx
99 [ AddComponentMenu ( "ProBridge/Tx/sensor_msgs/Imu" ) ]
1010 public class ImuTx : ProBridgeTxStamped < Imu >
1111 {
12- public Vector3 acceleration { get ; private set ; }
1312
1413
1514 [ Header ( "Noise Parameters" ) ]
@@ -24,7 +23,9 @@ public class ImuTx : ProBridgeTxStamped<Imu>
2423 private Vector3 _lastPosition ;
2524 private Quaternion _lastRotation ;
2625 private Vector3 _velocity ;
27- private Vector3 _angularVelocity ;
26+ protected Vector3 _acceleration ;
27+ protected Vector3 _angularVelocity ;
28+ protected Quaternion _orientation ;
2829 private bool _isGlobal ;
2930 private Vector3 _gravityDirection ;
3031 private float _gravityMagnitude ;
@@ -48,15 +49,16 @@ void FixedUpdate()
4849 _lastPosition = transform . position ;
4950 _lastRotation = transform . rotation ;
5051
51- acceleration = ( _velocity - _lastVel ) / Time . fixedDeltaTime - transform . InverseTransformDirection ( _gravityDirection ) * _gravityMagnitude ; ;
52+ _acceleration = ( _velocity - _lastVel ) / Time . fixedDeltaTime - _gravityDirection * _gravityMagnitude ; ;
5253
5354 if ( ! _isGlobal )
5455 {
55- acceleration = transform . InverseTransformDirection ( acceleration ) ;
56+ _acceleration = transform . InverseTransformDirection ( _acceleration ) ;
5657 _angularVelocity = transform . InverseTransformDirection ( _angularVelocity ) ;
5758 }
5859
5960 _lastVel = _velocity ;
61+ _orientation = transform . rotation ;
6062 }
6163 protected override ProBridge . ProBridge . Msg GetMsg ( TimeSpan ts )
6264 {
@@ -82,8 +84,8 @@ protected override ProBridge.ProBridge.Msg GetMsg(TimeSpan ts)
8284 }
8385
8486 data . angular_velocity = _angularVelocity . ToRosAngular ( ) ;
85- data . linear_acceleration = acceleration . ToRos ( ) ;
86- data . orientation = transform . rotation . ToRos ( ) ;
87+ data . linear_acceleration = _acceleration . ToRos ( ) ;
88+ data . orientation = _orientation . ToRos ( ) ;
8789
8890 return base . GetMsg ( ts ) ;
8991 }
0 commit comments