Skip to content

Commit bf556b2

Browse files
authored
Merge pull request #251 from fmessmer/melodic/TF_REPEATED_DATA
[melodic] add check and logs for TF_REPEATED_DATA
2 parents 58b6588 + 6b5ac7a commit bf556b2

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

cob_omni_drive_controller/src/odom_plugin.cpp

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -132,24 +132,35 @@ class OdometryController: public GeomController<hardware_interface::JointStateIn
132132
ros::Time stop_time_;
133133

134134

135-
void publish(const ros::TimerEvent&){
135+
void publish(const ros::TimerEvent& event){
136136
if(!isRunning()) return;
137137

138138
boost::mutex::scoped_lock lock(mutex_);
139139

140140
topic_pub_odometry_.publish(odom_);
141141

142142
if(tf_broadcast_odometry_){
143-
// compose and publish transform for tf package
144-
// compose header
145-
odom_tf_.header.stamp = odom_.header.stamp;
146-
// compose data container
147-
odom_tf_.transform.translation.x = odom_.pose.pose.position.x;
148-
odom_tf_.transform.translation.y = odom_.pose.pose.position.y;
149-
odom_tf_.transform.rotation = odom_.pose.pose.orientation;
150-
151-
// publish the transform (for debugging, conflicts with robot-pose-ekf)
152-
tf_broadcast_odometry_->sendTransform(odom_tf_);
143+
// check prevents TF_REPEATED_DATA warning
144+
if (odom_tf_.header.stamp == odom_.header.stamp){
145+
// ROS_WARN_STREAM("OdometryController: already published odom_tf before");
146+
// ROS_WARN_STREAM("\todom_tf: " << odom_tf_);
147+
// ROS_WARN_STREAM("\todom_: " << odom_);
148+
// ROS_WARN_STREAM("\tevent.last_expected: " << event.last_expected);
149+
// ROS_WARN_STREAM("\tevent.last_real: " << event.last_real);
150+
// ROS_WARN_STREAM("\tevent.current_expected: " << event.current_expected);
151+
// ROS_WARN_STREAM("\tevent.current_real: " << event.current_real);
152+
} else {
153+
// compose and publish transform for tf package
154+
// compose header
155+
odom_tf_.header.stamp = odom_.header.stamp;
156+
// compose data container
157+
odom_tf_.transform.translation.x = odom_.pose.pose.position.x;
158+
odom_tf_.transform.translation.y = odom_.pose.pose.position.y;
159+
odom_tf_.transform.rotation = odom_.pose.pose.orientation;
160+
161+
// publish the transform (for debugging, conflicts with robot-pose-ekf)
162+
tf_broadcast_odometry_->sendTransform(odom_tf_);
163+
}
153164
}
154165
}
155166
};

0 commit comments

Comments
 (0)