3838 * @author Jaeyoung Lim <[email protected] > 3939 */
4040
41- #include < geometry_msgs/Point.h >
42- #include < ros/ros.h >
41+ #include < geometry_msgs/msg/point.hpp >
42+ #include < rclcpp/rclcpp.hpp >
4343#include < terrain_navigation/terrain_map.h>
4444#include < tf2/LinearMath/Quaternion.h>
4545#include < tf2_eigen/tf2_eigen.h>
4646#include < tf2_geometry_msgs/tf2_geometry_msgs.h>
47- #include < visualization_msgs/MarkerArray.h >
47+ #include < visualization_msgs/msg/marker.hpp >
4848
4949#include < any>
5050#include < grid_map_ros/GridMapRosConverter.hpp>
5454#include " terrain_planner/terrain_ompl_rrt.h"
5555#include " terrain_planner/visualization.h"
5656
57- void publishCircleSetpoints (const ros::Publisher& pub, const Eigen::Vector3d& position, const double radius) {
57+ void publishCircleSetpoints (rclcpp::Publisher<visualization_msgs::msg::Marker>::SharedPtr pub,
58+ const Eigen::Vector3d& position, const double radius) {
5859 visualization_msgs::msg::Marker marker;
5960 marker.header .stamp = rclcpp::Clock ().now ();
6061 marker.type = visualization_msgs::msg::Marker::LINE_STRIP;
6162 marker.action = visualization_msgs::msg::Marker::ADD;
6263 marker.header .frame_id = " map" ;
6364 marker.id = 0 ;
6465 marker.header .stamp = rclcpp::Clock ().now ();
65- std::vector<geometry_msgs::Point> points;
66+ std::vector<geometry_msgs::msg:: Point> points;
6667 for (double t = 0.0 ; t <= 1.0 ; t += 0.02 ) {
67- geometry_msgs::Point point;
68+ geometry_msgs::msg:: Point point;
6869 point.x = position.x () + radius * std::cos (t * 2 * M_PI);
6970 point.y = position.y () + radius * std::sin (t * 2 * M_PI);
7071 point.z = position.z ();
7172 points.push_back (point);
7273 }
73- geometry_msgs::Point start_point;
74+ geometry_msgs::msg:: Point start_point;
7475 start_point.x = position.x () + radius * std::cos (0.0 );
7576 start_point.y = position.y () + radius * std::sin (0.0 );
7677 start_point.z = position.z ();
@@ -88,7 +89,7 @@ void publishCircleSetpoints(const ros::Publisher& pub, const Eigen::Vector3d& po
8889 marker.pose .orientation .x = 0.0 ;
8990 marker.pose .orientation .y = 0.0 ;
9091 marker.pose .orientation .z = 0.0 ;
91- pub. publish (marker);
92+ pub-> publish (marker);
9293}
9394
9495void getDubinsShortestPath (std::shared_ptr<fw_planning::spaces::DubinsAirplaneStateSpace>& dubins_ss,
@@ -143,9 +144,7 @@ PathSegment getLoiterPath(Eigen::Vector3d end_position, Eigen::Vector3d end_velo
143144}
144145
145146int main (int argc, char ** argv) {
146- ros::init (argc, argv, " ompl_rrt_planner" );
147- ros::NodeHandle nh (" " );
148- ros::NodeHandle nh_private (" ~" );
147+ rclcpp::init (argc, argv);
149148
150149 // Initialize ROS related publishers for visualization
151150 auto start_pos_pub = nh.advertise <visualization_msgs::msg::Marker>(" start_position" , 1 , true );
@@ -248,7 +247,7 @@ int main(int argc, char** argv) {
248247 std::string output_file_path = output_directory + " /" + location + " _planned_path.csv" ;
249248 data_logger->writeToFile (output_file_path);
250249
251- ros::Duration ( 1.0 ). sleep ( );
252- ros::spin ();
250+ rclcpp::spin (ompl_rrt_planner );
251+ rclcpp::shutdown ();
253252 return 0 ;
254253}
0 commit comments