Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
tests
SpatialRigidBodyInertiaTests.cpp
Go to the documentation of this file.
1
//
2
// Created by jordan on 9/28/16.
3
//
4
5
#include <gtest/gtest.h>
6
#include "
Fixtures.h
"
7
#include "
rdl_dynamics/SpatialRigidBodyInertia.hpp
"
8
#include "
UnitTestUtils.hpp
"
9
10
using namespace
RobotDynamics::Math
;
11
12
class
SpatialRigidBodyInertiaTests
:
public
testing::Test
13
{
14
public
:
15
SpatialRigidBodyInertiaTests
()
16
{
17
}
18
19
void
SetUp
()
20
{
21
}
22
23
void
TearDown
()
24
{
25
}
26
};
27
28
TEST_F
(
FixedBase3DoFPlanar
, testAdd)
29
{
30
SpatialInertia
Ibody = model->I[1];
31
SpatialInertia
I_2(model->bodyFrames[1], 3.2,
Vector3d
(-0.4, 1., 0.1), 1.2, 0.1, 0.2, 0.3, 0.4, 0.5);
32
33
SpatialMatrix
I_expected = Ibody.
toMatrix
() + I_2.
toMatrix
();
34
35
SpatialInertia
I_added = Ibody + I_2;
36
37
EXPECT_TRUE(
unit_test_utils::checkSpatialMatrixEpsilonClose
(I_added.
toMatrix
(), I_expected,
unit_test_utils::TEST_PREC
));
38
}
39
40
TEST_F
(
FixedBase3DoFPlanar
, ChangeFrameTest)
41
{
42
SpatialInertia
Ibody = model->I[1];
43
SpatialInertia
Ibody_c = model->Ib_c[1];
44
45
Ibody.
changeFrame
(model->bodyCenteredFrames[1]);
46
47
EXPECT_TRUE(
unit_test_utils::checkSpatialMatrixEpsilonClose
(Ibody.
toMatrix
(), Ibody_c.
toMatrix
(),
unit_test_utils::TEST_PREC
));
48
49
Ibody = model->I[3];
50
Ibody_c = model->Ib_c[3];
51
52
Ibody_c.
changeFrame
(model->bodyFrames[3]);
53
54
EXPECT_TRUE(
unit_test_utils::checkSpatialMatrixEpsilonClose
(Ibody.
toMatrix
(), Ibody_c.
toMatrix
(),
unit_test_utils::TEST_PREC
));
55
}
56
57
int
main
(
int
argc,
char
** argv)
58
{
59
::testing::InitGoogleTest(&argc, argv);
60
return
RUN_ALL_TESTS();
61
}
Fixtures.h
SpatialRigidBodyInertiaTests
Definition:
SpatialRigidBodyInertiaTests.cpp:12
RobotDynamics::Math::SpatialMatrix
Definition:
rdl_eigenmath.h:279
unit_test_utils::TEST_PREC
const double TEST_PREC
Definition:
UnitTestUtils.hpp:22
UnitTestUtils.hpp
SpatialRigidBodyInertiaTests::SetUp
void SetUp()
Definition:
SpatialRigidBodyInertiaTests.cpp:19
SpatialRigidBodyInertia.hpp
RobotDynamics::Math::Vector3d
Definition:
rdl_eigenmath.h:54
TEST_F
TEST_F(FixedBase3DoFPlanar, testAdd)
Definition:
SpatialRigidBodyInertiaTests.cpp:28
FixedBase3DoFPlanar
Definition:
Fixtures.h:8
RobotDynamics::FrameObject::changeFrame
virtual void changeFrame(ReferenceFramePtr desiredFrame)
Change the ReferenceFrame this FrameObject is expressed in.
Definition:
FrameObject.cpp:12
main
int main(int argc, char **argv)
Definition:
SpatialRigidBodyInertiaTests.cpp:57
RobotDynamics::Math::SpatialInertia
A Math::SpatialInertia is a RigidBodyInertia explicitly expressed in a RobotDynamics::ReferenceFrame...
Definition:
SpatialRigidBodyInertia.hpp:32
SpatialRigidBodyInertiaTests::TearDown
void TearDown()
Definition:
SpatialRigidBodyInertiaTests.cpp:23
unit_test_utils::checkSpatialMatrixEpsilonClose
static bool checkSpatialMatrixEpsilonClose(const RobotDynamics::Math::SpatialMatrix &t1, const RobotDynamics::Math::SpatialMatrix &t2, const double epsilon)
Definition:
UnitTestUtils.hpp:122
RobotDynamics::Math
Math types such as vectors and matrices and utility functions.
Definition:
ForceVector.hpp:21
RobotDynamics::Math::RigidBodyInertia::toMatrix
SpatialMatrix toMatrix() const
Definition:
RigidBodyInertia.cpp:102
SpatialRigidBodyInertiaTests::SpatialRigidBodyInertiaTests
SpatialRigidBodyInertiaTests()
Definition:
SpatialRigidBodyInertiaTests.cpp:15
rdl_dynamics
Author(s):
autogenerated on Tue Apr 20 2021 02:25:28