Skip to content

Commit

Permalink
fixing tf warnign for ground truth mode (nasa#454)
Browse files Browse the repository at this point in the history
* fixing tf warnign for ground truth mode

* adding header
  • Loading branch information
marinagmoreira authored Mar 16, 2022
1 parent 5e49689 commit 8706c4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class GroundTruthLocalizerNodelet : public ff_util::FreeFlyerNodelet {
void PublishLocState(const localization_common::Time& timestamp);

std::string platform_name_;
ros::Time last_time_;
boost::optional<Eigen::Isometry3d> pose_;
boost::optional<Twist> twist_;
int input_mode_ = ff_msgs::SetEkfInputRequest::MODE_TRUTH;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ void GroundTruthLocalizerNodelet::PublishLocState(const lc::Time& timestamp) {

// Also publish world_T_body TF
const auto world_T_body_tf = lc::PoseToTF(*pose_, "world", "body", timestamp, platform_name_);

// If the rate is higher than the sim time, prevent repeated timestamps
if (world_T_body_tf.header.stamp == last_time_) return;
last_time_ = world_T_body_tf.header.stamp;

transform_pub_.sendTransform(world_T_body_tf);
}
} // namespace ground_truth_localizer
Expand Down

0 comments on commit 8706c4f

Please sign in to comment.