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_twist_command_sine_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 <string>
20
21
#include <
ros/ros.h
>
22
#include <geometry_msgs/Twist.h>
23
24
class
TwistCommandExecutionTester
25
{
26
public
:
27
TwistCommandExecutionTester
()
28
{
29
output_pub_
=
nh_
.
advertise
<geometry_msgs::Twist>(
"command"
, 1);
30
31
ros::Duration
(1.0).
sleep
();
32
}
33
34
35
~TwistCommandExecutionTester
()
36
{}
37
38
void
run
()
39
{
40
ros::Rate
r
(50.0);
41
42
ros::Time
time =
ros::Time::now
();
43
ros::Time
start_time = time;
44
double
x = 0.0;
45
46
double
a = 0.6, b = 0.4, c = 0,
d
= 0;
47
48
geometry_msgs::Twist command_msg;
49
50
while
(
ros::ok
())
51
{
52
time =
ros::Time::now
();
53
x = (time - start_time).toSec();
54
55
double
vel = a*sin(b*x+c) +
d
;
56
57
command_msg.angular.z = vel;
58
59
output_pub_
.
publish
(command_msg);
60
61
ros::spinOnce
();
62
r
.sleep();
63
}
64
}
65
66
67
ros::NodeHandle
nh_
;
68
ros::Publisher
output_pub_
;
69
};
70
71
72
73
int
main
(
int
argc,
char
**argv)
74
{
75
ros::init
(argc, argv,
"test_twist_command_execution_node"
);
76
77
TwistCommandExecutionTester
tcet;
78
tcet.
run
();
79
ros::spin
();
80
return
0;
81
}
TwistCommandExecutionTester::TwistCommandExecutionTester
TwistCommandExecutionTester()
Definition:
test_twist_command_sine_node.cpp:27
ros::Publisher
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
TwistCommandExecutionTester::output_pub_
ros::Publisher output_pub_
Definition:
test_twist_command_sine_node.cpp:68
ros.h
r
r
ros::spinOnce
ROSCPP_DECL void spinOnce()
ros::Publisher::publish
void publish(const boost::shared_ptr< M > &message) const
ros::NodeHandle::advertise
Publisher advertise(AdvertiseOptions &ops)
ros::ok
ROSCPP_DECL bool ok()
setup.d
d
Definition:
setup.py:6
TwistCommandExecutionTester::run
void run()
Definition:
test_twist_command_sine_node.cpp:38
TwistCommandExecutionTester
Definition:
test_twist_command_sine_node.cpp:24
TwistCommandExecutionTester::nh_
ros::NodeHandle nh_
Definition:
test_twist_command_sine_node.cpp:67
ros::Time
ros::Rate
ros::spin
ROSCPP_DECL void spin()
main
int main(int argc, char **argv)
Definition:
test_twist_command_sine_node.cpp:73
ros::Duration::sleep
bool sleep() const
TwistCommandExecutionTester::~TwistCommandExecutionTester
~TwistCommandExecutionTester()
Definition:
test_twist_command_sine_node.cpp:35
ros::Duration
ros::NodeHandle
ros::Time::now
static Time now()
cob_twist_controller
Author(s): Felix Messmer
, Marco Bezzon
, Christoph Mark
, Francisco Moreno
autogenerated on Mon May 1 2023 02:44:43