@@ -207,14 +207,34 @@ State State::inFrame (
207
207
throw ostk::core::error::runtime::Undefined (" State" ) ;
208
208
}
209
209
210
+ const Vector3d& x_OLD = position_ ;
211
+ const Vector3d& v_OLD_in_OLD = velocity_ ;
212
+ const Quaternion& q_B_OLD = attitude_ ;
213
+ const Vector3d& w_B_OLD_in_B = angularVelocity_ ;
214
+
210
215
const Transform transform_NEW_OLD = frameSPtr_->getTransformTo (aFrameSPtr, instant_) ;
211
216
212
- const Vector3d position = transform_NEW_OLD.applyToPosition (position_) ;
213
- const Vector3d velocity = transform_NEW_OLD.applyToVelocity (position_, velocity_) ;
214
- const Quaternion attitude = attitude_ * transform_NEW_OLD.getOrientation ().toConjugate () ;
215
- const Vector3d angularVelocity = { 0.0 , 0.0 , 0.0 } ; // transform_NEW_OLD.getAngularVelocity() [TBI] ;
217
+ const Quaternion q_NEW_OLD = transform_NEW_OLD.getOrientation () ;
218
+ const Vector3d w_NEW_OLD_in_NEW = transform_NEW_OLD.getAngularVelocity () ;
219
+
220
+ // x_NEW = T_NEW_OLD(x_OLD)
221
+
222
+ const Vector3d x_NEW = transform_NEW_OLD.applyToPosition (x_OLD) ;
223
+
224
+ // v_NEW = T_NEW_OLD(v_OLD)
225
+
226
+ const Vector3d v_NEW_in_NEW = transform_NEW_OLD.applyToVelocity (x_OLD, v_OLD_in_OLD) ;
227
+
228
+ // q_B_NEW = q_B_OLD * q_OLD_NEW
229
+
230
+ const Quaternion q_B_NEW = q_B_OLD * q_NEW_OLD.toConjugate () ;
231
+
232
+ // w_B_NEW_in_B = w_B_OLD_in_B + w_OLD_NEW_in_B
233
+ // = w_B_OLD_in_B - q_B_NEW * w_NEW_OLD_in_NEW
234
+
235
+ const Vector3d w_B_NEW_in_B = w_B_OLD_in_B - q_B_NEW * w_NEW_OLD_in_NEW ;
216
236
217
- return { instant_, position, velocity, attitude, angularVelocity , aFrameSPtr } ;
237
+ return { instant_, x_NEW, v_NEW_in_NEW, q_B_NEW, w_B_NEW_in_B , aFrameSPtr } ;
218
238
219
239
}
220
240
0 commit comments