10 #include <mrpt/img/TColor.h> 11 #include <mrpt/opengl/CCylinder.h> 12 #include <mrpt/opengl/CSetOfObjects.h> 13 #include <mrpt/opengl/stock_objects.h> 14 #include <mrpt/version.h> 22 using namespace mvsim;
37 auto gl_wheel = mrpt::opengl::CCylinder::Create(
39 gl_wheel->setColor_u8(
color);
41 mrpt::poses::CPose3D(0, 0.5 *
width, 0, 0, 0, mrpt::DEG2RAD(90)));
43 auto gl_wheel_frame = mrpt::opengl::CSetOfObjects::Create();
44 gl_wheel_frame->setName(
"gl_wheel_frame");
45 gl_wheel_frame->insert(gl_wheel);
47 mrpt::opengl::CSetOfObjects::Ptr gl_xyz =
48 mrpt::opengl::stock_objects::CornerXYZSimple(
50 #if MRPT_VERSION >= 0x270 51 gl_xyz->castShadows(
false);
53 gl_wheel_frame->insert(gl_xyz);
55 obj.insert(gl_wheel_frame);
58 obj.setPose(mrpt::math::TPose3D(
x,
y, 0.5 *
diameter,
yaw, 0.0, 0.0));
69 attr && attr->
value())
71 const std::string sAttr = attr->value();
72 mrpt::math::TPose2D v =
parseXYPHI(sAttr,
true);
79 const double INERTIA_NOT_SET = -1.;
80 this->
Iyy = INERTIA_NOT_SET;
99 [[maybe_unused]]
const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& viz,
100 [[maybe_unused]]
const mrpt::optional_ref<mrpt::opengl::COpenGLScene>&
102 [[maybe_unused]]
bool childrenOnly)
109 std::stringstream ss;
110 ss <<
"Pose on vehicle: " <<
pose().asString() <<
"\n" 112 <<
"Width: " <<
width <<
"\n" 113 <<
"Mass: " <<
mass <<
"\n" 114 <<
"Iyy: " <<
Iyy <<
"\n" 115 <<
"Kinematic status: phi:" << mrpt::RAD2DEG(
phi)
118 << mrpt::RAD2DEG(
w) <<
" deg/s\n";
This file contains rapidxml parser and DOM implementation.
void recalcInertia()
Recompute Iyy from mass, diameter and height.
void loadFromXML(const rapidxml::xml_node< char > *xml_node)
void getAs3DObject(mrpt::opengl::CSetOfObjects &obj)
void parse_xmlnode_attribs(const rapidxml::xml_node< char > &xml_node, const TParameterDefinitions ¶ms, const std::map< std::string, std::string > &variableNamesValues={}, const char *functionNameContext="")
mrpt::math::TPose3D pose() const
std::shared_ptr< mrpt::opengl::CSetOfObjects > glCustomVisual_
void internalGuiUpdate(const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &viz, const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &physical, bool childrenOnly) override
std::string asString() const
bool parseVisual(const rapidxml::xml_node< char > &rootNode)
Returns true if there is at least one <visual>...</visual> entry.
const TParameterDefinitions params_
xml_attribute< Ch > * first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
mrpt::math::TPose2D parseXYPHI(const std::string &s, bool allow_missing_angle=false, double default_angle_radians=0.0, const std::map< std::string, std::string > &variableNamesValues={})