Skip to content

Commit 83a9827

Browse files
authored
Merge pull request #43 from fmrico/add_footprint_tf
Add a base_footprint frame in TFInfo
2 parents 63aa3e5 + 735468e commit 83a9827

10 files changed

Lines changed: 22 additions & 16 deletions

File tree

controllers/easynav_serest_controller/src/easynav_serest_controller/SerestController.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ SerestController::closest_obstacle_distance(
306306

307307
auto fused = PointPerceptionsOpsView(perceptions)
308308
.downsample(0.3)
309-
.fuse(tf_info.robot_frame)
309+
.fuse(tf_info.robot_footprint_frame)
310310
.filter({-dist_search_radius_, -dist_search_radius_, NAN},
311311
{dist_search_radius_, dist_search_radius_, 2.0})
312312
.collapse({NAN, NAN, 0.1})
@@ -370,7 +370,7 @@ SerestController::fetch_required_inputs(
370370
const auto & tf_info = RTTFBuffer::getInstance()->get_tf_info();
371371

372372
if (!nav_state.has("path") || !nav_state.has("robot_pose") || !nav_state.has("map.dynamic")) {
373-
publish_stop(nav_state, tf_info.robot_frame);
373+
publish_stop(nav_state, tf_info.robot_footprint_frame);
374374
return false;
375375
}
376376

controllers/easynav_simple_controller/tests/simple_controller_tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ TEST_F(AMCLLocalizerTest, SavemapServiceWorks)
148148
tf_info.map_frame = "world_map";
149149
tf_info.odom_frame = "world_odom";
150150
tf_info.robot_frame = "world_base";
151+
tf_info.robot_footprint_frame = "world_footprint_base";
151152
easynav::RTTFBuffer::getInstance()->set_tf_info(tf_info);
152153

153154
manager->initialize(node, "test_savemap");

controllers/easynav_vff_controller/src/easynav_vff_controller/VffController.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void VffController::on_initialize()
6464

6565
// Initialize the odometry message
6666
cmd_vel_.header.stamp = node->now();
67-
cmd_vel_.header.frame_id = tf_info.robot_frame;
67+
cmd_vel_.header.frame_id = tf_info.robot_footprint_frame;
6868
cmd_vel_.twist.linear.x = 0.0;
6969
cmd_vel_.twist.linear.y = 0.0;
7070
cmd_vel_.twist.linear.z = 0.0;
@@ -262,14 +262,14 @@ void VffController::update_rt(NavState & nav_state)
262262
auto fused =
263263
PointPerceptionsOpsView(perceptions)
264264
.filter({-10.0, -10.0, -10.0}, {10.0, 10.0, 10.0})
265-
.fuse(tf_info.robot_frame)
265+
.fuse(tf_info.robot_footprint_frame)
266266
.filter({obstacle_detection_x_min_, obstacle_detection_y_min_, obstacle_detection_z_min_},
267267
{obstacle_detection_x_max_, obstacle_detection_y_max_,
268268
obstacle_detection_z_max_})
269269
.as_points();
270270

271271
// Get VFF vectors
272-
const VFFVectors & vff = get_vff(angle_error, fused, tf_info.robot_frame);
272+
const VFFVectors & vff = get_vff(angle_error, fused, tf_info.robot_footprint_frame);
273273

274274
// Use result vector to calculate output speed
275275
const auto & v = vff.result;

localizers/easynav_costmap_localizer/src/easynav_costmap_localizer/AMCLLocalizer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ AMCLLocalizer::update_odom_from_tf()
488488
geometry_msgs::msg::TransformStamped tf_msg;
489489
try {
490490
tf_msg = RTTFBuffer::getInstance()->lookupTransform(
491-
tf_info.odom_frame, tf_info.robot_frame, tf2::TimePointZero,
491+
tf_info.odom_frame, tf_info.robot_footprint_frame, tf2::TimePointZero,
492492
tf2::durationFromSec(0.0));
493493
} catch (const tf2::TransformException & ex) {
494494
RCLCPP_WARN(get_node()->get_logger(), "AMCLLocalizer::update: TF failed: %s", ex.what());
@@ -585,7 +585,7 @@ AMCLLocalizer::correct(NavState & nav_state)
585585
const auto & tf_info = RTTFBuffer::getInstance()->get_tf_info();
586586
const auto & filtered = PointPerceptionsOpsView(perceptions)
587587
.downsample(map_static.getResolution())
588-
.fuse(tf_info.robot_frame)
588+
.fuse(tf_info.robot_footprint_frame)
589589
.filter({NAN, NAN, 0.1}, {NAN, NAN, NAN})
590590
.collapse({NAN, NAN, 0.1})
591591
.downsample(map_static.getResolution())
@@ -824,7 +824,7 @@ AMCLLocalizer::get_pose()
824824
odom_msg.header.stamp = last_input_time_;
825825
const auto & tf_info = RTTFBuffer::getInstance()->get_tf_info();
826826
odom_msg.header.frame_id = tf_info.map_frame;
827-
odom_msg.child_frame_id = tf_info.robot_frame;
827+
odom_msg.child_frame_id = tf_info.robot_footprint_frame;
828828

829829
tf2::Transform est_pose = getEstimatedPose();
830830

localizers/easynav_fusion_localizer/src/easynav_fusion_localizer/ukf_wrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ void UkfWrapper::loadParams()
893893

894894
map_frame_id_ = tf_info.map_frame;
895895
odom_frame_id_ = tf_info.odom_frame;
896-
base_link_frame_id_ = tf_info.robot_frame;
896+
base_link_frame_id_ = tf_info.robot_footprint_frame;
897897
// World frame comes from Easynav TFInfo configuration
898898
world_frame_id_ = tf_info.map_frame;
899899

localizers/easynav_gps_localizer/src/easynav_gps_localizer/GpsLocalizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void GpsLocalizer::on_initialize()
3535
odom_.header.stamp = get_node()->now();
3636
const auto & tf_info = RTTFBuffer::getInstance()->get_tf_info();
3737
odom_.header.frame_id = tf_info.map_frame;
38-
odom_.child_frame_id = tf_info.robot_frame;
38+
odom_.child_frame_id = tf_info.robot_footprint_frame;
3939

4040
// Create subscriber to GPS data
4141
gps_subscriber_ = node->create_subscription<sensor_msgs::msg::NavSatFix>(
@@ -114,7 +114,7 @@ void GpsLocalizer::update(NavState & nav_state)
114114
odom_.header.stamp = gps_msg_.header.stamp;
115115
const auto & tf_info = RTTFBuffer::getInstance()->get_tf_info();
116116
odom_.header.frame_id = tf_info.map_frame;
117-
odom_.child_frame_id = tf_info.robot_frame;
117+
odom_.child_frame_id = tf_info.robot_footprint_frame;
118118
odom_.pose.pose.position.x = utm_x - origin_utm_.x;
119119
odom_.pose.pose.position.y = utm_y - origin_utm_.y;
120120

localizers/easynav_navmap_localizer/src/easynav_navmap_localizer/AMCLLocalizer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ void AMCLLocalizer::update_odom_from_tf()
485485
geometry_msgs::msg::TransformStamped tf_msg;
486486
try {
487487
tf_msg = RTTFBuffer::getInstance()->lookupTransform(
488-
tf_info.odom_frame, tf_info.robot_frame, tf2::TimePointZero,
488+
tf_info.odom_frame, tf_info.robot_footprint_frame, tf2::TimePointZero,
489489
tf2::durationFromSec(0.0));
490490
} catch (const tf2::TransformException & ex) {
491491
RCLCPP_WARN(get_node()->get_logger(), "TF failed: %s", ex.what());
@@ -747,7 +747,8 @@ void AMCLLocalizer::correct(NavState & nav_state)
747747
if (!T_bf_sensor_cache.count(b.frame_id)) {
748748
const auto & tf_info = RTTFBuffer::getInstance()->get_tf_info();
749749
try {
750-
T_bf_sensor_cache[b.frame_id] = lookup_bf_to_sensor(tf_info.robot_frame, b.frame_id);
750+
T_bf_sensor_cache[b.frame_id] = lookup_bf_to_sensor(tf_info.robot_footprint_frame,
751+
b.frame_id);
751752

752753
// const tf2::Transform & t = T_bf_sensor_cache[b.frame_id];
753754

@@ -1092,7 +1093,7 @@ AMCLLocalizer::get_pose()
10921093
odom_msg.header.stamp = last_input_time_;
10931094
const auto & tf_info = RTTFBuffer::getInstance()->get_tf_info();
10941095
odom_msg.header.frame_id = tf_info.map_frame;
1095-
odom_msg.child_frame_id = tf_info.robot_frame;
1096+
odom_msg.child_frame_id = tf_info.robot_footprint_frame;
10961097

10971098
pose_ = getEstimatedPose();
10981099
tf2::Transform est_pose = pose_;

localizers/easynav_simple_localizer/src/easynav_simple_localizer/AMCLLocalizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ void AMCLLocalizer::correct(NavState & nav_state)
387387
const auto & tf_info = RTTFBuffer::getInstance()->get_tf_info();
388388
const auto & filtered = PointPerceptionsOpsView(perceptions)
389389
.downsample(map_static.resolution())
390-
.fuse(tf_info.robot_frame)
390+
.fuse(tf_info.robot_footprint_frame)
391391
.filter({NAN, NAN, 0.1}, {NAN, NAN, NAN})
392392
.collapse({NAN, NAN, 0.1})
393393
.downsample(map_static.resolution())
@@ -629,7 +629,7 @@ AMCLLocalizer::get_pose()
629629
odom_msg.header.stamp = last_input_time_;
630630
const auto & tf_info = RTTFBuffer::getInstance()->get_tf_info();
631631
odom_msg.header.frame_id = tf_info.map_frame;
632-
odom_msg.child_frame_id = tf_info.robot_frame;
632+
odom_msg.child_frame_id = tf_info.robot_footprint_frame;
633633

634634
tf2::Transform est_pose = getEstimatedPose();
635635

localizers/easynav_simple_localizer/tests/simple_localizer_tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ TEST_F(AMCLLocalizerTest, IncomingOccupancyGridUpdatesMaps)
108108
tf_info.map_frame = "world_map";
109109
tf_info.odom_frame = "world_odom";
110110
tf_info.robot_frame = "world_base";
111+
tf_info.robot_footprint_frame = "world_footprint_base";
111112
easynav::RTTFBuffer::getInstance()->set_tf_info(tf_info);
112113

113114
manager->initialize(node, "test2");

maps_managers/easynav_simple_maps_manager/tests/simple_mapsmanager_tests.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ TEST_F(SimpleMapsManagerTest, BasicDynamicUpdate)
7070
tf_info.map_frame = "world_map";
7171
tf_info.odom_frame = "world_odom";
7272
tf_info.robot_frame = "world_base";
73+
tf_info.robot_footprint_frame = "world_footprint_base";
7374
easynav::RTTFBuffer::getInstance()->set_tf_info(tf_info);
7475

7576
manager->initialize(node, "test");
@@ -134,6 +135,7 @@ TEST_F(SimpleMapsManagerTest, IncomingOccupancyGridUpdatesMaps)
134135
tf_info.map_frame = "world_map";
135136
tf_info.odom_frame = "world_odom";
136137
tf_info.robot_frame = "world_base";
138+
tf_info.robot_footprint_frame = "world_footprint_base";
137139
easynav::RTTFBuffer::getInstance()->set_tf_info(tf_info);
138140

139141
manager->initialize(node, "test2");
@@ -183,6 +185,7 @@ TEST_F(SimpleMapsManagerTest, SavemapServiceWorks)
183185
tf_info.map_frame = "world_map";
184186
tf_info.odom_frame = "world_odom";
185187
tf_info.robot_frame = "world_base";
188+
tf_info.robot_footprint_frame = "world_footprint_base";
186189
easynav::RTTFBuffer::getInstance()->set_tf_info(tf_info);
187190

188191
manager->initialize(node, "test_savemap");

0 commit comments

Comments
 (0)