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
MobileRobotSimulator(ros::NodeHandle *nh)
tf::StampedTransform odom_trans
void update_odom_from_vel(geometry_msgs::Twist vel, ros::Duration time_diff)
tf::StampedTransform map_trans
void get_tf_from_odom(nav_msgs::Odometry odom)
tf::TransformBroadcaster tf_broadcaster
void init_pose_callback(const geometry_msgs::PoseWithCovarianceStamped::ConstPtr &msg)
void update_loop(const ros::TimerEvent &event)
void vel_callback(const geometry_msgs::Twist::ConstPtr &msg)


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