SensorValueHolonomicPlatform.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package RobotAPI
17  * @author Raphael ( raphael dot grimm at kit dot edu )
18  * @date 2017
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 #pragma once
23 
25 
26 #include "SensorValueBase.h"
27 
28 namespace armarx
29 {
31  {
32  public:
34  float velocityY;
36 
39  {
44  "velocityRotation");
45  return svi;
46  }
47  };
48 
50  {
51  public:
55 
56  void
57  deriveAccelerationFromVelocityDelta(float dvx, float dvy, float dvrot, float dt)
58  {
59  accelerationX = dvx / dt;
60  accelerationY = dvy / dt;
61  accelerationRotation = dvrot / dt;
62  }
63 
64  static SensorValueInfo<SensorValueHolonomicPlatformAcceleration>
66  {
69  "accelerationX");
71  "accelerationY");
73  "accelerationRotation");
74  return svi;
75  }
76  };
77 
78  /**
79  * @brief The robot's position relative to its initial pose when starting the robot unit based on odometry information.
80  *
81  * Note: The relative position undergoes a significant drift over time.
82  */
84  {
85  public:
87 
88  float relativePositionX = 0;
89  float relativePositionY = 0;
91 
94  {
97  "relativePositionX");
99  "relativePositionY");
100  svi.addMemberVariable(
102  "relativePositionRotation");
103  return svi;
104  }
105  };
106 
107  // The following class is deprecated: if the absolute position is provided, it will become inconsistent with the relative position.
108  // Therefore, SensorValueHolonomicPlatformRelativePosition + SensorValueHolonomicPlatformGlobalPositionCorrection should be used instead.
109 
110  // class SensorValueHolonomicPlatformAbsolutePosition : virtual public SensorValueBase
111  // {
112  // public:
113  // DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION
114  // float absolutePositionX;
115  // float absolutePositionY;
116  // float absolutePositionRotation;
117  // static SensorValueInfo<SensorValueHolonomicPlatformAbsolutePosition> GetClassMemberInfo()
118  // {
119  // SensorValueInfo<SensorValueHolonomicPlatformAbsolutePosition> svi;
120  // svi.addMemberVariable(&SensorValueHolonomicPlatformAbsolutePosition::absolutePositionX, "absolutePositionX");
121  // svi.addMemberVariable(&SensorValueHolonomicPlatformAbsolutePosition::absolutePositionY, "absolutePositionY");
122  // svi.addMemberVariable(&SensorValueHolonomicPlatformAbsolutePosition::absolutePositionRotation, "absolutePositionRotation");
123  // return svi;
124  // }
125  // };
126 
127 
132  {
133  public:
135 
136  void
137  setVelocitiesAndDeriveAcceleration(float vx, float vy, float vrot, float dt)
138  {
140  vx - velocityX, vy - velocityY, vrot - velocityRotation, dt);
141  velocityX = vx;
142  velocityY = vy;
143  velocityRotation = vrot;
144  }
145 
146  static SensorValueInfo<SensorValueHolonomicPlatform>
148  {
153  return svi;
154  }
155  };
156 
157  // The following class is deprecated: if the absolute position is provided, it will become inconsistent with the relative position.
158  // Therefore, SensorValueHolonomicPlatformRelativePosition + SensorValueHolonomicPlatformGlobalPositionCorrection should be used instead.
159 
160  // class SensorValueHolonomicPlatformWithAbsolutePosition : virtual public SensorValueHolonomicPlatform, virtual public SensorValueHolonomicPlatformAbsolutePosition
161  // {
162  // public:
163  // DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION
164  // static SensorValueInfo<SensorValueHolonomicPlatformWithAbsolutePosition> GetClassMemberInfo()
165  // {
166  // SensorValueInfo<SensorValueHolonomicPlatformWithAbsolutePosition> svi;
167  // svi.addBaseClass<SensorValueHolonomicPlatform>();
168  // svi.addBaseClass<SensorValueHolonomicPlatformAbsolutePosition>();
169  // return svi;
170  // }
171  // };
172 } // namespace armarx
algorithm.h
armarx::SensorValueHolonomicPlatformVelocity::velocityX
DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION float velocityX
Definition: SensorValueHolonomicPlatform.h:33
armarx::SensorValueHolonomicPlatform
Definition: SensorValueHolonomicPlatform.h:128
armarx::SensorValueHolonomicPlatformRelativePosition
The robot's position relative to its initial pose when starting the robot unit based on odometry info...
Definition: SensorValueHolonomicPlatform.h:83
armarx::SensorValueBase
The SensorValueBase class.
Definition: SensorValueBase.h:40
armarx::SensorValueHolonomicPlatform::setVelocitiesAndDeriveAcceleration
DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION void setVelocitiesAndDeriveAcceleration(float vx, float vy, float vrot, float dt)
Definition: SensorValueHolonomicPlatform.h:137
armarx::SensorValueHolonomicPlatformAcceleration::deriveAccelerationFromVelocityDelta
void deriveAccelerationFromVelocityDelta(float dvx, float dvy, float dvrot, float dt)
Definition: SensorValueHolonomicPlatform.h:57
armarx::introspection::ClassMemberInfo::addBaseClass
void addBaseClass()
add all variables of a base class of the current class
Definition: ClassMemberInfo.h:125
armarx::introspection::ClassMemberInfo
Definition: ClassMemberInfo.h:34
armarx::SensorValueHolonomicPlatformRelativePosition::relativePositionRotation
float relativePositionRotation
Definition: SensorValueHolonomicPlatform.h:90
armarx::SensorValueHolonomicPlatformVelocity::velocityRotation
float velocityRotation
Definition: SensorValueHolonomicPlatform.h:35
SensorValueBase.h
armarx::SensorValueHolonomicPlatformVelocity::velocityY
float velocityY
Definition: SensorValueHolonomicPlatform.h:34
armarx::SensorValueHolonomicPlatformAcceleration::GetClassMemberInfo
static SensorValueInfo< SensorValueHolonomicPlatformAcceleration > GetClassMemberInfo()
Definition: SensorValueHolonomicPlatform.h:65
armarx::introspection::ClassMemberInfo::addMemberVariable
EntryConfigurator< ClassType > addMemberVariable(MemberType ClassType::*ptr, const std::string &name)
add a member variable of the current class
armarx::SensorValueHolonomicPlatformVelocity::GetClassMemberInfo
static SensorValueInfo< SensorValueHolonomicPlatformVelocity > GetClassMemberInfo()
Definition: SensorValueHolonomicPlatform.h:38
armarx::SensorValueHolonomicPlatform::GetClassMemberInfo
static SensorValueInfo< SensorValueHolonomicPlatform > GetClassMemberInfo()
Definition: SensorValueHolonomicPlatform.h:147
armarx::SensorValueHolonomicPlatformVelocity
Definition: SensorValueHolonomicPlatform.h:30
DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION
#define DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION
Definition: SensorValueBase.h:139
armarx::SensorValueHolonomicPlatformAcceleration::accelerationX
DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION float accelerationX
Definition: SensorValueHolonomicPlatform.h:52
armarx::SensorValueHolonomicPlatformAcceleration::accelerationRotation
float accelerationRotation
Definition: SensorValueHolonomicPlatform.h:54
armarx::SensorValueHolonomicPlatformRelativePosition::relativePositionY
float relativePositionY
Definition: SensorValueHolonomicPlatform.h:89
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::SensorValueHolonomicPlatformAcceleration::accelerationY
float accelerationY
Definition: SensorValueHolonomicPlatform.h:53
dt
constexpr T dt
Definition: UnscentedKalmanFilterTest.cpp:42
armarx::SensorValueHolonomicPlatformRelativePosition::GetClassMemberInfo
static SensorValueInfo< SensorValueHolonomicPlatformRelativePosition > GetClassMemberInfo()
Definition: SensorValueHolonomicPlatform.h:93
armarx::SensorValueHolonomicPlatformRelativePosition::relativePositionX
DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION float relativePositionX
Definition: SensorValueHolonomicPlatform.h:88
armarx::SensorValueHolonomicPlatformAcceleration
Definition: SensorValueHolonomicPlatform.h:49