src
node.cpp
Go to the documentation of this file.
1
#include <
ros/ros.h
>
2
#include <
tf/transform_listener.h
>
3
4
#include <
nav2d_operator/RobotOperator.h
>
5
6
using namespace
ros
;
7
8
int
main
(
int
argc,
char
**argv)
9
{
10
init
(argc, argv,
NODE_NAME
);
11
NodeHandle
n(
"~/"
);
12
13
double
frequency;
14
n.
param
(
"frequency"
, frequency, 100.0);
15
ROS_INFO
(
"Operator will run at %.2f Hz."
, frequency);
16
17
RobotOperator
robOp;
18
19
Rate
loopRate(frequency);
20
while
(
ok
())
21
{
22
spinOnce
();
23
robOp.
executeCommand
();
24
loopRate.
sleep
();
25
if
(loopRate.
cycleTime
() >
ros::Duration
(1.0 / frequency))
26
ROS_WARN
(
"Missed desired rate of %.2f Hz! Loop actually took %.4f seconds!"
,frequency, loopRate.
cycleTime
().
toSec
());
27
}
28
return
0;
29
}
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
ros
ros.h
ros::spinOnce
ROSCPP_DECL void spinOnce()
ros::ok
ROSCPP_DECL bool ok()
RobotOperator
Definition:
RobotOperator.h:32
ROS_WARN
#define ROS_WARN(...)
ros::NodeHandle
ros::Rate::sleep
bool sleep()
transform_listener.h
ros::Rate::cycleTime
Duration cycleTime() const
RobotOperator::executeCommand
void executeCommand()
Generates and sends Twist-Message to Robot This is the Operator's core function and should be called ...
Definition:
RobotOperator.cpp:200
NODE_NAME
#define NODE_NAME
Definition:
RobotOperator.h:4
RobotOperator.h
The core of a ROS node to provide purely reactive obstacle avoidance The RobotOperator is supposed to...
ros::NodeHandle::param
T param(const std::string ¶m_name, const T &default_val) const
ros::Rate
DurationBase< Duration >::toSec
double toSec() const
main
int main(int argc, char **argv)
Definition:
node.cpp:8
ROS_INFO
#define ROS_INFO(...)
ros::Duration
nav2d_operator
Author(s): Sebastian Kasperski
autogenerated on Wed Mar 2 2022 00:37:35