46 const int num_positions_in = scene_in->GetKinematicTree().GetNumControlledJoints();
48 if (num_positions_in != 2)
54 const double&
theta =
x(1);
55 const double&
xdot =
x(2);
56 const double& thetadot =
x(3);
60 auto theta_dot_squared = thetadot * thetadot;
63 x_dot <<
xdot, thetadot,
64 (
u(0) +
m_p_ * sin_theta * (
l_ * theta_dot_squared +
g_ * cos_theta)) /
65 (
m_c_ +
m_p_ * sin_theta * sin_theta),
66 -(
l_ *
m_p_ * cos_theta * sin_theta * theta_dot_squared +
u(0) * cos_theta +
76 const double&
theta =
x(1);
77 const double&
tdot =
x(3);
102 const double&
theta =
x(1);
108 fu << 0, 0, 1 / (
m_c_ +
m_p_ * sin_theta * sin_theta), -cos_theta / (
l_ *
m_c_ +
l_ *
m_p_ * sin_theta * sin_theta);
119 const double&
theta =
x(1);
120 const double&
tdot =
x(3);
126 fxx.setValues({{{0, 0, 0, 0},
133 8 *
m_p_ *
m_p_ * (
m_p_ * (
g_ * cos_theta +
l_ *
tdot *
tdot) * sin_theta +
u(0)) * sin_theta * sin_theta * cos_theta * cos_theta /
134 std::pow(
m_c_ +
m_p_ * sin_theta * sin_theta, 3) -
135 4 *
m_p_ * (-
g_ *
m_p_ * sin_theta * sin_theta +
m_p_ * (
g_ * cos_theta +
l_ *
tdot *
tdot) * cos_theta) * sin_theta * cos_theta / std::pow(
m_c_ +
m_p_ * sin_theta * sin_theta, 2) +
136 2 *
m_p_ * (
m_p_ * (
g_ * cos_theta +
l_ *
tdot *
tdot) * sin_theta +
u(0)) * sin_theta * sin_theta / std::pow(
m_c_ +
m_p_ * sin_theta * sin_theta, 2) - 2 *
m_p_ * (
m_p_ * (
g_ * cos_theta +
l_ *
tdot *
tdot) * sin_theta +
u(0)) * cos_theta * cos_theta / std::pow(
m_c_ +
m_p_ * sin_theta * sin_theta, 2) + (-3 *
g_ *
m_p_ * sin_theta * cos_theta -
m_p_ * (
g_ * cos_theta +
l_ *
tdot *
tdot) * sin_theta) / (
m_c_ +
m_p_ * sin_theta * sin_theta),
151 0, 2 *
l_ *
m_p_ * sin_theta / (
m_c_ +
m_p_ * sin_theta * sin_theta)},
153 4 *
l_ *
l_ *
m_p_ *
m_p_ *
tdot * sin_theta * sin_theta * cos_theta * cos_theta / std::pow(
l_ *
m_c_ +
l_ *
m_p_ * sin_theta * sin_theta, 2) +
155 0, -2 *
l_ *
m_p_ * sin_theta * cos_theta / (
l_ *
m_c_ +
l_ *
m_p_ * sin_theta * sin_theta)}}});
161 const double&
theta =
x(1);
167 fxu.setValues({{{0, 0, 0, 0},
169 {0, -2 *
m_p_ * sin_theta * cos_theta / std::pow(
m_c_ +
m_p_ * sin_theta * sin_theta, 2), 0, 0},
170 {0, 2 *
l_ *
m_p_ * sin_theta * cos_theta * cos_theta / std::pow(
l_ *
m_c_ +
l_ *
m_p_ * sin_theta * sin_theta, 2) + sin_theta / (
l_ *
m_c_ +
l_ *
m_p_ * sin_theta * sin_theta),