74 using ::std::numeric_limits;
76 double norm_w = w.norm();
78 if(norm_w < numeric_limits<double>::epsilon() ) {
82 double th = norm_w * dt;
87 out_p = rot * p0 + (Matrix33::Identity() - rot) * w_n.cross(vo_n) + w_n * w_n.transpose() * vo_n * th;
88 out_R.noalias() = rot * R0;
95 body->clearSensorValues();
108 for(
int i=0;
i <
n; ++
i){
111 sensor->
w = sensor->
localR.transpose() * link->R.transpose() * link->w;
115 for(
int i=0;
i <
n; ++
i){
131 for(
int i=0;
i < 3; ++
i){
132 x[
i](0) = o_Vgsens(
i);
137 for(
int i=0;
i < 3; ++
i){
138 x[
i] =
A * x[
i] + o_Vgsens(
i) *
B;
142 Vector3 o_Agsens(x[0](1), x[1](1), x[2](1));
145 sensor->
dv.noalias() = sensor->
localR.transpose() * link->
R.transpose() * o_Agsens;
153 for(
int i=0;
i <
n; ++
i){
161 static const double n_input = 100.0;
162 static const double n_output = 0.001;
168 Ac << -sqrt(2*n_input/n_output), 1.0,
169 -n_input/n_output, 0.0;
171 vector2 Bc(sqrt(2*n_input/n_output), n_input/n_output);
173 A = matrix22::Identity();
180 double factorial[14];
183 for(
int i=2;
i <= 13; ++
i){
185 factorial[
i] = factorial[
i-1] * r;
188 for(
int i=1;
i <= 12;
i++){
189 An2.noalias() = Ac * An;
191 A += (1.0 / factorial[
i]) * An;
193 Bn2.noalias() = Ac * Bn;
195 B += (1.0 / factorial[
i+1]) * Bn;
void setTimeStep(double timeStep)
virtual ~ForwardDynamics()
enum hrp::ForwardDynamics::@2 integrationMode
Vector3 w
angular velocity, omega
boost::shared_ptr< Body > BodyPtr
static void SE3exp(Vector3 &out_p, Matrix33 &out_R, const Vector3 &p0, const Matrix33 &R0, const Vector3 &w, const Vector3 &vo, double dt)
update position/orientation using spatial velocity
void setGravityAcceleration(const Vector3 &g)
Matrix33 rodrigues(const Vector3 &axis, double q)
EIGEN_MAKE_ALIGNED_OPERATOR_NEW ForwardDynamics(BodyPtr body)
virtual void updateSensorsFinal()
virtual void initializeSensors()
Vector3 cross(const Vector3 &v1, const Vector3 &v2)
void enableSensors(bool on)
void updateAccelSensor(AccelSensor *sensor)
void setRungeKuttaMethod()
void initializeAccelSensors()