Wheel.h
Go to the documentation of this file.
1 /*+-------------------------------------------------------------------------+
2  | MultiVehicle simulator (libmvsim) |
3  | |
4  | Copyright (C) 2014-2024 Jose Luis Blanco Claraco |
5  | Copyright (C) 2017 Borys Tymchenko (Odessa Polytechnic University) |
6  | Distributed under 3-clause BSD License |
7  | See COPYING |
8  +-------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #include <mrpt/img/TColor.h>
13 #include <mrpt/math/TPoint2D.h>
14 #include <mrpt/math/TPolygon2D.h>
15 #include <mrpt/math/TPose3D.h>
16 #include <mrpt/poses/CPose2D.h>
18 #include <mvsim/VisualObject.h>
19 #include <mvsim/basic_types.h>
20 
21 namespace mvsim
22 {
23 class DefaultFriction;
24 class VehicleBase;
25 class DynamicsDifferential;
26 class World;
27 
33 class Wheel : public VisualObject
34 {
35  public:
36  Wheel(World* world);
37 
40  double x = 0, y = -0.5, yaw = 0;
41 
43  mrpt::math::TPose3D pose() const { return {x, y, 0, yaw, 0, 0}; }
44 
46  double diameter = .4, width = .2;
47  double mass = 2.0;
48 
51  double Iyy = 1.0;
52 
54  mrpt::img::TColor color{0xff323232};
55 
61  double linked_yaw_offset = .0;
62 
64  {"mass", {"%lf", &mass}},
65  {"width", {"%lf", &width}},
66  {"diameter", {"%lf", &diameter}},
67  {"color", {"%color", &color}},
68  {"inertia", {"%lf", &Iyy}},
69  {"linked_yaw", {"%s", &linked_yaw_object_name}},
70  {"linked_yaw_offset_deg", {"%lf_deg", &linked_yaw_offset}}};
71 
74  std::string asString() const;
75 
76  // methods ----
77 
78  void getAs3DObject(mrpt::opengl::CSetOfObjects& obj, bool isPhysicalScene);
79  void loadFromXML(const rapidxml::xml_node<char>* xml_node);
80 
81  void internalGuiUpdate(
82  const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& viz,
83  const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& physical, bool childrenOnly) override;
84 
85  double getPhi() const { return phi; }
86  void setPhi(double val) { phi = val; }
87  double getW() const { return w; }
88  void setW(double val) { w = val; }
89  void recalcInertia();
90  protected:
93  double phi = 0, w = 0;
94 };
95 } // namespace mvsim
mvsim
Definition: Client.h:21
mvsim::Wheel::yaw
double yaw
Definition: Wheel.h:40
basic_types.h
mvsim::Wheel::linked_yaw_object_name
std::string linked_yaw_object_name
Definition: Wheel.h:60
mvsim::Wheel::w
double w
Definition: Wheel.h:93
TParameterDefinitions.h
mvsim::Wheel::internalGuiUpdate
void internalGuiUpdate(const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &viz, const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &physical, bool childrenOnly) override
Definition: Wheel.cpp:98
mvsim::Wheel::x
double x
Definition: Wheel.h:40
mvsim::Wheel::params_
const TParameterDefinitions params_
Definition: Wheel.h:63
mvsim::Wheel::recalcInertia
void recalcInertia()
Recompute Iyy from mass, diameter and height.
Definition: Wheel.cpp:92
mvsim::Wheel::diameter
double diameter
Definition: Wheel.h:46
mvsim::Wheel::Iyy
double Iyy
Definition: Wheel.h:51
mvsim::Wheel::color
mrpt::img::TColor color
Definition: Wheel.h:54
mvsim::Wheel::getAs3DObject
void getAs3DObject(mrpt::opengl::CSetOfObjects &obj, bool isPhysicalScene)
Definition: Wheel.cpp:27
mvsim::Wheel
Definition: Wheel.h:33
mvsim::Wheel::Wheel
Wheel(World *world)
Definition: Wheel.cpp:25
mvsim::TParameterDefinitions
std::map< std::string, TParamEntry > TParameterDefinitions
Definition: TParameterDefinitions.h:64
mvsim::Wheel::width
double width
Definition: Wheel.h:46
mvsim::Wheel::loadFromXML
void loadFromXML(const rapidxml::xml_node< char > *xml_node)
Definition: Wheel.cpp:62
mvsim::Wheel::linked_yaw_offset
double linked_yaw_offset
Definition: Wheel.h:61
mvsim::World
Definition: World.h:82
rapidxml::xml_node< char >
mvsim::Wheel::pose
mrpt::math::TPose3D pose() const
Definition: Wheel.h:43
mvsim::Wheel::mass
double mass
[kg]
Definition: Wheel.h:47
mvsim::Wheel::y
double y
Definition: Wheel.h:40
mvsim::Wheel::phi
double phi
Definition: Wheel.h:93
VisualObject.h
mvsim::Wheel::asString
std::string asString() const
Definition: Wheel.cpp:106
mvsim::VisualObject
Definition: VisualObject.h:35


mvsim
Author(s):
autogenerated on Wed May 28 2025 02:13:08