Skip to content

Commit 0ab0ed4

Browse files
committed
Improve navstate print including the time
Signed-off-by: Francisco Martín Rico <fmrico@gmail.com>
1 parent a6736cb commit 0ab0ed4

9 files changed

Lines changed: 12 additions & 40 deletions

File tree

localizers/easynav_costmap_localizer/src/easynav_costmap_localizer/AMCLLocalizer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ AMCLLocalizer::AMCLLocalizer()
177177
double roll, pitch, yaw;
178178
tf2::Matrix3x3(q).getRPY(roll, pitch, yaw);
179179

180-
ret << "Odometry with pose: (x: " << x << ", y: " << y << ", yaw: " << yaw << ")";
180+
ret << "{" << rclcpp::Time(odom.header.stamp).seconds() << " } Odometry with pose: (x: " <<
181+
x << ", y: " << y << ", yaw: " << yaw << ")";
181182
return ret.str();
182183
});
183184
}

localizers/easynav_navmap_localizer/src/easynav_navmap_localizer/AMCLLocalizer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ AMCLLocalizer::AMCLLocalizer()
357357
tf2::Quaternion q(odom.pose.pose.orientation.x, odom.pose.pose.orientation.y,
358358
odom.pose.pose.orientation.z, odom.pose.pose.orientation.w);
359359
double r, p, y; tf2::Matrix3x3(q).getRPY(r, p, y);
360-
ret << "Odometry with pose: (x: " << odom.pose.pose.position.x
360+
ret << "{" << rclcpp::Time(odom.header.stamp).seconds() << "} Odometry with pose: (x: " <<
361+
odom.pose.pose.position.x
361362
<< ", y: " << odom.pose.pose.position.y << ", yaw: " << y << ")";
362363
return ret.str();
363364
});

localizers/easynav_simple_localizer/src/easynav_simple_localizer/AMCLLocalizer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ AMCLLocalizer::AMCLLocalizer()
175175
double roll, pitch, yaw;
176176
tf2::Matrix3x3(q).getRPY(roll, pitch, yaw);
177177

178-
ret << "Odometry with pose: (x: " << x << ", y: " << y << ", yaw: " << yaw << ")";
178+
ret << "{" << rclcpp::Time(odom.header.stamp).seconds() << "} Odometry with pose: (x: " <<
179+
x << ", y: " << y << ", yaw: " << yaw << ")";
179180
return ret.str();
180181
});
181182
}

maps_managers/easynav_costmap_maps_manager/tests/costmap_mapsmanager_tests.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,6 @@ class CostmapMapsManagerTest : public ::testing::Test
1919
void SetUp() override
2020
{
2121
rclcpp::init(0, nullptr);
22-
easynav::NavState::register_printer<easynav::PointPerceptions>(
23-
[](const easynav::PointPerceptions & perceptions) {
24-
std::ostringstream ret;
25-
ret << "PointPerception " << perceptions.size() << " with:\n";
26-
for (const auto & perception : perceptions) {
27-
ret << "\t[" << static_cast<const void *>(perception.get()) << "] --> "
28-
<< perception->data.size() << " points in frame [" << perception->frame_id
29-
<< "] with ts " << perception->stamp.seconds() << "\n";
30-
}
31-
return ret.str();
32-
});
3322
}
3423

3524
void TearDown() override

maps_managers/easynav_navmap_maps_manager/tests/navmap_mapsmanager_tests.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,6 @@ class NavMapMapsManagerTest : public ::testing::Test
2222
void SetUp() override
2323
{
2424
rclcpp::init(0, nullptr);
25-
::easynav::NavState::register_printer<easynav::PointPerceptions>(
26-
[](const easynav::PointPerceptions & perceptions) {
27-
std::ostringstream ret;
28-
ret << "PointPerception " << perceptions.size() << " with:\n";
29-
for (const auto & perception : perceptions) {
30-
ret << "\t[" << static_cast<const void *>(perception.get()) << "] --> "
31-
<< perception->data.size() << " points in frame [" << perception->frame_id
32-
<< "] with ts " << perception->stamp.seconds() << "\n";
33-
}
34-
return ret.str();
35-
});
3625
}
3726

3827
void TearDown() override

maps_managers/easynav_simple_maps_manager/tests/simple_mapsmanager_tests.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,6 @@ class SimpleMapsManagerTest : public ::testing::Test
4040
void SetUp() override
4141
{
4242
rclcpp::init(0, nullptr);
43-
44-
easynav::NavState::register_printer<easynav::PointPerceptions>(
45-
[](const easynav::PointPerceptions & perceptions) {
46-
std::ostringstream ret;
47-
ret << "PointPerception " << perceptions.size() << " with:\n";
48-
for (const auto & perception : perceptions) {
49-
ret << "\t[" << static_cast<const void *>(perception.get()) << "] --> "
50-
<< perception->data.size() << " points in frame [" << perception->frame_id
51-
<< "] with ts " << perception->stamp.seconds() << "\n";
52-
}
53-
return ret.str();
54-
});
5543
}
5644

5745
void TearDown() override

planners/easynav_costmap_planner/src/easynav_costmap_planner/CostmapPlanner.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ CostmapPlanner::CostmapPlanner()
117117
NavState::register_printer<nav_msgs::msg::Path>(
118118
[](const nav_msgs::msg::Path & path) {
119119
std::ostringstream ret;
120-
ret << "Path with " << path.poses.size() << " poses and length "
120+
ret << "{ " << rclcpp::Time(path.header.stamp).seconds() << " } Path with " <<
121+
path.poses.size() << " poses and length "
121122
<< compute_path_length(path) << " m.";
122123
return ret.str();
123124
});

planners/easynav_navmap_planner/src/easynav_navmap_planner/AStarPlanner.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ AStarPlanner::AStarPlanner()
5656
NavState::register_printer<nav_msgs::msg::Path>(
5757
[](const nav_msgs::msg::Path & path) {
5858
std::ostringstream ret;
59-
ret << "Path with " << path.poses.size() << " poses and length "
59+
ret << "{ " << rclcpp::Time(path.header.stamp).seconds() << " } Path with " <<
60+
path.poses.size() << " poses and length "
6061
<< compute_path_length(path) << " m.";
6162
return ret.str();
6263
});

planners/easynav_simple_planner/src/easynav_simple_planner/SimplePlanner.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ SimplePlanner::SimplePlanner()
7979
[](const nav_msgs::msg::Path & path) {
8080
std::ostringstream ret;
8181

82-
ret << "Path with " << path.poses.size() << " poses and length" <<
82+
ret << "{ " << rclcpp::Time(path.header.stamp).seconds() << " } Path with " <<
83+
path.poses.size() << " poses and length " <<
8384
compute_path_length(path) << " m.";
8485

8586
return ret.str();

0 commit comments

Comments
 (0)