mobile_robot_simulator.h
Go to the documentation of this file.
1 #include "ros/ros.h"
2 #include "ros/console.h"
3 
4 #include "geometry_msgs/Twist.h"
6 #include "geometry_msgs/PoseWithCovarianceStamped.h"
7 #include "nav_msgs/Odometry.h"
8 
10 #include <tf/transform_datatypes.h>
11 
12 #include <functional>
13 
14 #ifndef MOBILE_ROBOT_SIMULATOR
15 #define MOBILE_ROBOT_SIMULATOR
16 
18 
19 public:
20 
21  MobileRobotSimulator(ros::NodeHandle *nh); // default constructor
22  ~MobileRobotSimulator(); // default destructor
23 
25  void start(); //
26 
28  void stop();
29 
30  bool publish_map_transform; // whether or not to publish the map transform
31 
32 
33 private:
34 
36  void get_params();
37 
39  void update_loop(const ros::TimerEvent& event);
40 
42  void update_odom_from_vel(geometry_msgs::Twist vel, ros::Duration time_diff);
43 
45  void get_tf_from_odom(nav_msgs::Odometry odom);
46 
48  void vel_callback(const geometry_msgs::Twist::ConstPtr& msg);
49 
51  void init_pose_callback(const geometry_msgs::PoseWithCovarianceStamped::ConstPtr& msg);
52 
53  double publish_rate;
54 
55  nav_msgs::Odometry odom; // odometry message
56  tf::StampedTransform odom_trans; // odometry transform
57  tf::StampedTransform map_trans; // transformation from odom to map
58 
59  ros::Time last_vel; // last incoming velocity command
60  ros::Time last_update; // last time the odom was published
61  ros::Time measure_time; // this incoming velocity command
62  bool message_received = false;
64 
65  bool is_running;
66 
67  // ROS interfaces
72 
73  //Topics
74  std::string velocity_topic;
75  std::string odometry_topic;
76  std::string base_link_frame;
77 
78  ros::Timer loop_timer; // timer for the update loop
79 
80  double th = 0.0; // current pose (only need yaw, rest is calculated)
81 
82 }; // end class
83 
84 #endif
ros::Publisher
MobileRobotSimulator::odom_pub
ros::Publisher odom_pub
Definition: mobile_robot_simulator.h:68
MobileRobotSimulator::nh_ptr
ros::NodeHandle * nh_ptr
Definition: mobile_robot_simulator.h:63
MobileRobotSimulator::is_running
bool is_running
Definition: mobile_robot_simulator.h:65
ros.h
MobileRobotSimulator::last_vel
ros::Time last_vel
Definition: mobile_robot_simulator.h:59
MobileRobotSimulator::map_trans
tf::StampedTransform map_trans
Definition: mobile_robot_simulator.h:57
MobileRobotSimulator::tf_broadcaster
tf::TransformBroadcaster tf_broadcaster
Definition: mobile_robot_simulator.h:71
MobileRobotSimulator::get_tf_from_odom
void get_tf_from_odom(nav_msgs::Odometry odom)
Definition: mobile_robot_simulator.cpp:107
MobileRobotSimulator::base_link_frame
std::string base_link_frame
Definition: mobile_robot_simulator.h:76
tf::StampedTransform
MobileRobotSimulator::vel_callback
void vel_callback(const geometry_msgs::Twist::ConstPtr &msg)
Definition: mobile_robot_simulator.cpp:121
transform_broadcaster.h
MobileRobotSimulator::publish_map_transform
bool publish_map_transform
Definition: mobile_robot_simulator.h:30
MobileRobotSimulator::stop
void stop()
Definition: mobile_robot_simulator.cpp:57
console.h
MobileRobotSimulator::update_loop
void update_loop(const ros::TimerEvent &event)
Definition: mobile_robot_simulator.cpp:64
MobileRobotSimulator::odom
nav_msgs::Odometry odom
Definition: mobile_robot_simulator.h:55
MobileRobotSimulator::get_params
void get_params()
Definition: mobile_robot_simulator.cpp:39
tf::TransformBroadcaster
MobileRobotSimulator::~MobileRobotSimulator
~MobileRobotSimulator()
Definition: mobile_robot_simulator.cpp:34
MobileRobotSimulator::init_pose_callback
void init_pose_callback(const geometry_msgs::PoseWithCovarianceStamped::ConstPtr &msg)
Definition: mobile_robot_simulator.cpp:133
MobileRobotSimulator::loop_timer
ros::Timer loop_timer
Definition: mobile_robot_simulator.h:78
MobileRobotSimulator::th
double th
Definition: mobile_robot_simulator.h:80
ros::TimerEvent
MobileRobotSimulator::vel_sub
ros::Subscriber vel_sub
Definition: mobile_robot_simulator.h:69
MobileRobotSimulator::message_received
bool message_received
Definition: mobile_robot_simulator.h:62
MobileRobotSimulator::velocity_topic
std::string velocity_topic
Definition: mobile_robot_simulator.h:74
MobileRobotSimulator::publish_rate
double publish_rate
Definition: mobile_robot_simulator.h:53
transform_datatypes.h
ros::Time
MobileRobotSimulator::measure_time
ros::Time measure_time
Definition: mobile_robot_simulator.h:61
MobileRobotSimulator::init_pose_sub
ros::Subscriber init_pose_sub
Definition: mobile_robot_simulator.h:70
MobileRobotSimulator::start
void start()
Definition: mobile_robot_simulator.cpp:49
MobileRobotSimulator::update_odom_from_vel
void update_odom_from_vel(geometry_msgs::Twist vel, ros::Duration time_diff)
Definition: mobile_robot_simulator.cpp:84
MobileRobotSimulator::last_update
ros::Time last_update
Definition: mobile_robot_simulator.h:60
MobileRobotSimulator::MobileRobotSimulator
MobileRobotSimulator(ros::NodeHandle *nh)
Definition: mobile_robot_simulator.cpp:5
ros::Duration
MobileRobotSimulator::odometry_topic
std::string odometry_topic
Definition: mobile_robot_simulator.h:75
ros::Timer
Transform.h
ros::NodeHandle
ros::Subscriber
MobileRobotSimulator
Definition: mobile_robot_simulator.h:17
MobileRobotSimulator::odom_trans
tf::StampedTransform odom_trans
Definition: mobile_robot_simulator.h:56


mobile_robot_simulator
Author(s): Mikkel Rath Pedersen
autogenerated on Thu Jun 2 2022 02:16:58