Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit TF_REPEATED_DATA messages by checking for repeated transforms #1097

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions SubjuGator/simulation/subjugator_gazebo/urdf/sub8.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
<xacro:include filename="$(find mil_gazebo)/xacro/passive_sonar.xacro"/>
<xacro:include filename="$(find mil_gazebo)/xacro/inclinometer.xacro"/>

<link name="world"/>

<!-- Base link of sub -->
<link name="base_link">
<inertial>
Expand All @@ -33,11 +31,6 @@
</collision>
</link>

<joint name="dummy_joint" type="fixed">
<parent link="world"/>
<child link="base_link"/>
</joint>

<!-- Sensors -->
<xacro:mil_fixed_link name="front_stereo" parent="base_link" xyz="0.2559 0 0.1707" rpy="0 0 0"/>
<xacro:mil_camera name="front_left_cam" parent="front_stereo" namespace="/camera/front/left" xyz="0 0.0445 0" rpy="0 0 0"/>
Expand Down
8 changes: 8 additions & 0 deletions mil_common/gnc/odometry_utils/src/odometry_to_tf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#include <tf/transform_broadcaster.h>
#include <tf/transform_datatypes.h>

#include <map>
#include <pluginlib/class_list_macros.hpp>
#include <string>

namespace odometry_utils
{
Expand All @@ -13,11 +15,17 @@ class odometry_to_tf : public nodelet::Nodelet
private:
ros::Subscriber odom_sub;
tf::TransformBroadcaster tf_br;
std::map<std::string, ros::Time> _last_tf_stamps;

void handle_odom(const nav_msgs::Odometry::ConstPtr& msg)
{
tf::Transform transform;
poseMsgToTF(msg->pose.pose, transform);
if (_last_tf_stamps.count(msg->header.frame_id) && _last_tf_stamps[msg->header.frame_id] <= msg->header.stamp)
{
return;
}
_last_tf_stamps[msg->header.frame_id] = msg->header.stamp;
tf::StampedTransform stamped_transform(transform, msg->header.stamp, msg->header.frame_id, msg->child_frame_id);
tf_br.sendTransform(stamped_transform);
}
Expand Down
Loading