本文整理汇总了C++中Orientation::pack方法的典型用法代码示例。如果您正苦于以下问题:C++ Orientation::pack方法的具体用法?C++ Orientation::pack怎么用?C++ Orientation::pack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orientation
的用法示例。
在下文中一共展示了Orientation::pack方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Declination
TEST (Orientation, MakeTrue) {
VLOG(1) << "===Orientation Declination (Make True) Test===";
// location and orientation values
double expectedDeclination = 15.95;
Orientation x { 20.0, -15.0, 10.0 };
Location y { 47.82167, -122.33639 };
Orientation z { 0.0, 0.0, 240.0 };
VLOG(2) << "Orientation x " << x.pack();
VLOG(2) << "Location y " << y.pack();
VLOG(2) << "Orientation z " << z.pack();
VLOG(2) << "Expected Declination " << expectedDeclination;
EXPECT_TRUE(x.isMagnetic());
EXPECT_TRUE(x.updateDeclination(y));
VLOG(2) << "Declination is " << x.getDeclination() << ", " << z.getDeclination();
EXPECT_TRUE(toleranceEquals(x.getDeclination(), z.getDeclination(), TOL));
Orientation th1 = x.makeTrue();
EXPECT_FALSE(th1.isMagnetic());
EXPECT_TRUE(toleranceEquals(th1.heading, x.heading + expectedDeclination, 0.25));
Orientation th2 = th1.makeTrue();
EXPECT_FALSE(th2.isMagnetic());
EXPECT_TRUE(toleranceEquals(th1.heading, th2.heading, TOL));
VLOG(2) << "Orientation th1 " << th1.pack();
VLOG(2) << "Orientation th2 " << th2.pack();
}
示例2:
TEST (Orientation, JSON) {
VLOG(1) << "===Orientation JSON Test===";
Orientation u { 20.0, -15.0, 60.0 };
Orientation v;
Value orient;
orient = u.pack();
VLOG_IF(orient.IsObject(), 2) << "Output JSON: " << orient;
v.parse(orient);
VLOG_IF(v.pack().IsObject(), 2) << "Parsed JSON: " << orient;
EXPECT_TRUE(toleranceEquals(u.pitch, v.pitch, TOL));
EXPECT_TRUE(toleranceEquals(u.roll, v.roll, TOL));
EXPECT_TRUE(toleranceEquals(u.heading, v.heading, TOL));
}