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
28namespace 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
149} // namespace armarx
#define make_SensorValue1DoFActuator(type, name, varname)
#define DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION
static SensorValueInfo< SensorValue1DoFActuatorStatus > GetClassMemberInfo()
DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION armarx::JointStatus status
static DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION SensorValueInfo< SensorValue1DoFActuator > GetClassMemberInfo()
DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION float inverseDynamicsTorque
static SensorValueInfo< SensorValue1DoFInverseDynamicsTorque > GetClassMemberInfo()
static DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION SensorValueInfo< SensorValue1DoFRealActuatorWithStatus > GetClassMemberInfo()
static DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION SensorValueInfo< SensorValue1DoFRealActuator > GetClassMemberInfo()
The SensorValueBase class.
introspection::ClassMemberInfo< SensorValueBase, DerivedClass > SensorValueInfo
This file offers overloads of toIce() and fromIce() functions for STL container types.
void addBaseClass()
add all variables of a base class of the current class
EntryConfigurator< ClassType > addMemberVariable(MemberType ClassType::*ptr, const std::string &name)
add a member variable of the current class