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 <Eigen/Core>
27#include <Eigen/Geometry>
28
30
31#include "ReflexCombination.h"
32#include "reflex.h"
33
34namespace armarx
35{
37
38 class VOR : virtual public Reflex
39 {
40 public:
42 {
43 onStop();
44 }
45
46 ~VOR() override
47 {
48 }
49
50 void reportSensorValues(const IMUData& values);
51 void setJointNames(std::string eye_pitch_left,
52 std::string eye_pitch_right,
53 std::string eye_yaw_left,
54 std::string eye_yaw_right,
55 std::string neck_roll);
56 void setPIDValues(float kp, float ki, float kd);
57 void setBools(bool armar4, bool velocityBased);
58
59 std::string
60 getName() const override
61 {
62 return "VOR";
63 }
64
65 // Reflex interface
66 private:
67 void calc() override;
68
69 void onStop() override;
70
71 private:
72 std::mutex dataMutex;
73
74 bool reportedSensorValues, reportedJointAnglesBool, reportedJointVelocitiesBool,
75 initialOrientation;
76 bool armar4, velocityBased;
77 float kp, ki, kd;
78 std::vector<float> err_old = std::vector<float>(3);
79 std::vector<float> err_sum = std::vector<float>(3);
80 std::vector<float> rotationVelocity;
81 NameValueMap reportedJointAngles, reportedJointVelocities;
82 std::string eye_pitch_left, eye_pitch_right, eye_yaw_left, eye_yaw_right, neck_roll;
83 Eigen::Quaternionf currentOrientation;
84 Eigen::Quaternionf initialQuaternion;
85
86
87 // KinematicUnitListener interface
88 public:
89 void
90 reportJointAngles(const NameValueMap& values, bool valueChanged, const Ice::Current& c);
91 void
92 reportJointVelocities(const NameValueMap& values, bool valueChanged, const Ice::Current& c);
93
94 void reportHeadTargetChanged(const NameValueMap& targetJointAngles,
95 const FramedPositionBasePtr& targetPosition);
96
97 private:
98 std::vector<float> pid(std::vector<float> error,
99 std::vector<float> kp,
100 std::vector<float> ki,
101 std::vector<float> kd);
102 };
103} // namespace armarx
constexpr T c
Brief description of class ReflexCombination.
Reflex(int interval)
Definition reflex.h:40
std::string getName() const override
Definition vor.h:60
void reportJointAngles(const NameValueMap &values, bool valueChanged, const Ice::Current &c)
Definition vor.cpp:229
void reportHeadTargetChanged(const NameValueMap &targetJointAngles, const FramedPositionBasePtr &targetPosition)
~VOR() override
Definition vor.h:46
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:149
void reportSensorValues(const IMUData &values)
Definition vor.cpp:126
void setPIDValues(float kp, float ki, float kd)
Definition vor.cpp:165
VOR(int interval)
Definition vor.h:41
void reportJointVelocities(const NameValueMap &values, bool valueChanged, const Ice::Current &c)
Definition vor.cpp:238
void setBools(bool armar4, bool velocityBased)
Definition vor.cpp:175
Quaternion< float, 0 > Quaternionf
This file offers overloads of toIce() and fromIce() functions for STL container types.