simulator_node.cpp
Go to the documentation of this file.
1 #include "ros/ros.h"
2 
5 
6 int main(int argc, char **argv)
7 {
8  ros::init(argc,argv, "mobile_robot_simulator");
10 
11  // global rate
12  float rate = 10.0;
13 
14  MobileRobotSimulator mob_sim(&nh);
15  LaserScannerSimulator laser_sim(&nh);
16 
17  ROS_INFO("--- Starting simulator");
18 
19  ros::Duration(1.0).sleep();
21 
22  mob_sim.publish_map_transform = true;
23  mob_sim.start();
24  laser_sim.start();
25 
26  ros::Time tic = ros::Time::now();
27 
28  spinner.start();
29  while (nh.ok() && ros::Time::now()-tic<ros::Duration(10.0)) {
30  //ros::spinOnce();
31  ros::Duration(0.01).sleep();
32  }
33  spinner.stop();
34 
35  ROS_INFO("--- Stopping simulator");
36 
37  mob_sim.stop();
38  laser_sim.stop();
39 
40  tic = ros::Time::now();
41  while (nh.ok() && ros::Time::now()-tic<ros::Duration(5.0)) {
42  ros::spinOnce();
43  ros::Duration(0.01).sleep();
44  }
45 
46  return 0;
47 
48 } // end main
int main(int argc, char **argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void spinner()
#define ROS_INFO(...)
static Time now()
bool sleep() const
ROSCPP_DECL void spinOnce()
bool ok() const


mobile_robot_simulator
Author(s): Mikkel Rath Pedersen
autogenerated on Fri Jun 3 2022 03:02:19