10 #include <mrpt/opengl/COpenGLScene.h>
18 using namespace mvsim;
23 World* parent,
const std::vector<ConfigPerWheel>& cfgPerWheel)
24 :
VehicleBase(parent, cfgPerWheel.size() ), configPerWheel_(cfgPerWheel)
50 const std::map<std::string, std::string> varValues = {{
"NAME",
name_}};
64 *xml_chassis, attribs, varValues,
65 "[DynamicsDifferential::dynamics_load_params_from_xml]");
71 *xml_shape,
chassis_poly_,
"[DynamicsDifferential::dynamics_load_params_from_xml]");
101 if (!control_class || !control_class->value())
103 "[DynamicsDifferential] Missing 'class' attribute in "
104 "<controller> XML node");
106 const std::string sCtrlClass = std::string(control_class->value());
107 if (sCtrlClass == ControllerRawForces::class_name())
108 controller_ = std::make_shared<ControllerRawForces>(*
this);
110 controller_ = std::make_shared<ControllerTwistPID>(*
this);
112 controller_ = std::make_shared<ControllerTwistIdeal>(*
this);
115 "[DynamicsDifferential] Unknown 'class'='%s' in "
116 "<controller> XML node",
131 std::vector<double> otpw;
161 THROW_EXCEPTION(
"Unexpected number of wheels!");
175 mrpt::math::TTwist2D odo_vel;
189 "The two wheels of a differential vehicle cannot be at the same Y "
192 const double w_veh = (w1 * R1 - w0 * R0) / Ay;
197 odo_vel.omega = w_veh;