vor.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package
19  * @author
20  * @date
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #pragma once
25 
26 #include "reflex.h"
27 #include "ReflexCombination.h"
28 
30 #include <Eigen/Core>
31 #include <Eigen/Geometry>
32 
33 namespace armarx
34 {
35  class ReflexCombination;
36  class VOR : virtual public Reflex
37  {
38  public:
40  {
41  onStop();
42  }
43  ~VOR() override {}
44  void reportSensorValues(const IMUData& values);
45  void setJointNames(std::string eye_pitch_left, std::string eye_pitch_right, std::string eye_yaw_left, std::string eye_yaw_right, std::string neck_roll);
46  void setPIDValues(float kp, float ki, float kd);
47  void setBools(bool armar4, bool velocityBased);
48 
49  std::string getName() const override
50  {
51  return "VOR";
52  }
53 
54  // Reflex interface
55  private:
56 
57  void calc() override;
58 
59  void onStop() override;
60 
61  private:
62  std::mutex dataMutex;
63 
64  bool reportedSensorValues, reportedJointAnglesBool, reportedJointVelocitiesBool, initialOrientation;
65  bool armar4, velocityBased;
66  float kp, ki, kd;
67  std::vector<float> err_old = std::vector<float>(3);
68  std::vector<float> err_sum = std::vector<float>(3);
69  std::vector<float> rotationVelocity;
70  NameValueMap reportedJointAngles, reportedJointVelocities;
71  std::string eye_pitch_left, eye_pitch_right, eye_yaw_left, eye_yaw_right, neck_roll;
72  Eigen::Quaternionf currentOrientation;
73  Eigen::Quaternionf initialQuaternion;
74 
75 
76  // KinematicUnitListener interface
77  public:
78  void reportJointAngles(const NameValueMap& values, bool valueChanged, const Ice::Current& c);
79  void reportJointVelocities(const NameValueMap& values, bool valueChanged, const Ice::Current& c);
80 
81  void reportHeadTargetChanged(const NameValueMap& targetJointAngles, const FramedPositionBasePtr& targetPosition);
82 
83  private:
84  std::vector<float> pid(std::vector<float> error, std::vector<float> kp, std::vector<float> ki, std::vector<float> kd);
85  };
86 }
87 
ReflexCombination.h
armarx::VOR::getName
std::string getName() const override
Definition: vor.h:49
armarx::VOR::~VOR
~VOR() override
Definition: vor.h:43
ProsthesisInterface.values
values
Definition: ProsthesisInterface.py:190
armarx::VOR::setJointNames
void setJointNames(std::string eye_pitch_left, std::string eye_pitch_right, std::string eye_yaw_left, std::string eye_yaw_right, std::string neck_roll)
Definition: vor.cpp:145
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::VOR::VOR
VOR(int interval)
Definition: vor.h:39
armarx::navigation::platform_controller::platform_global_trajectory::NameValueMap
std::map< std::string, float > NameValueMap
Definition: PlatformGlobalTrajectoryController.h:93
armarx::VOR
Definition: vor.h:36
armarx::Reflex
Definition: reflex.h:36
armarx::VOR::setPIDValues
void setPIDValues(float kp, float ki, float kd)
Definition: vor.cpp:156
InertialMeasurementUnit.h
armarx::VOR::setBools
void setBools(bool armar4, bool velocityBased)
Definition: vor.cpp:165
armarx::VOR::reportJointAngles
void reportJointAngles(const NameValueMap &values, bool valueChanged, const Ice::Current &c)
Definition: vor.cpp:217
armarx::VOR::reportJointVelocities
void reportJointVelocities(const NameValueMap &values, bool valueChanged, const Ice::Current &c)
Definition: vor.cpp:226
Eigen::Quaternionf
Quaternion< float, 0 > Quaternionf
Definition: EigenForwardDeclarations.h:61
reflex.h
armarx::Reflex::interval
int interval
Definition: reflex.h:134
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::VOR::reportHeadTargetChanged
void reportHeadTargetChanged(const NameValueMap &targetJointAngles, const FramedPositionBasePtr &targetPosition)
armarx::VOR::reportSensorValues
void reportSensorValues(const IMUData &values)
Definition: vor.cpp:122