euler_property.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016, Bielefeld University, CITEC
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  *
29  * Author: Robert Haschke <rhaschke@techfak.uni-bielefeld.de>
30  */
31 
32 #ifndef EULER_PROPERTY_H
33 #define EULER_PROPERTY_H
34 
35 #include <Eigen/Geometry>
36 #include <stdexcept>
37 
40 
41 namespace rviz {
42 
43 class SpinBoxFloatProperty;
44 
45 class EulerProperty : public Property
46 {
47  Q_OBJECT
48 public:
49  class invalid_axes : public std::invalid_argument
50  {
51  public:
52  invalid_axes(const std::string& msg);
53  };
54 
55  EulerProperty(Property* parent = nullptr,
56  const QString& name = QString(),
57  const Eigen::Quaterniond& value = Eigen::Quaterniond::Identity(),
58  const char* changed_slot = nullptr,
59  QObject* receiver = nullptr);
60 
61  Eigen::Quaterniond getQuaternion() const {
62  return quaternion_;
63  }
64  bool setValue(const QVariant& value) override;
65 
68  void load(const Config& config) override;
69  void save(Config config) const override;
70 
72  void setReadOnly(bool read_only) override;
74  return angles_read_only_;
75  }
76 
77 public Q_SLOTS:
78  void setQuaternion(const Eigen::Quaterniond& q);
79  void setEulerAngles(double euler[3], bool normalize);
80  void setEulerAngles(double e1, double e2, double e3, bool normalize);
85  void setEulerAxes(const QString& axes_spec);
86 
87 private Q_SLOTS:
88  void updateFromChildren();
89  void emitAboutToChange();
90 
91 Q_SIGNALS:
93  void quaternionChanged(Eigen::Quaterniond q);
95  void statusUpdate(rviz::StatusProperty::Level, const QString&, const QString&);
96 
97 private:
98  void updateAngles(const Eigen::Quaterniond& q);
99  void updateString();
100 
101  Eigen::Quaterniond quaternion_;
102  QString axes_string_;
103  uint axes_[3]; // unit axis index for i-th rotation
104  bool fixed_;
108  bool update_string_; // do we have any changes triggering an updateString()?
109 };
110 
111 } // end namespace rviz
112 
113 #endif // EULER_PROPERTY_H
rviz::EulerProperty::updateFromChildren
void updateFromChildren()
Definition: euler_property.cpp:256
rviz::EulerProperty::statusUpdate
void statusUpdate(rviz::StatusProperty::Level, const QString &, const QString &)
rviz::EulerProperty::invalid_axes
Definition: euler_property.h:49
rviz::EulerProperty::setReadOnly
void setReadOnly(bool read_only) override
Overridden from Property to propagate read-only-ness to children.
Definition: euler_property.cpp:317
rviz::EulerProperty::getQuaternion
Eigen::Quaterniond getQuaternion() const
Definition: euler_property.h:61
rviz::EulerProperty::axes_string_
QString axes_string_
Definition: euler_property.h:102
rviz::StatusProperty::Level
Level
rviz::EulerProperty::quaternion_
Eigen::Quaterniond quaternion_
Definition: euler_property.h:101
rviz::EulerProperty::setEulerAxes
void setEulerAxes(const QString &axes_spec)
Definition: euler_property.cpp:144
rviz::EulerProperty::setEulerAngles
void setEulerAngles(double euler[3], bool normalize)
rviz::EulerProperty::save
void save(Config config) const override
Definition: euler_property.cpp:308
rviz::Property
rviz::EulerProperty::ignore_child_updates_
bool ignore_child_updates_
Definition: euler_property.h:106
rviz::EulerProperty::EulerProperty
EulerProperty(Property *parent=nullptr, const QString &name=QString(), const Eigen::Quaterniond &value=Eigen::Quaterniond::Identity(), const char *changed_slot=nullptr, QObject *receiver=nullptr)
Definition: euler_property.cpp:67
rviz
rviz::SpinBoxFloatProperty
Definition: euler_property.cpp:43
rviz::EulerProperty::emitAboutToChange
void emitAboutToChange()
Definition: euler_property.cpp:268
rviz::EulerProperty::setQuaternion
void setQuaternion(const Eigen::Quaterniond &q)
Definition: euler_property.cpp:96
rviz::EulerProperty::update_string_
bool update_string_
Definition: euler_property.h:108
rviz::EulerProperty::angles_read_only_
bool angles_read_only_
Definition: euler_property.h:107
rviz::EulerProperty
Definition: euler_property.h:45
rviz::EulerProperty::euler_
SpinBoxFloatProperty * euler_[3]
Definition: euler_property.h:105
rviz::EulerProperty::quaternionChanged
void quaternionChanged(Eigen::Quaterniond q)
rviz::EulerProperty::axes_
uint axes_[3]
Definition: euler_property.h:103
status_property.h
property.h
rviz::EulerProperty::invalid_axes::invalid_axes
invalid_axes(const std::string &msg)
Definition: euler_property.cpp:64
rviz::EulerProperty::setValue
bool setValue(const QVariant &value) override
Definition: euler_property.cpp:204
rviz::EulerProperty::updateString
void updateString()
Definition: euler_property.cpp:284
rviz::EulerProperty::fixed_
bool fixed_
Definition: euler_property.h:104
rviz::Config
rviz::EulerProperty::load
void load(const Config &config) override
Load the value of this property and/or its children from the given Config node.
Definition: euler_property.cpp:294
rviz::EulerProperty::getAnglesReadOnly
bool getAnglesReadOnly()
Definition: euler_property.h:73
rviz::EulerProperty::updateAngles
void updateAngles(const Eigen::Quaterniond &q)
Definition: euler_property.cpp:274


agni_tf_tools
Author(s): Robert Haschke
autogenerated on Tue Oct 15 2024 02:57:48