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

nav2_util::duration_from_seconds -> rclcpp::Duration::from_seconds #1048

Merged
merged 2 commits into from
Aug 20, 2019
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
1 change: 0 additions & 1 deletion nav2_amcl/src/amcl_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

#include "message_filters/subscriber.h"
#include "nav2_util/angleutils.hpp"
#include "nav2_util/duration_conversions.hpp"
#include "nav2_util/pf/pf.hpp"
#include "nav2_util/string_utils.hpp"
#include "nav2_util/sensors/laser/laser.hpp"
Expand Down
3 changes: 1 addition & 2 deletions nav2_costmap_2d/plugins/obstacle_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@

#include "pluginlib/class_list_macros.hpp"
#include "sensor_msgs/point_cloud2_iterator.hpp"
#include "nav2_util/duration_conversions.hpp"
#include "nav2_costmap_2d/costmap_math.hpp"

PLUGINLIB_EXPORT_CLASS(nav2_costmap_2d::ObstacleLayer, nav2_costmap_2d::Layer)
Expand Down Expand Up @@ -212,7 +211,7 @@ void ObstacleLayer::onInitialize()
observation_subscribers_.push_back(sub);

observation_notifiers_.push_back(filter);
observation_notifiers_.back()->setTolerance(nav2_util::duration_from_seconds(0.05));
observation_notifiers_.back()->setTolerance(rclcpp::Duration::from_seconds(0.05));

} else {
std::shared_ptr<message_filters::Subscriber<sensor_msgs::msg::PointCloud2>> sub(
Expand Down
3 changes: 1 addition & 2 deletions nav2_costmap_2d/src/costmap_2d_ros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include <vector>

#include "nav2_costmap_2d/layered_costmap.hpp"
#include "nav2_util/duration_conversions.hpp"
#include "nav2_util/execution_timer.hpp"
#include "tf2_geometry_msgs/tf2_geometry_msgs.h"
#include "tf2_ros/create_timer_ros.h"
Expand Down Expand Up @@ -299,7 +298,7 @@ Costmap2DROS::getParameters()

// 2. The map publish frequency cannot be 0 (to avoid a divde-by-zero)
if (map_publish_frequency_ > 0) {
publish_cycle_ = nav2_util::duration_from_seconds(1 / map_publish_frequency_);
publish_cycle_ = rclcpp::Duration::from_seconds(1 / map_publish_frequency_);
} else {
publish_cycle_ = rclcpp::Duration(-1);
}
Expand Down
1 change: 0 additions & 1 deletion nav2_costmap_2d/test/integration/costmap_tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "tf2_ros/transform_listener.h"
#include "nav2_costmap_2d/costmap_2d_ros.hpp"
#include "nav2_costmap_2d/cost_values.hpp"
#include "nav2_util/duration_conversions.hpp"

namespace nav2_costmap_2d
{
Expand Down
3 changes: 1 addition & 2 deletions nav2_dwb_controller/dwb_controller/src/progress_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "dwb_controller/progress_checker.hpp"
#include <cmath>
#include "dwb_core/exceptions.hpp"
#include "nav2_util/duration_conversions.hpp"

namespace dwb_controller
{
Expand All @@ -28,7 +27,7 @@ ProgressChecker::ProgressChecker(const rclcpp::Node::SharedPtr & node)
nh_->get_parameter_or("required_movement_radius", radius_, 0.5);
double time_allowance_param;
nh_->get_parameter_or("movement_time_allowance_", time_allowance_param, 10.0);
time_allowance_ = nav2_util::duration_from_seconds(time_allowance_param);
time_allowance_ = rclcpp::Duration::from_seconds(time_allowance_param);
}

void ProgressChecker::check(nav_2d_msgs::msg::Pose2DStamped & current_pose)
Expand Down
3 changes: 1 addition & 2 deletions nav2_dwb_controller/dwb_core/src/dwb_local_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
#include "nav_2d_utils/tf_help.hpp"
#include "nav2_util/lifecycle_node.hpp"
#include "pluginlib/class_list_macros.hpp"
#include "nav2_util/duration_conversions.hpp"

namespace dwb_core
{
Expand Down Expand Up @@ -83,7 +82,7 @@ DWBLocalPlanner::on_configure(const rclcpp_lifecycle::State & state)

double transform_tolerance;
node_->get_parameter("transform_tolerance", transform_tolerance);
transform_tolerance_ = nav2_util::duration_from_seconds(transform_tolerance);
transform_tolerance_ = rclcpp::Duration::from_seconds(transform_tolerance);
RCLCPP_INFO(node_->get_logger(), "Setting transform_tolerance to %f", transform_tolerance);

node_->get_parameter("prune_plan", prune_plan_);
Expand Down
5 changes: 2 additions & 3 deletions nav2_dwb_controller/dwb_critics/src/oscillation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include <cmath>
#include <string>
#include <vector>
#include "nav2_util/duration_conversions.hpp"
#include "nav_2d_utils/parameters.hpp"
#include "dwb_core/exceptions.hpp"
#include "pluginlib/class_list_macros.hpp"
Expand Down Expand Up @@ -94,7 +93,7 @@ void OscillationCritic::onInit()
oscillation_reset_dist_ = nav_2d_utils::searchAndGetParam(nh_, "oscillation_reset_dist", 0.05);
oscillation_reset_dist_sq_ = oscillation_reset_dist_ * oscillation_reset_dist_;
oscillation_reset_angle_ = nav_2d_utils::searchAndGetParam(nh_, "oscillation_reset_angle", 0.2);
oscillation_reset_time_ = nav2_util::duration_from_seconds(
oscillation_reset_time_ = rclcpp::Duration::from_seconds(
nav_2d_utils::searchAndGetParam(nh_, "oscillation_reset_time", -1.0));

nh_->declare_parameter(name_ + ".x_only_threshold", rclcpp::ParameterValue(0.05));
Expand Down Expand Up @@ -174,7 +173,7 @@ bool OscillationCritic::resetAvailable()
return true;
}
}
if (oscillation_reset_time_ >= nav2_util::duration_from_seconds(0.0)) {
if (oscillation_reset_time_ >= rclcpp::Duration::from_seconds(0.0)) {
auto t_diff = (nh_->now() - prev_reset_time_);
if (t_diff > oscillation_reset_time_) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "nav_2d_utils/parameters.hpp"
#include "pluginlib/class_list_macros.hpp"
#include "dwb_core/exceptions.hpp"
#include "nav2_util/duration_conversions.hpp"

namespace dwb_plugins
{
Expand Down Expand Up @@ -87,7 +86,7 @@ dwb_msgs::msg::Trajectory2D LimitedAccelGenerator::generateTrajectory(
{
dwb_msgs::msg::Trajectory2D traj;
traj.velocity = cmd_vel;
traj.duration = nav2_util::duration_from_seconds(sim_time_);
traj.duration = rclcpp::Duration::from_seconds(sim_time_);
geometry_msgs::msg::Pose2D pose = start_pose;

std::vector<double> steps = getTimeSteps(cmd_vel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "nav_2d_utils/parameters.hpp"
#include "pluginlib/class_list_macros.hpp"
#include "dwb_core/exceptions.hpp"
#include "nav2_util/duration_conversions.hpp"

using nav_2d_utils::loadParameterWithDeprecation;

Expand Down Expand Up @@ -148,7 +147,7 @@ dwb_msgs::msg::Trajectory2D StandardTrajectoryGenerator::generateTrajectory(
{
dwb_msgs::msg::Trajectory2D traj;
traj.velocity = cmd_vel;
traj.duration = nav2_util::duration_from_seconds(sim_time_);
traj.duration = rclcpp::Duration::from_seconds(sim_time_);
// simulate the trajectory
geometry_msgs::msg::Pose2D pose = start_pose;
nav_2d_msgs::msg::Twist2D vel = start_vel;
Expand Down
32 changes: 0 additions & 32 deletions nav2_util/include/nav2_util/duration_conversions.hpp

This file was deleted.