File tree Expand file tree Collapse file tree
easynav_serest_controller/src/easynav_serest_controller
easynav_simple_controller/src/easynav_simple_controller
easynav_costmap_planner/src/easynav_costmap_planner
easynav_simple_planner/src/easynav_simple_planner Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -309,8 +309,14 @@ SerestController::closest_obstacle_distance(
309309 .downsample (0.3 );
310310 const auto & fused = view.as_points ();
311311
312- if (last_input_ts_ < view.get_latest_stamp ()) {
313- last_input_ts_ = view.get_latest_stamp ();
312+ {
313+ const auto view_latest = view.get_latest_stamp ();
314+ const rclcpp::Time view_latest_same_clock (
315+ view_latest.nanoseconds (),
316+ last_input_ts_.get_clock_type ());
317+ if (last_input_ts_ < view_latest_same_clock) {
318+ last_input_ts_ = view_latest_same_clock;
319+ }
314320 }
315321
316322 double min_dist = std::numeric_limits<double >::infinity ();
@@ -378,10 +384,10 @@ SerestController::fetch_required_inputs(
378384 odom = nav_state.get <nav_msgs::msg::Odometry>(" robot_pose" );
379385
380386 if (rclcpp::Time (path.header .stamp , last_input_ts_.get_clock_type ()) > last_input_ts_) {
381- last_input_ts_ = path.header .stamp ;
387+ last_input_ts_ = rclcpp::Time ( path.header .stamp , last_input_ts_. get_clock_type ()) ;
382388 }
383389 if (rclcpp::Time (odom.header .stamp , last_input_ts_.get_clock_type ()) > last_input_ts_) {
384- last_input_ts_ = odom.header .stamp ;
390+ last_input_ts_ = rclcpp::Time ( odom.header .stamp , last_input_ts_. get_clock_type ()) ;
385391 }
386392
387393 if (path.poses .empty ()) {
Original file line number Diff line number Diff line change @@ -111,7 +111,10 @@ SimpleController::update_rt(NavState & nav_state)
111111 const auto & pose = nav_state.get <nav_msgs::msg::Odometry>(" robot_pose" ).pose .pose ;
112112 const auto & goal_pose = path.poses .back ().pose ;
113113
114- rclcpp::Time latest_stamp = nav_state.get <nav_msgs::msg::Odometry>(" robot_pose" ).header .stamp ;
114+ const auto clock_type = get_node ()->get_clock ()->get_clock_type ();
115+ rclcpp::Time latest_stamp (
116+ nav_state.get <nav_msgs::msg::Odometry>(" robot_pose" ).header .stamp ,
117+ clock_type);
115118 if (rclcpp::Time (path.poses .back ().header .stamp ,
116119 latest_stamp.get_clock_type ()) > latest_stamp)
117120 {
Original file line number Diff line number Diff line change @@ -157,12 +157,12 @@ void CostmapPlanner::update(NavState & nav_state)
157157
158158 rclcpp::Time latest_stamp = nav_state.get <rclcpp::Time>(" map_time" );
159159 if (rclcpp::Time (robot_pose.header .stamp , latest_stamp.get_clock_type ()) > latest_stamp) {
160- latest_stamp = robot_pose.header .stamp ;
160+ latest_stamp = rclcpp::Time ( robot_pose.header .stamp , latest_stamp. get_clock_type ()) ;
161161 }
162162 if (rclcpp::Time (goals.goals .front ().header .stamp ,
163163 latest_stamp.get_clock_type ()) > latest_stamp)
164164 {
165- latest_stamp = goals.goals .front ().header .stamp ;
165+ latest_stamp = rclcpp::Time ( goals.goals .front ().header .stamp , latest_stamp. get_clock_type ()) ;
166166 }
167167 current_path_.header .stamp = latest_stamp;
168168
Original file line number Diff line number Diff line change @@ -130,7 +130,8 @@ SimplePlanner::update(NavState & nav_state)
130130 const auto & goal = goals.goals .front ().pose ;
131131 const auto & tf_info = RTTFBuffer::getInstance ()->get_tf_info ();
132132
133- rclcpp::Time latest_stamp = robot_pose.header .stamp ;
133+ const auto clock_type = get_node ()->get_clock ()->get_clock_type ();
134+ rclcpp::Time latest_stamp (robot_pose.header .stamp , clock_type);
134135 if (rclcpp::Time (goals.goals .front ().header .stamp ,
135136 latest_stamp.get_clock_type ()) > latest_stamp)
136137 {
You can’t perform that action at this time.
0 commit comments