30 data_ = boost::circular_buffer<geometry_msgs::TwistStamped>(2);
71 data_.push_back(*msg);
76 geometry_msgs::Vector3 orientation;
77 orientation.x = (
data_[0].twist.angular.x+
data_[1].twist.angular.x) * duration * 0.5;
78 orientation.y = (
data_[0].twist.angular.y+
data_[1].twist.angular.y) * duration * 0.5;
79 orientation.z = (
data_[0].twist.angular.z+
data_[1].twist.angular.z) * duration * 0.5;
80 geometry_msgs::Quaternion twist_angular_quat =
83 Eigen::Vector3d trans_vec;
84 trans_vec(0) = (
data_[0].twist.linear.x+
data_[1].twist.linear.x) * duration * 0.5;
85 trans_vec(1) = (
data_[0].twist.linear.y+
data_[1].twist.linear.y) * duration * 0.5;
86 trans_vec(2) = (
data_[0].twist.linear.z+
data_[1].twist.linear.z) * duration * 0.5;
88 trans_vec = rotation_mat*trans_vec;
94 geometry_msgs::TransformStamped transform_stamped;
111 geometry_msgs::PoseStamped tmp_tf_stamped;
115 geometry_msgs::PoseStamped odom_to_map;
121 ROS_WARN(
"Failed to subtract base to odom transform");
124 geometry_msgs::TransformStamped tmp_tf_stamped;
Definition of the OdomFramePublisher Class.
geometry_msgs::Quaternion convertEulerAngleToQuaternion(geometry_msgs::Vector3 euler)
std::string robot_frame_id_
void publish(const boost::shared_ptr< M > &message) const
tf2_ros::TransformBroadcaster broadcaster_
void setUsingDedicatedThread(bool value)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
ros::Subscriber current_pose_sub_
std::string map_frame_id_
std::string odom_frame_id_
geometry_msgs::PoseStamped current_pose_
ros::Publisher odom_pose_pub_
OdomFramePublisher(ros::NodeHandle nh, ros::NodeHandle pnh)
Constructor of the OdomFramePublisher Class.
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
std::string current_twist_topic_
geometry_msgs::Quaternion rotation(geometry_msgs::Quaternion from, geometry_msgs::Quaternion rotation)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
boost::circular_buffer< geometry_msgs::TwistStamped > data_
bool current_pose_recieved_
ros::Subscriber current_twist_sub_
void currentPoseCallback(const geometry_msgs::PoseStamped::ConstPtr msg)
ROS callback function for the current pose topic.
void currentTwistCallback(const geometry_msgs::TwistStamped::ConstPtr msg)
ROS callback function for the current tiwst topic.
void convert(const A &a, B &b)
T & transform(const T &in, T &out, const std::string &target_frame, ros::Duration timeout=ros::Duration(0.0)) const
~OdomFramePublisher()
Destructor of the OdomFramePublisher class.
geometry_msgs::PoseStamped current_odom_pose_
std::string current_pose_topic_
Eigen::Matrix3d getRotationMatrix(geometry_msgs::Quaternion quat)