JointVelocityRamp.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 Sonja Marahrens (sonja dot marahrens)
20
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21
* GNU General Public License
22
*/
23
24
#include "
JointVelocityRamp.h
"
25
#include <
ArmarXCore/core/logging/Logging.h
>
26
27
namespace
armarx
28
{
29
JointVelocityRamp::JointVelocityRamp
()
30
{ }
31
32
void
JointVelocityRamp::setState
(
const
Eigen::VectorXf& state)
33
{
34
this->state = state;
35
}
36
37
Eigen::VectorXf
JointVelocityRamp::update
(
const
Eigen::VectorXf&
target
,
float
dt
)
38
{
39
if
(
dt
<= 0)
40
{
41
return
state;
42
}
43
44
Eigen::VectorXf delta =
target
- state;
45
46
float
factor = delta.norm() / maxAcceleration /
dt
;
47
factor =
std::max
(factor, 1.f);
48
49
state += delta / factor;
50
// ARMARX_IMPORTANT << "JointRamp state " << state;
51
return
state;
52
53
}
54
55
void
JointVelocityRamp::setMaxAccelaration
(
float
maxAcceleration)
56
{
57
this->maxAcceleration = maxAcceleration;
58
59
}
60
61
float
JointVelocityRamp::getMaxAccelaration
()
62
{
63
return
maxAcceleration;
64
}
65
}
armarx::JointVelocityRamp::JointVelocityRamp
JointVelocityRamp()
Definition:
JointVelocityRamp.cpp:29
armarx::JointVelocityRamp::setMaxAccelaration
void setMaxAccelaration(float maxAcceleration)
Definition:
JointVelocityRamp.cpp:55
boost::target
Vertex target(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition:
point_cloud_graph.h:688
armarx::JointVelocityRamp::update
Eigen::VectorXf update(const Eigen::VectorXf &target, float dt)
Definition:
JointVelocityRamp.cpp:37
armarx::JointVelocityRamp::setState
void setState(const Eigen::VectorXf &state)
Definition:
JointVelocityRamp.cpp:32
max
T max(T t1, T t2)
Definition:
gdiam.h:48
JointVelocityRamp.h
armarx::JointVelocityRamp::getMaxAccelaration
float getMaxAccelaration()
Definition:
JointVelocityRamp.cpp:61
Logging.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition:
ArmarXTimeserver.cpp:28
dt
constexpr T dt
Definition:
UnscentedKalmanFilterTest.cpp:42
RobotAPI
libraries
core
JointVelocityRamp.cpp
Generated on Sat Oct 12 2024 09:14:10 for armarx_documentation by
1.8.17