RigidBodyTransform.cpp
Go to the documentation of this file.
1 /*
2  * Karto (tm) Robot Navigation Software - Software Development Kit
3  * Release 2.1
4  *
5  * Copyright (C) 2006-2011, SRI International (R)
6  *
7  * The material contained in this release is copyrighted. It may not be copied,
8  * reproduced, translated, reverse engineered, modified or reduced to any electronic
9  * medium or machine-readable form without the prior written consent of
10  * SRI International (R).
11  *
12  * Portions of files in this release may be unpublished work
13  * containing SRI International (R) CONFIDENTIAL AND PROPRIETARY INFORMATION.
14  * Disclosure, use, reverse engineering, modification, or reproduction without
15  * written authorization of SRI International (R) is likewise prohibited.
16  *
17  * Karto (tm) is a Trademark of SRI International (R).
18  *
19  * Author(s): Benson Limketkai (bensonl@ai.sri.com)
20  */
21 
22 #include <OpenKarto/Geometry.h>
24 
25 using namespace karto;
26 
28 {
29  SetTransform(karto::Pose2(), rPose);
30 }
31 
33 {
34  SetTransform(rPose1, rPose2);
35 }
36 
38 {
39  m_Transform = rPose2;
40  m_Transform.SetX(m_Transform.GetX() - rPose1.GetX());
41  m_Transform.SetY(m_Transform.GetY() - rPose1.GetY());
42 
43  karto::Matrix3 rotation;
44  rotation.FromAxisAngle(0, 0, 1, -rPose1.GetHeading());
45  m_Transform = rotation * m_Transform;
46  m_Transform.SetHeading(m_Transform.GetHeading() - rPose1.GetHeading());
47 
48  m_InvTransform = rPose1;
51 
52  karto::Matrix3 invRotation;
53  invRotation.FromAxisAngle(0, 0, 1, -rPose2.GetHeading());
54  m_InvTransform = invRotation * m_InvTransform;
55  m_InvTransform.SetHeading(m_InvTransform.GetHeading() - rPose2.GetHeading());
56 }
57 
59 {
60  karto::Matrix3 rotation;
61  rotation.FromAxisAngle(0, 0, 1, rSourcePose.GetHeading());
62  karto::Pose2 newPose = rotation * m_Transform;
63  newPose += rSourcePose;
64 
65  return newPose;
66 }
67 
69 {
70  karto::Matrix3 rotation;
71  rotation.FromAxisAngle(0, 0, 1, rSourcePose.GetHeading());
72  karto::Pose2 newPose = rotation * m_InvTransform;
73  newPose += rSourcePose;
74 
75  return newPose;
76 }
kt_double GetHeading() const
Definition: Geometry.h:2274
kt_double GetX() const
Definition: Geometry.h:2220
karto::Pose2 InverseTransformPose(const karto::Pose2 &rSourcePose)
karto::Pose2 TransformPose(const karto::Pose2 &rSourcePose)
kt_double GetY() const
Definition: Geometry.h:2238
void SetHeading(kt_double heading)
Definition: Geometry.h:2283
void SetX(kt_double x)
Definition: Geometry.h:2229
Definition: Any.cpp:20
void SetTransform(const karto::Pose2 &rPose1, const karto::Pose2 &rPose2)
RigidBodyTransform(const karto::Pose2 &rPose)
void SetY(kt_double y)
Definition: Geometry.h:2247
void FromAxisAngle(kt_double x, kt_double y, kt_double z, const kt_double radians)
Definition: Geometry.h:2605


nav2d_karto
Author(s): Sebastian Kasperski
autogenerated on Tue Nov 7 2017 06:02:36