SensorValue1DoFActuator.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 
24 #include <RobotAPI/interface/units/KinematicUnitInterface.h>
25 
26 #include "SensorValueBase.h"
27 
28 namespace armarx
29 {
30 
31 #define make_SensorValue1DoFActuator(type, name, varname) \
32  class name : virtual public SensorValueBase \
33  { \
34  public: \
35  DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION type varname = 0.0f; \
36  static SensorValueInfo<name> \
37  GetClassMemberInfo() \
38  { \
39  SensorValueInfo<name> svi; \
40  svi.addMemberVariable(&name::varname, #varname); \
41  return svi; \
42  } \
43  }
44 
45  make_SensorValue1DoFActuator(float, SensorValue1DoFActuatorPosition, position);
46  make_SensorValue1DoFActuator(float, SensorValue1DoFActuatorVelocity, velocity);
47  make_SensorValue1DoFActuator(float, SensorValue1DoFActuatorFilteredVelocity, filteredvelocity);
48  make_SensorValue1DoFActuator(float, SensorValue1DoFActuatorAcceleration, acceleration);
49  make_SensorValue1DoFActuator(float, SensorValue1DoFActuatorTorque, torque);
50  make_SensorValue1DoFActuator(float, SensorValue1DoFGravityTorque, gravityTorque);
51  make_SensorValue1DoFActuator(float, SensorValue1DoFActuatorCurrent, motorCurrent);
52  make_SensorValue1DoFActuator(float, SensorValue1DoFActuatorMotorTemperature, motorTemperature);
53  make_SensorValue1DoFActuator(std::int16_t, SensorValue1DoFMotorPWM, motorPWM);
54 
55 #undef make_SensorValue1DoFActuator
56 
57  class SensorValue1DoFInverseDynamicsTorque : virtual public SensorValue1DoFGravityTorque
58  {
59  public:
61  float inertiaTorque = 0.0f;
62 
63  static SensorValueInfo<SensorValue1DoFInverseDynamicsTorque>
65  {
66  SensorValueInfo<SensorValue1DoFInverseDynamicsTorque> svi;
67  svi.addBaseClass<SensorValue1DoFGravityTorque>();
69  "inverseDynamicsTorque");
71  "inertiaTorque");
72  return svi;
73  }
74  };
75 
77  virtual public SensorValue1DoFActuatorPosition,
78  virtual public SensorValue1DoFActuatorVelocity,
79  virtual public SensorValue1DoFActuatorAcceleration,
80  virtual public SensorValue1DoFActuatorTorque,
82  {
83  public:
87  {
88  SensorValueInfo<SensorValue1DoFActuator> svi;
89  svi.addBaseClass<SensorValue1DoFActuatorPosition>();
90  svi.addBaseClass<SensorValue1DoFActuatorVelocity>();
91  svi.addBaseClass<SensorValue1DoFActuatorAcceleration>();
92  svi.addBaseClass<SensorValue1DoFActuatorTorque>();
93  svi.addBaseClass<SensorValue1DoFInverseDynamicsTorque>();
94  return svi;
95  }
96  };
97 
99  {
100  public:
102 
105  {
108  .setFieldNames({"JointStatusError",
109  "JointStatusOperation",
110  "JointStatusEnabled",
111  "JointStatusEmergencyStop"});
112  return svi;
113  }
114  };
115 
117  virtual public SensorValue1DoFActuator,
118  virtual public SensorValue1DoFActuatorCurrent,
119  virtual public SensorValue1DoFActuatorMotorTemperature
120  {
121  public:
125  {
126  SensorValueInfo<SensorValue1DoFRealActuator> svi;
127  svi.addBaseClass<SensorValue1DoFActuator>();
128  svi.addBaseClass<SensorValue1DoFActuatorCurrent>();
129  svi.addBaseClass<SensorValue1DoFActuatorMotorTemperature>();
130  return svi;
131  }
132  };
133 
135  virtual public SensorValue1DoFRealActuator,
136  virtual public SensorValue1DoFActuatorStatus
137  {
138  public:
142  {
146  return svi;
147  }
148  };
149 } // namespace armarx
armarx::SensorValue1DoFInverseDynamicsTorque::inertiaTorque
float inertiaTorque
Definition: SensorValue1DoFActuator.h:61
armarx::SensorValueBase
The SensorValueBase class.
Definition: SensorValueBase.h:40
armarx::SensorValue1DoFInverseDynamicsTorque::GetClassMemberInfo
static SensorValueInfo< SensorValue1DoFInverseDynamicsTorque > GetClassMemberInfo()
Definition: SensorValue1DoFActuator.h:64
armarx::SensorValue1DoFActuatorStatus::status
DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION armarx::JointStatus status
Definition: SensorValue1DoFActuator.h:101
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::SensorValue1DoFRealActuatorWithStatus
Definition: SensorValue1DoFActuator.h:134
SensorValueBase.h
armarx::SensorValue1DoFRealActuator::GetClassMemberInfo
static DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION SensorValueInfo< SensorValue1DoFRealActuator > GetClassMemberInfo()
Definition: SensorValue1DoFActuator.h:124
armarx::SensorValue1DoFActuatorStatus::GetClassMemberInfo
static SensorValueInfo< SensorValue1DoFActuatorStatus > GetClassMemberInfo()
Definition: SensorValue1DoFActuator.h:104
armarx::SensorValue1DoFRealActuator
Definition: SensorValue1DoFActuator.h:116
armarx::introspection::ClassMemberInfo::addMemberVariable
EntryConfigurator< ClassType > addMemberVariable(MemberType ClassType::*ptr, const std::string &name)
add a member variable of the current class
DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION
#define DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION
Definition: SensorValueBase.h:139
armarx::SensorValue1DoFInverseDynamicsTorque
Definition: SensorValue1DoFActuator.h:57
armarx::SensorValue1DoFActuatorStatus
Definition: SensorValue1DoFActuator.h:98
armarx::make_SensorValue1DoFActuator
make_SensorValue1DoFActuator(float, SensorValue1DoFActuatorPosition, position)
armarx::SensorValue1DoFActuator
Definition: SensorValue1DoFActuator.h:76
armarx::SensorValue1DoFActuator::GetClassMemberInfo
static DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION SensorValueInfo< SensorValue1DoFActuator > GetClassMemberInfo()
Definition: SensorValue1DoFActuator.h:86
armarx::SensorValue1DoFInverseDynamicsTorque::inverseDynamicsTorque
DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION float inverseDynamicsTorque
Definition: SensorValue1DoFActuator.h:60
armarx::SensorValue1DoFRealActuatorWithStatus::GetClassMemberInfo
static DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION SensorValueInfo< SensorValue1DoFRealActuatorWithStatus > GetClassMemberInfo()
Definition: SensorValue1DoFActuator.h:141
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28