1 #include <gtest/gtest.h> 12 std::srand(time(NULL));
31 transform1.
r.
set(6., 5., 3.);
36 transform1.
r.
set(3., -6., 4.);
106 transform1.
r.
set(6., 5., 3.);
111 transform1.
r.
set(3., -6., 4.);
135 EXPECT_STREQ(framePoint.
getReferenceFrame()->getName().c_str(), root1->getName().c_str());
153 EXPECT_EQ(p1.
x(), framePoint1.
x());
154 EXPECT_EQ(p1.
y(), framePoint1.
y());
155 EXPECT_EQ(p1.
z(), framePoint1.
z());
160 transform1.r.set(5., 0., 0.);
166 EXPECT_TRUE(framePoint1.
distance(framePoint2) == sqrt(36. + 16. + 4.));
174 EXPECT_STREQ(e.
what(),
"Reference frames do not match!");
188 EXPECT_STREQ(e.
what(),
"Reference frame is nullptr!");
200 transform1.
r.
set(5., 0., 0.);
206 EXPECT_TRUE(framePoint1.
distance(framePoint2) == sqrt(36. + 16. + 4.));
214 EXPECT_STREQ(e.
what(),
"Reference frames do not match!");
226 transform1.
r.
set(5., 0., 0.);
232 EXPECT_TRUE(framePoint1->distanceL1(*framePoint2) == 12.);
236 framePoint3->distanceL1(*framePoint2);
240 EXPECT_STREQ(e.
what(),
"Reference frames do not match!");
252 transform1.
r.
set(5., 0., 0.);
258 EXPECT_TRUE(framePoint1->distanceL1(*framePoint2) == 12.);
262 framePoint3->distanceL1(*framePoint2);
266 EXPECT_STREQ(e.
what(),
"Reference frames do not match!");
278 transform1.
r.
set(5., 0., 0.);
284 EXPECT_TRUE(framePoint1->distanceLinf(*framePoint2) == 6.);
288 framePoint3->distanceL1(*framePoint2);
292 EXPECT_STREQ(e.
what(),
"Reference frames do not match!");
304 transform1.
r.
set(5., 0., 0.);
310 EXPECT_TRUE(framePoint1->distanceLinf(*framePoint2) == 6.);
314 framePoint3->distanceL1(*framePoint2);
318 EXPECT_STREQ(e.
what(),
"Reference frames do not match!");
328 EXPECT_EQ(framePoint.
x(), 3.);
329 EXPECT_EQ(framePoint.
y(), 6.);
330 EXPECT_EQ(framePoint.
z(), 9.);
336 EXPECT_EQ(v.x(), 4.);
337 EXPECT_EQ(v.y(), 8.);
338 EXPECT_EQ(v.z(), 12.);
342 EXPECT_NEAR(p_check.
x(), framePoint.
x(), 1.e-12);
343 EXPECT_NEAR(p_check.
y(), framePoint.
y(), 1.e-12);
344 EXPECT_NEAR(p_check.
z(), framePoint.
z(), 1.e-12);
346 p_check = framePoint - v;
348 EXPECT_NEAR(p_check.x(), p2.x(), 1.e-12);
349 EXPECT_NEAR(p_check.y(), p2.y(), 1.e-12);
350 EXPECT_NEAR(p_check.z(), p2.z(), 1.e-12);
353 int main(
int argc,
char** argv)
355 ::testing::InitGoogleTest(&argc, argv);
356 ::testing::FLAGS_gtest_death_test_style =
"threadsafe";
357 return RUN_ALL_TESTS();
EIGEN_STRONG_INLINE double & x()
TEST_F(FramePointTest, testChangeFrame)
File containing the FramePoint<T> object definition.
ReferenceFramePtr getReferenceFrame() const
Get a pointer to the reference frame this FrameObject is expressed in.
A FramePoint is a 3D point that is expressed in a ReferenceFrame. To change the ReferenceFrame a Fram...
Math::Point3d point() const
Get as point3d.
A custom exception for frame operations.
static ReferenceFramePtr createARootFrame(const std::string &frameName)
Creates a root frame with ReferenceFrame::parentFrame=nullptr.
SpatialTransform Xroty(const double &yrot)
Get transform with zero translation and pure rotation about y axis.
int main(int argc, char **argv)
virtual const char * what() const
SpatialTransform Xrotz(const double &zrot)
Get transform with zero translation and pure rotation about z axis.
EIGEN_STRONG_INLINE void setIncludingFrame(const Math::Vector3d &v, ReferenceFramePtr referenceFrame)
Set both the ReferenceFrame this object is expressed in as well as the (x,y,z) coordinates of the poi...
std::shared_ptr< ReferenceFrame > ReferenceFramePtr
virtual void changeFrame(ReferenceFramePtr desiredFrame)
Change the ReferenceFrame this FrameObject is expressed in.
FramePoint changeFrameAndCopy(ReferenceFramePtr referenceFrame) const
copy into new frame point and change the frame of that
A FrameVector is a 3D vector with a ReferenceFrame, and all operations between FrameVectors and other...
ReferenceFrame object used to tell what frame objects are expressed in. Every ReferenceFrame has a po...
SpatialTransform Xrotx(const double &xrot)
Get transform with zero translation and pure rotation about x axis.
EIGEN_STRONG_INLINE double & y()
void set(const Eigen::Vector3d &v)
double distance(const FramePoint &point) const
Calculate the distance between two FramePoints. .
EIGEN_STRONG_INLINE double & z()
Namespace for all structures of the RobotDynamics library.