本文整理汇总了C++中mrpt::DEG2RAD方法的典型用法代码示例。如果您正苦于以下问题:C++ mrpt::DEG2RAD方法的具体用法?C++ mrpt::DEG2RAD怎么用?C++ mrpt::DEG2RAD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mrpt
的用法示例。
在下文中一共展示了mrpt::DEG2RAD方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
try
{
printf ("Starting publisher...\n");
void *context = zmq_ctx_new ();
void *pub_sock = zmq_socket (context, ZMQ_PUB);
int rc = zmq_bind (pub_sock, "tcp://*:5555");
assert (rc == 0);
while (1)
{
mrpt::poses::CPose3D my_pose(0.5f,0.5f,1.5f ,DEG2RAD(-90.0f),DEG2RAD(0),DEG2RAD(-90.0f) );
printf("Publishing pose...\n");
mrpt::comms::mrpt_send_to_zmq(pub_sock, my_pose);
std::this_thread::sleep_for(100ms);
mrpt::img::CImage my_img(800,600, CH_RGB);
printf("Publishing img...\n");
mrpt::comms::mrpt_send_to_zmq(pub_sock, my_img, 0 /* max_packet_len: 0=no max size */);
std::this_thread::sleep_for(100ms);
}
zmq_close (pub_sock);
zmq_ctx_destroy (context);
return 0;
} catch (std::exception &e)
{
std::cerr << "**Exception**: " << e.what() << std::endl;
return -1;
}
}
示例2: TEST
TEST(CPose3DInterpolator, interp)
{
using namespace mrpt::poses;
using mrpt::math::TPose3D;
using mrpt::math::CMatrixDouble44;
using mrpt::DEG2RAD;
const mrpt::system::TTimeStamp t0 = mrpt::system::now();
const mrpt::system::TTimeStamp dt = mrpt::system::secondsToTimestamp(0.10);
CPose3DInterpolator pose_path;
pose_path.insert(
t0, TPose3D(1., 2., 3., DEG2RAD(30.0), DEG2RAD(.0), DEG2RAD(.0)));
pose_path.insert(
t0 + 2 * dt, TPose3D(
1. + 3., 2. + 4., 3. + 5., DEG2RAD(30.0 + 20.0),
DEG2RAD(.0), DEG2RAD(.0)));
TPose3D interp;
bool valid;
pose_path.interpolate(t0 + dt, interp, valid);
EXPECT_TRUE(valid);
const TPose3D interp_good(
1. + 1.5, 2. + 2.0, 3. + 2.5, DEG2RAD(30.0 + 10.0), DEG2RAD(.0),
DEG2RAD(.0));
EXPECT_NEAR(
.0, (CPose3D(interp_good).getHomogeneousMatrixVal<CMatrixDouble44>() -
CPose3D(interp).getHomogeneousMatrixVal<CMatrixDouble44>())
.array()
.abs()
.sum(),
1e-4);
}
示例3:
void TPose3D::fromString(const std::string& s)
{
CMatrixDouble m;
if (!m.fromMatlabStringFormat(s))
THROW_EXCEPTION("Malformed expression in ::fromString");
ASSERTMSG_(
m.rows() == 1 && m.cols() == 6, "Wrong size of vector in ::fromString");
x = m.get_unsafe(0, 0);
y = m.get_unsafe(0, 1);
z = m.get_unsafe(0, 2);
yaw = DEG2RAD(m.get_unsafe(0, 3));
pitch = DEG2RAD(m.get_unsafe(0, 4));
roll = DEG2RAD(m.get_unsafe(0, 5));
}
示例4: TEST
TEST(CPose3DInterpolator, interp)
{
using namespace mrpt::poses;
using mrpt::DEG2RAD;
using mrpt::math::CMatrixDouble44;
using mrpt::math::TPose3D;
auto t0 = mrpt::Clock::now();
mrpt::Clock::duration dt(std::chrono::milliseconds(100));
CPose3DInterpolator pose_path;
pose_path.insert(
t0, TPose3D(1., 2., 3., DEG2RAD(30.0), DEG2RAD(.0), DEG2RAD(.0)));
pose_path.insert(
t0 + 2 * dt, TPose3D(
1. + 3., 2. + 4., 3. + 5., DEG2RAD(30.0 + 20.0),
DEG2RAD(.0), DEG2RAD(.0)));
TPose3D interp;
bool valid;
pose_path.interpolate(t0 + dt, interp, valid);
EXPECT_TRUE(valid);
const TPose3D interp_good(
1. + 1.5, 2. + 2.0, 3. + 2.5, DEG2RAD(30.0 + 10.0), DEG2RAD(.0),
DEG2RAD(.0));
EXPECT_NEAR(
.0,
(CPose3D(interp_good).getHomogeneousMatrixVal<CMatrixDouble44>() -
CPose3D(interp).getHomogeneousMatrixVal<CMatrixDouble44>())
.array()
.abs()
.sum(),
2e-4);
}