3 #include <gtest/gtest.h> 44 Joint(
SpatialVector(0., 0., 0., 1., 0., 0.),
SpatialVector(0., 0., 0., 0., 1., 0.),
SpatialVector(0., 0., 0., 0., 0., 1.),
45 SpatialVector(0., 0., 1., 0., 0., 0.),
SpatialVector(0., 1., 0., 0., 0., 0.),
SpatialVector(1., 0., 0., 0., 0., 0.)),
48 q = VectorNd::Constant(model->dof_count, 0.);
49 qdot = VectorNd::Constant(model->dof_count, 0.);
50 qddot = VectorNd::Constant(model->dof_count, 0.);
51 tau = VectorNd::Constant(model->dof_count, 0.);
57 FramePoint p(model->worldFrame, Vector3d::Zero());
67 Joint(
SpatialVector(0., 0., 0., 1., 0., 0.),
SpatialVector(0., 0., 0., 0., 1., 0.),
SpatialVector(0., 0., 0., 0., 0., 1.),
68 SpatialVector(0., 0., 1., 0., 0., 0.),
SpatialVector(0., 1., 0., 0., 0., 0.),
SpatialVector(1., 0., 0., 0., 0., 0.)),
75 model->addBody(base_body_id,
Xtrans(
Vector3d(2., 0., 0.)), joint_a, body_a);
78 VectorNd Q = VectorNd::Zero((
size_t)model->dof_count);
79 VectorNd QDot = VectorNd::Zero((
size_t)model->dof_count);
81 VectorNd Tau = VectorNd::Zero((
size_t)model->dof_count);
124 Joint(
SpatialVector(0., 0., 0., 1., 0., 0.),
SpatialVector(0., 0., 0., 0., 1., 0.),
SpatialVector(0., 0., 0., 0., 0., 1.),
125 SpatialVector(0., 0., 1., 0., 0., 0.),
SpatialVector(0., 1., 0., 0., 0., 0.),
SpatialVector(1., 0., 0., 0., 0., 0.)),
128 VectorNd Q = VectorNd::Zero(model->dof_count);
133 unsigned int ref_body_id = base_body_id;
137 Vector3d point_position(1., 0., 0.);
140 point_velocity =
calcPointVelocity(*model, Q, QDot, ref_body_id, point_position);
150 point_velocity =
calcPointVelocity(*model, Q, QDot, ref_body_id, point_position);
161 point_velocity =
calcPointVelocity(*model, Q, QDot, ref_body_id, point_position);
173 Joint(
SpatialVector(0., 0., 0., 1., 0., 0.),
SpatialVector(0., 0., 0., 0., 1., 0.),
SpatialVector(0., 0., 0., 0., 0., 1.),
174 SpatialVector(0., 0., 1., 0., 0., 0.),
SpatialVector(0., 1., 0., 0., 0., 0.),
SpatialVector(1., 0., 0., 0., 0., 0.)),
177 VectorNd q = VectorNd::Zero(model->dof_count);
178 VectorNd qdot = VectorNd::Zero(model->dof_count);
179 VectorNd qddot = VectorNd::Zero(model->dof_count);
180 VectorNd tau = VectorNd::Zero(model->dof_count);
182 unsigned int ref_body_id = base_body_id;
199 Vector3d point_body_position(1., 0., 0.);
202 Vector3d point_base_velocity_reference;
206 point_base_velocity =
calcPointVelocity(*model, q, qdot, ref_body_id, point_body_position);
208 point_base_velocity_reference =
Vector3d(-3.888503432977729e-01, -3.171179347202455e-01, 1.093894197498446e+00);
227 Joint(
SpatialVector(0., 0., 0., 1., 0., 0.),
SpatialVector(0., 0., 0., 0., 1., 0.),
SpatialVector(0., 0., 0., 0., 0., 1.),
228 SpatialVector(0., 0., 1., 0., 0., 0.),
SpatialVector(0., 1., 0., 0., 0., 0.),
SpatialVector(1., 0., 0., 0., 0., 0.)),
231 VectorNd q = VectorNd::Zero(model->dof_count);
232 VectorNd qdot = VectorNd::Zero(model->dof_count);
233 VectorNd qddot = VectorNd::Zero(model->dof_count);
234 VectorNd tau = VectorNd::Zero(model->dof_count);
236 unsigned int ref_body_id = base_body_id;
253 Vector3d point_body_position(-1.9, -1.8, 0.);
259 qddot = VectorNd::Zero(qddot.size());
263 FramePoint point_world_position(model->bodyFrames[ref_body_id], point_body_position);
264 point_world_position.
changeFrame(model->worldFrame);
265 point_world_velocity =
calcPointVelocity(*model, q, qdot, ref_body_id, point_body_position);
267 point_world_acceleration =
calcPointAcceleration(*model, q, qdot, qddot, ref_body_id, point_body_position);
269 Vector3d humans_point_position(-6.357089363622626e-01, -6.831041744630977e-01, 2.968974805916970e+00);
270 Vector3d humans_point_velocity(3.091226260907569e-01, 3.891012095550828e+00, 4.100277995030419e+00);
271 Vector3d humans_point_acceleration(-5.302760158847160e+00, 6.541369639625232e+00, -4.795115077652286e+00);
293 Joint(
SpatialVector(0., 0., 0., 1., 0., 0.),
SpatialVector(0., 0., 0., 0., 1., 0.),
SpatialVector(0., 0., 0., 0., 0., 1.),
294 SpatialVector(0., 0., 1., 0., 0., 0.),
SpatialVector(0., 1., 0., 0., 0., 0.),
SpatialVector(1., 0., 0., 0., 0., 0.)),
297 VectorNd q = VectorNd::Zero(model->dof_count);
298 VectorNd qdot = VectorNd::Zero(model->dof_count);
299 VectorNd qddot = VectorNd::Zero(model->dof_count);
300 VectorNd tau = VectorNd::Zero(model->dof_count);
302 unsigned int ref_body_id = base_body_id;
305 Vector3d point_body_position(-1.9, -1.8, 0.);
311 qddot = VectorNd::Zero(qddot.size());
320 FramePoint point_world_position(model->bodyFrames[ref_body_id], point_body_position);
321 point_world_position.
changeFrame(model->worldFrame);
322 point_world_velocity =
calcPointVelocity(*model, q, qdot, ref_body_id, point_body_position);
324 point_world_acceleration =
calcPointAcceleration(*model, q, qdot, qddot, ref_body_id, point_body_position);
326 Vector3d humans_point_position(-1.900000000000000e+00, -1.800000000000000e+00, 0.000000000000000e+00);
327 Vector3d humans_point_velocity(0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00);
328 Vector3d humans_point_acceleration(2.440000000000000e+00, -1.370000000000000e+00, 9.899999999999999e-01);
350 Joint(
SpatialVector(0., 0., 0., 1., 0., 0.),
SpatialVector(0., 0., 0., 0., 1., 0.),
SpatialVector(0., 0., 0., 0., 0., 1.),
351 SpatialVector(0., 0., 1., 0., 0., 0.),
SpatialVector(0., 1., 0., 0., 0., 0.),
SpatialVector(1., 0., 0., 0., 0., 0.)),
354 VectorNd q = VectorNd::Zero(model->dof_count);
355 VectorNd qdot = VectorNd::Zero(model->dof_count);
356 VectorNd qddot = VectorNd::Zero(model->dof_count);
357 VectorNd tau = VectorNd::Zero(model->dof_count);
359 unsigned int ref_body_id = base_body_id;
362 Vector3d point_body_position(-1.9, -1.8, 0.);
391 FramePoint point_world_position(model->bodyFrames[ref_body_id], point_body_position);
392 point_world_position.
changeFrame(model->worldFrame);
393 point_world_velocity =
calcPointVelocity(*model, q, qdot, ref_body_id, point_body_position);
395 point_world_acceleration =
calcPointAcceleration(*model, q, qdot, qddot, ref_body_id, point_body_position);
397 Vector3d humans_point_position(-6.357089363622626e-01, -6.831041744630977e-01, 2.968974805916970e+00);
398 Vector3d humans_point_velocity(3.091226260907569e-01, 3.891012095550828e+00, 4.100277995030419e+00);
399 Vector3d humans_point_acceleration(-4.993637532756404e+00, 1.043238173517606e+01, -6.948370826218673e-01);
406 int main(
int argc,
char** argv)
408 ::testing::InitGoogleTest(&argc, argv);
409 return RUN_ALL_TESTS();
TEST_F(FloatingBaseTestFixture, TestCalcPointTransformation)
File containing the FramePoint<T> object definition.
A FramePoint is a 3D point that is expressed in a ReferenceFrame. To change the ReferenceFrame a Fram...
Describes all properties of a single body.
SpatialTransform Xtrans(const Vector3d &r)
Get pure translation transform.
Math::FrameVector calcPointAcceleration(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &QDDot, unsigned int body_id, const Math::Vector3d &point_position, bool update_kinematics=true)
Computes the linear acceleration of a point on a body.
Math::MotionVector gravity
the cartesian vector of the gravity
int main(int argc, char **argv)
EIGEN_STRONG_INLINE Math::Vector3d vec() const
Math::FrameVector calcPointVelocity(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, unsigned int body_id, const Math::Vector3d &point_position, bool update_kinematics=true)
Computes the velocity of a point on a body.
virtual void changeFrame(ReferenceFramePtr desiredFrame)
Change the ReferenceFrame this FrameObject is expressed in.
Describes a joint relative to the predecessor body.
FloatingBaseTestFixture()
Contains all information about the rigid body model.
Math types such as vectors and matrices and utility functions.
unsigned int base_body_id
static bool checkVector3dEpsilonClose(const RobotDynamics::Math::Vector3d &v1, const RobotDynamics::Math::Vector3d &v2, const double epsilon)
void forwardDynamics(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, Math::VectorNd &QDDot, Math::SpatialForceV *f_ext=nullptr, bool update_kinematics=true)
Computes forward dynamics with the Articulated Body Algorithm.
Namespace for all structures of the RobotDynamics library.