Program Listing for File forward_global_planner.hpp

Return to documentation for file (/tmp/ws/src/SMACC2/smacc2_client_library/nav2z_client/custom_planners/forward_global_planner/include/forward_global_planner/forward_global_planner.hpp)

// Copyright 2021 RobosoftAI Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*****************************************************************************************************************
 *
 *   Authors: Pablo Inigo Blasco, Brett Aldrich
 *
 ******************************************************************************************************************/
#pragma once

#include <memory>
#include <string>

#include <nav2_core/global_planner.hpp>
#include <nav_msgs/msg/path.hpp>
#include <rclcpp/rclcpp.hpp>

namespace cl_nav2z
{
namespace forward_global_planner
{
class ForwardGlobalPlanner : public nav2_core::GlobalPlanner
{
public:
  using Ptr = std::shared_ptr<ForwardGlobalPlanner>;

  ForwardGlobalPlanner();

  virtual ~ForwardGlobalPlanner();

  void configure(
    const rclcpp_lifecycle::LifecycleNode::WeakPtr & parent, std::string name,
    const std::shared_ptr<tf2_ros::Buffer> tf,
    const std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros) override;

  virtual void cleanup();

  virtual void activate();

  virtual void deactivate();

  virtual nav_msgs::msg::Path createPlan(
    const geometry_msgs::msg::PoseStamped & start, const geometry_msgs::msg::PoseStamped & goal);

private:
  // rclcpp::Node::SharedPtr nh_;
  rclcpp_lifecycle::LifecycleNode::SharedPtr nh_;

  std::shared_ptr<rclcpp_lifecycle::LifecyclePublisher<nav_msgs::msg::Path>> planPub_;

  std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros_;

  double skip_straight_motion_distance_;  // meters

  double puresSpinningRadStep_;  // rads

  std::string name_;

  double transform_tolerance_;

  std::shared_ptr<tf2_ros::Buffer> tf_;
};
}  // namespace forward_global_planner
}  // namespace cl_nav2z