Main Page
Namespaces
Classes
Files
File List
include
pilz_utils
wait_for_message.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2019 Pilz GmbH & Co. KG
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
#ifndef PILZ_UTILS_WAIT_FOR_MESSAGE_H
18
#define PILZ_UTILS_WAIT_FOR_MESSAGE_H
19
20
#include <string>
21
22
#include <
ros/ros.h
>
23
#include <
ros/duration.h
>
24
25
#include <
pilz_utils/wait_for_timeouts.h
>
26
27
namespace
pilz_utils
28
{
29
33
template
<
class
T>
34
static
void
waitForMessage
(
const
std::string topic_name,
35
const
double
retry_timeout =
DEFAULT_RETRY_TIMEOUT
,
36
const
double
msg_output_period =
DEFAULT_MSG_OUTPUT_PERIOD
)
37
{
38
while
( (ros::topic::waitForMessage<T>(topic_name,
ros::Duration
(retry_timeout)) ==
nullptr
) &&
ros::ok
())
39
{
40
ROS_DEBUG_STREAM_DELAYED_THROTTLE
(msg_output_period,
41
"Waiting for message on topic \""
42
+ topic_name +
"\"..."
);
43
}
44
}
45
46
}
47
48
#endif // PILZ_UTILS_WAIT_FOR_MESSAGE_H
wait_for_timeouts.h
pilz_utils::DEFAULT_MSG_OUTPUT_PERIOD
static constexpr double DEFAULT_MSG_OUTPUT_PERIOD
Definition:
wait_for_timeouts.h:24
pilz_utils::waitForMessage
static void waitForMessage(const std::string topic_name, const double retry_timeout=DEFAULT_RETRY_TIMEOUT, const double msg_output_period=DEFAULT_MSG_OUTPUT_PERIOD)
Waits (infinitely) until a message arrives on the specified topic.
Definition:
wait_for_message.h:34
pilz_utils::DEFAULT_RETRY_TIMEOUT
static constexpr double DEFAULT_RETRY_TIMEOUT
Definition:
wait_for_timeouts.h:23
ros::ok
ROSCPP_DECL bool ok()
ros.h
duration.h
ros::Duration
ROS_DEBUG_STREAM_DELAYED_THROTTLE
#define ROS_DEBUG_STREAM_DELAYED_THROTTLE(rate, args)
pilz_utils
Definition:
get_param.h:26
pilz_utils
Author(s):
autogenerated on Tue Feb 2 2021 03:50:14