SpinBoxToPose.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::ArmarXObjects::NJointControllerGuiPluginUtility
17  * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18  * @date 2020
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <SimoxUtility/math/convert.h>
26 
27 #include "SpinBoxToVector.h"
28 
29 namespace armarx
30 {
31  template<class Qwid = QDoubleSpinBox>
33  {
34  //set
35  public:
36  void setPos(const Eigen::Vector3f& pos)
37  {
38  _xyz.set(pos);
39  }
40  void setOri(const Eigen::Vector3f& rpy)
41  {
42  _rpy.set(rpy);
43  }
45  {
46  setOri(simox::math::quat_to_rpy(q));
47  }
48  void setOri(const Eigen::Matrix3f& m)
49  {
50  setOri(simox::math::mat3f_to_rpy(m));
51  }
52  void setPose(const auto& pos, const auto& ori)
53  {
54  setPos(pos);
55  setOri(ori);
56  }
57  void setPose(const Eigen::Matrix4f& m)
58  {
59  setPos(simox::math::mat4f_to_pos(m));
60  setOri(simox::math::mat4f_to_rpy(m));
61  }
62  //get
63  public:
64  Eigen::Vector3f getPos() const
65  {
66  return _xyz.template get<Eigen::Vector3f>();
67  }
68  Eigen::Vector3f getRPY() const
69  {
70  return _rpy.template get<Eigen::Vector3f>();
71  }
73  {
74  return simox::math::rpy_to_quat(getRPY());
75  }
77  {
78  return simox::math::rpy_to_mat3f(getRPY());
79  }
81  {
82  return simox::math::pos_rpy_to_mat4f(getPos(), getRPY());
83  }
84  //set up
85  public:
86  void setXYZWidgets(Qwid* x, Qwid* y, Qwid* z)
87  {
88  _xyz.addWidget(x);
89  _xyz.addWidget(y);
90  _xyz.addWidget(z);
91  }
92  void setRPYWidgets(Qwid* r, Qwid* p, Qwid* y)
93  {
94  _rpy.addWidget(r);
95  _rpy.addWidget(p);
96  _rpy.addWidget(y);
97  }
99  {
100  return _xyz;
101  }
103  {
104  return _rpy;
105  }
107  {
108  _xyz.setMinMax(-100'000, 100'000);
109  _rpy.setMinMax(-9, 9);
110  }
111  private:
114  };
115 }
armarx::SpinBoxToPose::setPose
void setPose(const Eigen::Matrix4f &m)
Definition: SpinBoxToPose.h:57
SpinBoxToVector.h
armarx::SpinBoxToPose::setXYZWidgets
void setXYZWidgets(Qwid *x, Qwid *y, Qwid *z)
Definition: SpinBoxToPose.h:86
armarx::SpinBoxToPose::setRPYWidgets
void setRPYWidgets(Qwid *r, Qwid *p, Qwid *y)
Definition: SpinBoxToPose.h:92
armarx::SpinBoxToPose::getMat4
Eigen::Matrix4f getMat4() const
Definition: SpinBoxToPose.h:80
armarx::SpinBoxToPose::rpyWidgets
SpinBoxToVector< Qwid, 3 > & rpyWidgets()
Definition: SpinBoxToPose.h:102
armarx::SpinBoxToPose::getQuat
Eigen::Quaternionf getQuat() const
Definition: SpinBoxToPose.h:72
armarx::SpinBoxToPose::setOri
void setOri(const Eigen::Matrix3f &m)
Definition: SpinBoxToPose.h:48
armarx::SpinBoxToPose::getRPY
Eigen::Vector3f getRPY() const
Definition: SpinBoxToPose.h:68
armarx::SpinBoxToVector
Definition: SpinBoxToVector.h:41
armarx::SpinBoxToPose::xyzWidgets
SpinBoxToVector< Qwid, 3 > & xyzWidgets()
Definition: SpinBoxToPose.h:98
armarx::SpinBoxToPose::getPos
Eigen::Vector3f getPos() const
Definition: SpinBoxToPose.h:64
q
#define q
armarx::SpinBoxToPose::setOri
void setOri(const Eigen::Quaternionf &q)
Definition: SpinBoxToPose.h:44
armarx::SpinBoxToPose::getMat3
Eigen::Matrix3f getMat3() const
Definition: SpinBoxToPose.h:76
GfxTL::Matrix3f
MatrixXX< 3, 3, float > Matrix3f
Definition: MatrixXX.h:600
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
armarx::Quaternion< float, 0 >
armarx::SpinBoxToPose::setDefaultLimits
void setDefaultLimits()
Definition: SpinBoxToPose.h:106
armarx::SpinBoxToPose
Definition: SpinBoxToPose.h:32
armarx::SpinBoxToPose::setPos
void setPos(const Eigen::Vector3f &pos)
Definition: SpinBoxToPose.h:36
armarx::SpinBoxToPose::setOri
void setOri(const Eigen::Vector3f &rpy)
Definition: SpinBoxToPose.h:40
armarx::SpinBoxToPose::setPose
void setPose(const auto &pos, const auto &ori)
Definition: SpinBoxToPose.h:52
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28