18 using namespace mvsim;
25 if (node && 0 != strcmp(node->
name(),
"friction"))
26 throw std::runtime_error(
27 "<friction>...</friction> XML node was expected!!");
46 const double mu =
m_mu;
49 const double max_friction = mu * partial_mass * gravity;
53 double wheel_lat_friction = 0.0;
56 wheel_lat_friction = -vel_w.
y * partial_mass / input.
context.
dt;
59 b2Clamp(wheel_lat_friction, -max_friction, max_friction);
64 double wheel_long_friction = 0.0;
72 const double lon_constraint_desired_wheel_w = vel_w.
x / R;
73 const double desired_wheel_w_impulse =
74 (lon_constraint_desired_wheel_w - input.
wheel.
getW());
75 const double desired_wheel_alpha =
76 desired_wheel_w_impulse / input.
context.
dt;
86 double F_friction_lon = (input.
motor_torque - I_yy * desired_wheel_alpha -
91 F_friction_lon =
b2Clamp(F_friction_lon, -max_friction, max_friction);
94 const double actual_wheel_alpha = (input.
motor_torque - R * F_friction_lon -
102 wheel_long_friction = F_friction_lon;
107 wheel_long_friction, wheel_lat_friction);
110 wRot.
composePoint(result_force_wrt_wheel, out_result_force_local);
This file contains rapidxml parser and DOM implementation.
void setW(double val)
Spinning velocity (rad/s) wrt shaft.
const TParameterDefinitions m_params
DefaultFriction(VehicleBase &my_vehicle, const rapidxml::xml_node< char > *node)
void parse_xmlnode_children_as_param(const rapidxml::xml_node< char > &xml_node, const TParameterDefinitions ¶ms, const std::map< std::string, std::string > &variableNamesValues={}, const char *functionNameContext="")
GLenum GLenum GLenum input
void composePoint(double lx, double ly, double &gx, double &gy) const
double m_mu
friction coeficient (non-dimensional)
double get_gravity() const
double getW() const
Spinning velocity (rad/s) wrt shaft.
T b2Clamp(T a, T low, T high)
VehicleBase & m_my_vehicle
virtual void evaluate_friction(const FrictionBase::TFrictionInput &input, mrpt::math::TPoint2D &out_result_force_local) const override
double m_C_damping
For wheels "internal friction" (N*m*s/rad)