4242#include < angles/angles.h>
4343#include < cmath>
4444#include < moveit/trajectory_processing/time_optimal_trajectory_generation.h>
45- #include < ros/console.h>
4645#include < vector>
47-
46+ # include " rclcpp/rclcpp.hpp "
4847#include < iostream>
4948
5049namespace trajectory_processing
5150{
52- const std::string LOGNAME = " trajectory_processing.time_optimal_trajectory_generation" ;
51+ rclcpp::Logger logger_trajectory_processing_optimal = rclcpp::get_logger( " trajectory_processing.time_optimal_trajectory_generation" ) ;
5352constexpr double EPS = 0.000001 ;
5453class LinearPathSegment : public PathSegment
5554{
@@ -553,7 +552,7 @@ bool Trajectory::integrateForward(std::list<TrajectoryStep>& trajectory, double
553552 else if (path_vel < 0.0 )
554553 {
555554 valid_ = false ;
556- ROS_ERROR_NAMED (LOGNAME , " Error while integrating forward: Negative path velocity" );
555+ RCLCPP_ERROR (logger_trajectory_processing_optimal , " Error while integrating forward: Negative path velocity" );
557556 return true ;
558557 }
559558
@@ -650,7 +649,7 @@ void Trajectory::integrateBackward(std::list<TrajectoryStep>& start_trajectory,
650649 if (path_vel < 0.0 )
651650 {
652651 valid_ = false ;
653- ROS_ERROR_NAMED (LOGNAME , " Error while integrating backward: Negative path velocity" );
652+ RCLCPP_ERROR (logger_trajectory_processing_optimal , " Error while integrating backward: Negative path velocity" );
654653 end_trajectory_ = trajectory;
655654 return ;
656655 }
@@ -679,7 +678,7 @@ void Trajectory::integrateBackward(std::list<TrajectoryStep>& start_trajectory,
679678 }
680679
681680 valid_ = false ;
682- ROS_ERROR_NAMED (LOGNAME , " Error while integrating backward: Did not hit start trajectory" );
681+ RCLCPP_ERROR (logger_trajectory_processing_optimal , " Error while integrating backward: Did not hit start trajectory" );
683682 end_trajectory_ = trajectory;
684683}
685684
@@ -880,7 +879,7 @@ bool TimeOptimalTrajectoryGeneration::computeTimeStamps(robot_trajectory::RobotT
880879 const robot_model::JointModelGroup* group = trajectory.getGroup ();
881880 if (!group)
882881 {
883- ROS_ERROR_NAMED (LOGNAME , " It looks like the planner did not set the group the plan was computed for" );
882+ RCLCPP_ERROR (logger_trajectory_processing_optimal , " It looks like the planner did not set the group the plan was computed for" );
884883 return false ;
885884 }
886885
@@ -892,12 +891,12 @@ bool TimeOptimalTrajectoryGeneration::computeTimeStamps(robot_trajectory::RobotT
892891 }
893892 else if (max_velocity_scaling_factor == 0.0 )
894893 {
895- ROS_DEBUG_NAMED (LOGNAME , " A max_velocity_scaling_factor of 0.0 was specified, defaulting to %f instead." ,
894+ RCLCPP_DEBUG (logger_trajectory_processing_optimal , " A max_velocity_scaling_factor of 0.0 was specified, defaulting to %f instead." ,
896895 velocity_scaling_factor);
897896 }
898897 else
899898 {
900- ROS_WARN_NAMED (LOGNAME , " Invalid max_velocity_scaling_factor %f specified, defaulting to %f instead." ,
899+ RCLCPP_WARN (logger_trajectory_processing_optimal , " Invalid max_velocity_scaling_factor %f specified, defaulting to %f instead." ,
901900 max_velocity_scaling_factor, velocity_scaling_factor);
902901 }
903902
@@ -908,12 +907,12 @@ bool TimeOptimalTrajectoryGeneration::computeTimeStamps(robot_trajectory::RobotT
908907 }
909908 else if (max_acceleration_scaling_factor == 0.0 )
910909 {
911- ROS_DEBUG_NAMED (LOGNAME , " A max_acceleration_scaling_factor of 0.0 was specified, defaulting to %f instead." ,
910+ RCLCPP_DEBUG (logger_trajectory_processing_optimal , " A max_acceleration_scaling_factor of 0.0 was specified, defaulting to %f instead." ,
912911 acceleration_scaling_factor);
913912 }
914913 else
915914 {
916- ROS_WARN_NAMED (LOGNAME , " Invalid max_acceleration_scaling_factor %f specified, defaulting to %f instead." ,
915+ RCLCPP_WARN (logger_trajectory_processing_optimal , " Invalid max_acceleration_scaling_factor %f specified, defaulting to %f instead." ,
917916 max_acceleration_scaling_factor, acceleration_scaling_factor);
918917 }
919918
@@ -974,7 +973,7 @@ bool TimeOptimalTrajectoryGeneration::computeTimeStamps(robot_trajectory::RobotT
974973 // Return trajectory with only the first waypoint if there are not multiple diverse points
975974 if (points.size () == 1 )
976975 {
977- ROS_WARN_NAMED (LOGNAME , " Trajectory is not being parameterized since it only contains a single distinct waypoint." );
976+ RCLCPP_WARN (logger_trajectory_processing_optimal , " Trajectory is not being parameterized since it only contains a single distinct waypoint." );
978977 robot_state::RobotState waypoint = robot_state::RobotState (trajectory.getWayPoint (0 ));
979978 trajectory.clear ();
980979 trajectory.addSuffixWayPoint (waypoint, 0.0 );
@@ -985,7 +984,7 @@ bool TimeOptimalTrajectoryGeneration::computeTimeStamps(robot_trajectory::RobotT
985984 Trajectory parameterized (Path (points, path_tolerance_), max_velocity, max_acceleration, 0.001 );
986985 if (!parameterized.isValid ())
987986 {
988- ROS_ERROR_NAMED (LOGNAME , " Unable to parameterize trajectory." );
987+ RCLCPP_ERROR (logger_trajectory_processing_optimal , " Unable to parameterize trajectory." );
989988 return false ;
990989 }
991990
0 commit comments