Wheel.h
Go to the documentation of this file.
1 /*+-------------------------------------------------------------------------+
2  | MultiVehicle simulator (libmvsim) |
3  | |
4  | Copyright (C) 2014-2023 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 
31 class Wheel : public VisualObject
32 {
33  public:
34  Wheel(World* world);
35 
38  double x = 0, y = -0.5, yaw = 0;
39 
41  mrpt::math::TPose3D pose() const { return {x, y, 0, yaw, 0, 0}; }
42 
44  double diameter = .4, width = .2;
45  double mass = 2.0;
46 
49  double Iyy = 1.0;
50 
52  mrpt::img::TColor color{0xff323232};
53 
59  double linked_yaw_offset = .0;
60 
62  {"mass", {"%lf", &mass}},
63  {"width", {"%lf", &width}},
64  {"diameter", {"%lf", &diameter}},
65  {"color", {"%color", &color}},
66  {"inertia", {"%lf", &Iyy}},
67  {"linked_yaw", {"%s", &linked_yaw_object_name}},
68  {"linked_yaw_offset_deg", {"%lf_deg", &linked_yaw_offset}}};
69 
72  std::string asString() const;
73 
74  // methods ----
75 
76  void getAs3DObject(mrpt::opengl::CSetOfObjects& obj);
77  void loadFromXML(const rapidxml::xml_node<char>* xml_node);
78 
79  void internalGuiUpdate(
80  const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& viz,
81  const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& physical,
82  bool childrenOnly) override;
83 
84  double getPhi() const
85  {
86  return phi;
87  }
88  void setPhi(double val)
89  {
90  phi = val;
91  }
92  double getW() const { return w; }
93  void setW(double val) { w = val; }
94  void recalcInertia();
95  protected:
98  double phi = 0, w = 0;
99 };
100 } // namespace mvsim
void setW(double val)
Spinning velocity (rad/s) wrt shaft.
Definition: Wheel.h:93
double width
Definition: Wheel.h:44
std::map< std::string, TParamEntry > TParameterDefinitions
void recalcInertia()
Recompute Iyy from mass, diameter and height.
Definition: Wheel.cpp:92
double w
Definition: Wheel.h:98
void loadFromXML(const rapidxml::xml_node< char > *xml_node)
Definition: Wheel.cpp:61
mrpt::img::TColor color
Definition: Wheel.h:52
void getAs3DObject(mrpt::opengl::CSetOfObjects &obj)
Definition: Wheel.cpp:27
mrpt::math::TPose3D pose() const
Definition: Wheel.h:41
double phi
Definition: Wheel.h:98
double getW() const
Spinning velocity (rad/s) wrt shaft.
Definition: Wheel.h:92
double x
Definition: Wheel.h:38
void setPhi(double val)
Orientation (rad) wrt vehicle local frame.
Definition: Wheel.h:88
double y
Definition: Wheel.h:38
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
double diameter
Definition: Wheel.h:44
double yaw
Definition: Wheel.h:38
double getPhi() const
Orientation (rad) wrt vehicle local frame.
Definition: Wheel.h:84
std::string asString() const
Definition: Wheel.cpp:107
double Iyy
Definition: Wheel.h:49
double mass
[kg]
Definition: Wheel.h:45
double linked_yaw_offset
Definition: Wheel.h:59
std::string linked_yaw_object_name
Definition: Wheel.h:58
Wheel(World *world)
Definition: Wheel.cpp:25
const TParameterDefinitions params_
Definition: Wheel.h:61


mvsim
Author(s):
autogenerated on Tue Jul 4 2023 03:08:21