Main Page
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
g
i
k
l
m
n
p
q
r
s
t
v
w
Functions
Variables
a
b
c
d
e
k
l
m
n
p
q
r
s
t
w
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Functions
_
a
b
c
d
e
f
g
i
j
k
l
m
n
o
p
r
s
t
u
v
w
~
Variables
_
a
b
c
d
e
f
g
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Files
File List
File Members
All
b
c
d
e
g
j
k
l
m
n
o
s
t
u
v
w
x
y
z
Functions
Typedefs
Enumerations
Enumerator
b
c
d
g
j
l
m
n
s
t
u
w
x
y
z
Macros
src
debug
test_simpson_integrator_node.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
18
#include <vector>
19
#include <
ros/ros.h
>
20
#include <std_msgs/Float64.h>
21
#include <kdl/jntarray.hpp>
22
#include <
cob_twist_controller/utils/simpson_integrator.h
>
23
24
25
class
SimpsonIntegratorTester
26
{
27
public
:
28
SimpsonIntegratorTester
()
29
{
30
unsigned
int
dof = 1;
31
q_
.resize(dof);
32
KDL::SetToZero(
q_
);
33
q_dot_
.resize(dof);
34
KDL::SetToZero(
q_dot_
);
35
36
integrator_
.reset(
new
SimpsonIntegrator
(dof));
37
output_q_pub_
=
nh_
.
advertise
<std_msgs::Float64>(
"output_q"
, 1);
38
output_q_dot_pub_
=
nh_
.
advertise
<std_msgs::Float64>(
"output_q_dot"
, 1);
39
input_sub_
=
nh_
.
subscribe
(
"input"
, 1, &
SimpsonIntegratorTester::input_cb
,
this
);
40
}
41
42
~SimpsonIntegratorTester
()
43
{}
44
45
void
input_cb
(
const
std_msgs::Float64::ConstPtr& input)
46
{
47
q_dot_
(0) = input->data;
48
49
std::vector<double> next_q;
50
std::vector<double> next_q_dot;
51
52
if
(
integrator_
->updateIntegration(
q_dot_
,
q_
, next_q, next_q_dot))
53
{
54
for
(
unsigned
int
i = 0; i < next_q.size(); i++)
55
{
56
q_
(i) = next_q[i];
57
q_dot_
(i) = next_q_dot[i];
58
}
59
60
std_msgs::Float64 output_q;
61
output_q.data =
q_
(0);
62
std_msgs::Float64 output_q_dot;
63
output_q_dot.data =
q_dot_
(0);
64
65
output_q_pub_
.
publish
(output_q);
66
output_q_dot_pub_
.
publish
(output_q_dot);
67
}
68
}
69
70
ros::NodeHandle
nh_
;
71
ros::Subscriber
input_sub_
;
72
ros::Publisher
output_q_pub_
;
73
ros::Publisher
output_q_dot_pub_
;
74
75
KDL::JntArray
q_
;
76
KDL::JntArray
q_dot_
;
77
78
boost::shared_ptr<SimpsonIntegrator>
integrator_
;
79
};
80
81
82
83
int
main
(
int
argc,
char
**argv)
84
{
85
ros::init
(argc, argv,
"test_simpson_integrator_node"
);
86
87
SimpsonIntegratorTester
sit;
88
89
ros::spin
();
90
return
0;
91
}
ros::Publisher
SimpsonIntegratorTester
Definition:
test_simpson_integrator_node.cpp:25
SimpsonIntegratorTester::q_
KDL::JntArray q_
Definition:
test_simpson_integrator_node.cpp:75
boost::shared_ptr< SimpsonIntegrator >
SimpsonIntegratorTester::input_cb
void input_cb(const std_msgs::Float64::ConstPtr &input)
Definition:
test_simpson_integrator_node.cpp:45
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
ros.h
SimpsonIntegrator
Definition:
simpson_integrator.h:29
ros::Publisher::publish
void publish(const boost::shared_ptr< M > &message) const
ros::NodeHandle::advertise
Publisher advertise(AdvertiseOptions &ops)
SimpsonIntegratorTester::output_q_dot_pub_
ros::Publisher output_q_dot_pub_
Definition:
test_simpson_integrator_node.cpp:73
simpson_integrator.h
SimpsonIntegratorTester::input_sub_
ros::Subscriber input_sub_
Definition:
test_simpson_integrator_node.cpp:71
SimpsonIntegratorTester::~SimpsonIntegratorTester
~SimpsonIntegratorTester()
Definition:
test_simpson_integrator_node.cpp:42
SimpsonIntegratorTester::output_q_pub_
ros::Publisher output_q_pub_
Definition:
test_simpson_integrator_node.cpp:72
ros::NodeHandle::subscribe
Subscriber subscribe(const std::string &topic, uint32_t queue_size, const boost::function< void(C)> &callback, const VoidConstPtr &tracked_object=VoidConstPtr(), const TransportHints &transport_hints=TransportHints())
SimpsonIntegratorTester::integrator_
boost::shared_ptr< SimpsonIntegrator > integrator_
Definition:
test_simpson_integrator_node.cpp:78
SimpsonIntegratorTester::nh_
ros::NodeHandle nh_
Definition:
test_simpson_integrator_node.cpp:70
ros::spin
ROSCPP_DECL void spin()
SimpsonIntegratorTester::q_dot_
KDL::JntArray q_dot_
Definition:
test_simpson_integrator_node.cpp:76
main
int main(int argc, char **argv)
Definition:
test_simpson_integrator_node.cpp:83
SimpsonIntegratorTester::SimpsonIntegratorTester
SimpsonIntegratorTester()
Definition:
test_simpson_integrator_node.cpp:28
ros::NodeHandle
ros::Subscriber
cob_twist_controller
Author(s): Felix Messmer
, Marco Bezzon
, Christoph Mark
, Francisco Moreno
autogenerated on Mon May 1 2023 02:44:43