Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
hom_pose.cpp
1
2
/***************************************************************************
3
* hom_pose.cpp - Homogenous Pose
4
*
5
* Created: Sun April 13 17:52:43 2008
6
* Copyright 2008 Daniel Beck
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version. A runtime exception applies to
14
* this software (see LICENSE.GPL_WRE file mentioned below for details).
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Library General Public License for more details.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#include <geometry/hom_pose.h>
25
26
namespace
fawkes {
27
28
/** @class HomPose <geometry/hom_pose.h>
29
* A homogeneous pose combines a position with an orienation in space.
30
* @author Daniel Beck
31
*/
32
33
/** Constructor.
34
* Constructs a two-dimensional pose.
35
* @param x the x-coordinate of the position
36
* @param y the y-coordinate of the position
37
* @param yaw the orienations in the xy-plane
38
*/
39
HomPose::HomPose
(
float
x,
float
y,
float
yaw)
40
:
HomPoint
(x, y)
41
{
42
m_roll = 0.0;
43
m_pitch = 0.0;
44
m_yaw =
yaw
;
45
}
46
47
/** Constructor.
48
* Constructs a three-dimensional pose.
49
* @param x the x-coordinate of the position
50
* @param y the y-coordinate of the position
51
* @param z the z-coordinate of the position
52
* @param roll the orienations in the yz-plane
53
* @param pitch the orienations in the xz-plane
54
* @param yaw the orienations in the xy-plane
55
*/
56
HomPose::HomPose
(
float
x,
float
y,
float
z,
float
roll,
float
pitch,
float
yaw)
57
:
HomPoint
(x, y, z)
58
{
59
m_roll =
roll
;
60
m_pitch =
pitch
;
61
m_yaw =
yaw
;
62
}
63
64
/** Copy constructor.
65
* @param h a homogeneous coordinate
66
*/
67
HomPose::HomPose
(
const
HomCoord
& h)
68
:
HomPoint
(h)
69
{
70
m_roll = 0.0;
71
m_pitch = 0.0;
72
m_yaw = 0.0;
73
}
74
75
/** Destructor. */
76
HomPose::~HomPose
()
77
{
78
}
79
80
/** RO-getter for roll.
81
* @return the value
82
*/
83
float
84
HomPose::roll
()
const
85
{
86
return
m_roll;
87
}
88
89
/** RW-getter for roll.
90
* @return a reference to the roll variable
91
*/
92
float
&
93
HomPose::roll
()
94
{
95
return
m_roll;
96
}
97
98
/** Setter function for roll.
99
* @param roll the new roll value
100
*/
101
void
102
HomPose::roll
(
float
roll)
103
{
104
m_roll =
roll
;
105
}
106
107
/** RO-getter for pitch.
108
* @return the value
109
*/
110
float
111
HomPose::pitch
()
const
112
{
113
return
m_pitch;
114
}
115
116
/** RW-getter for pitch.
117
* @return a reference to the pitch variable
118
*/
119
float
&
120
HomPose::pitch
()
121
{
122
return
m_pitch;
123
}
124
125
/** Setter function for pitch.
126
* @param pitch the new pitch value
127
*/
128
void
129
HomPose::pitch
(
float
pitch)
130
{
131
m_pitch =
pitch
;
132
}
133
134
/** RO-getter for yaw.
135
* @return the value
136
*/
137
float
138
HomPose::yaw
()
const
139
{
140
return
m_yaw;
141
}
142
143
/** RW-getter for yaw.
144
* @return a reference to the yaw variable
145
*/
146
float
&
147
HomPose::yaw
()
148
{
149
return
m_yaw;
150
}
151
152
/** Setter function for yaw.
153
* @param yaw the new yaw value
154
*/
155
void
156
HomPose::yaw
(
float
yaw)
157
{
158
m_yaw =
yaw
;
159
}
160
161
/** Get the positional part of the pose.
162
* @return the position
163
*/
164
HomPoint
165
HomPose::pos
()
const
166
{
167
HomPoint
pos
;
168
pos.
x
() =
x
();
169
pos.
y
() =
y
();
170
pos.
z
() =
z
();
171
172
return
pos
;
173
}
174
175
HomPose
&
176
HomPose::rotate_x
(
float
rad)
177
{
178
HomCoord::rotate_x
(rad);
179
m_roll += rad;
180
181
return
*
this
;
182
}
183
184
HomPose
&
185
HomPose::rotate_y
(
float
rad)
186
{
187
HomCoord::rotate_y
(rad);
188
m_roll += rad;
189
190
return
*
this
;
191
}
192
193
HomPose
&
194
HomPose::rotate_z
(
float
rad)
195
{
196
HomCoord::rotate_z
(rad);
197
m_roll += rad;
198
199
return
*
this
;
200
}
201
202
}
// end namespace fawkes
src
libs
geometry
hom_pose.cpp
Generated by
1.8.3.1