LinearizeAngularTrajectory.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T),
5  * Karlsruhe Institute of Technology (KIT), all rights reserved.
6  *
7  * ArmarX is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  *
11  * ArmarX is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * @author ()
20  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21  * GNU General Public License
22  */
23 
25 
26 #include "MathUtils.h"
27 
28 namespace armarx::math
29 {
31  linearValue(initialLinearValue)
32  {
33  }
34 
35  float
37  {
38  linearValue = linearValue + MathUtils::angleModPI(angle - linearValue);
39  return linearValue;
40  }
41 
42  float
44  {
45  return linearValue;
46  }
47 
48  std::vector<float>
49  LinearizeAngularTrajectory::Linearize(const std::vector<float>& data)
50  {
51  std::vector<float> result;
52  result.reserve(data.size());
53  if (data.size() == 0)
54  {
55  return result;
56  }
58  for (float v : data)
59  {
60  result.push_back(lat.update(v));
61  }
62  return result;
63  }
64 
65  void
67  {
68  if (data.size() == 0)
69  {
70  return;
71  }
73  for (size_t i = 0; i < data.size(); i++)
74  {
75  data.at(i) = lat.update(data.at(i));
76  }
77  }
78 
79  std::vector<float>
80  LinearizeAngularTrajectory::Angularize(const std::vector<float>& data, float center)
81  {
82  std::vector<float> result;
83  result.reserve(data.size());
84  for (float v : data)
85  {
86  result.push_back(MathUtils::angleModX(v, center));
87  }
88  return result;
89  }
90 
91  void
93  {
94  for (size_t i = 0; i < data.size(); i++)
95  {
96  data.at(i) = MathUtils::angleModX(data.at(i), center);
97  }
98  }
99 } // namespace armarx::math
MathUtils.h
LinearizeAngularTrajectory.h
armarx::math::LinearizeAngularTrajectory::Angularize
static std::vector< float > Angularize(const std::vector< float > &data, float center=0)
Definition: LinearizeAngularTrajectory.cpp:80
armarx::math::LinearizeAngularTrajectory::update
float update(float angle)
Definition: LinearizeAngularTrajectory.cpp:36
armarx::math::MathUtils::angleModX
static float angleModX(float value, float center)
Definition: MathUtils.h:179
armarx::math::LinearizeAngularTrajectory::LinearizeAngularTrajectory
LinearizeAngularTrajectory(float initialLinearValue)
Definition: LinearizeAngularTrajectory.cpp:30
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
armarx::math::LinearizeAngularTrajectory
Definition: LinearizeAngularTrajectory.h:34
armarx::math::MathUtils::angleModPI
static float angleModPI(float value)
Definition: MathUtils.h:173
armarx::ctrlutil::v
double v(double t, double v0, double a0, double j)
Definition: CtrlUtil.h:39
armarx::view_selection::skills::direction::state::center
state::Type center(state::Type previous)
Definition: LookDirection.cpp:233
armarx::math::LinearizeAngularTrajectory::LinearizeRef
static void LinearizeRef(std::vector< float > &data)
Definition: LinearizeAngularTrajectory.cpp:66
armarx::math
Definition: LinearizeAngularTrajectory.cpp:28
armarx::math::LinearizeAngularTrajectory::getLinearValue
float getLinearValue()
Definition: LinearizeAngularTrajectory.cpp:43
angle
double angle(const Point &a, const Point &b, const Point &c)
Definition: point.hpp:109
armarx::math::LinearizeAngularTrajectory::AngularizeRef
static void AngularizeRef(std::vector< float > &data, float center=0)
Definition: LinearizeAngularTrajectory.cpp:92
armarx::math::LinearizeAngularTrajectory::Linearize
static std::vector< float > Linearize(const std::vector< float > &data)
Definition: LinearizeAngularTrajectory.cpp:49