add humble-navigation2
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(nav2_core)
|
||||
|
||||
find_package(ament_cmake REQUIRED)
|
||||
find_package(nav2_common REQUIRED)
|
||||
find_package(rclcpp REQUIRED)
|
||||
find_package(rclcpp_lifecycle REQUIRED)
|
||||
find_package(std_msgs REQUIRED)
|
||||
find_package(geometry_msgs REQUIRED)
|
||||
find_package(nav2_costmap_2d REQUIRED)
|
||||
find_package(pluginlib REQUIRED)
|
||||
find_package(nav_msgs REQUIRED)
|
||||
find_package(tf2_ros REQUIRED)
|
||||
find_package(nav2_util REQUIRED)
|
||||
find_package(nav_msgs REQUIRED)
|
||||
|
||||
nav2_package()
|
||||
|
||||
set(dependencies
|
||||
rclcpp
|
||||
rclcpp_lifecycle
|
||||
std_msgs
|
||||
geometry_msgs
|
||||
nav2_costmap_2d
|
||||
pluginlib
|
||||
visualization_msgs
|
||||
nav_msgs
|
||||
tf2_ros
|
||||
)
|
||||
|
||||
install(DIRECTORY include/
|
||||
DESTINATION include/
|
||||
)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
find_package(ament_lint_auto REQUIRED)
|
||||
# the following line skips the linter which checks for copyrights
|
||||
set(ament_cmake_copyright_FOUND TRUE)
|
||||
ament_lint_auto_find_test_dependencies()
|
||||
endif()
|
||||
|
||||
ament_export_include_directories(include)
|
||||
ament_export_dependencies(${dependencies})
|
||||
|
||||
ament_package()
|
||||
@@ -0,0 +1,13 @@
|
||||
# Nav2 Core
|
||||
|
||||
This package hosts the abstract interface (virtual base classes) for plugins to be used with the following:
|
||||
- global planner (e.g., `nav2_navfn_planner`)
|
||||
- controller (e.g., path execution controller, e.g `nav2_dwb_controller`)
|
||||
- smoother (e.g., `nav2_ceres_costaware_smoother`)
|
||||
- goal checker (e.g. `simple_goal_checker`)
|
||||
- behaviors (e.g. `drive_on_heading`)
|
||||
- progress checker (e.g. `simple_progress_checker`)
|
||||
- waypoint task executor (e.g. `take_pictures`)
|
||||
- exceptions in planning and control
|
||||
|
||||
The purposes of these plugin interfaces are to create a separation of concern from the system software engineers and the researcher / algorithm designers. Each plugin type is hosted in a "task server" (e.g. planner, recovery, control servers) which handles requests and multiple algorithm plugin instances. The plugins are used to compute a value back to the server without having to worry about ROS 2 actions, topics, or other software utilities. A plugin designer can simply use the tools provided in the API to do their work, or create new ones if they like internally to gain additional information or capabilities.
|
||||
@@ -0,0 +1,72 @@
|
||||
// Copyright (c) 2019 Samsung Research America
|
||||
//
|
||||
// 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.
|
||||
|
||||
#ifndef NAV2_CORE__BEHAVIOR_HPP_
|
||||
#define NAV2_CORE__BEHAVIOR_HPP_
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include "rclcpp/rclcpp.hpp"
|
||||
#include "nav2_util/lifecycle_node.hpp"
|
||||
#include "tf2_ros/buffer.h"
|
||||
#include "nav2_costmap_2d/costmap_topic_collision_checker.hpp"
|
||||
|
||||
namespace nav2_core
|
||||
{
|
||||
|
||||
/**
|
||||
* @class Behavior
|
||||
* @brief Abstract interface for behaviors to adhere to with pluginlib
|
||||
*/
|
||||
class Behavior
|
||||
{
|
||||
public:
|
||||
using Ptr = std::shared_ptr<Behavior>;
|
||||
|
||||
/**
|
||||
* @brief Virtual destructor
|
||||
*/
|
||||
virtual ~Behavior() {}
|
||||
|
||||
/**
|
||||
* @param parent pointer to user's node
|
||||
* @param name The name of this planner
|
||||
* @param tf A pointer to a TF buffer
|
||||
* @param costmap_ros A pointer to the costmap
|
||||
*/
|
||||
virtual void configure(
|
||||
const rclcpp_lifecycle::LifecycleNode::WeakPtr & parent,
|
||||
const std::string & name, std::shared_ptr<tf2_ros::Buffer> tf,
|
||||
std::shared_ptr<nav2_costmap_2d::CostmapTopicCollisionChecker> collision_checker) = 0;
|
||||
|
||||
/**
|
||||
* @brief Method to cleanup resources used on shutdown.
|
||||
*/
|
||||
virtual void cleanup() = 0;
|
||||
|
||||
/**
|
||||
* @brief Method to active Behavior and any threads involved in execution.
|
||||
*/
|
||||
virtual void activate() = 0;
|
||||
|
||||
/**
|
||||
* @brief Method to deactive Behavior and any threads involved in execution.
|
||||
*/
|
||||
virtual void deactivate() = 0;
|
||||
};
|
||||
|
||||
} // namespace nav2_core
|
||||
|
||||
#endif // NAV2_CORE__BEHAVIOR_HPP_
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Copyright (c) 2017, Locus Robotics
|
||||
* Copyright (c) 2019, Intel Corporation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef NAV2_CORE__CONTROLLER_HPP_
|
||||
#define NAV2_CORE__CONTROLLER_HPP_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "nav2_costmap_2d/costmap_2d_ros.hpp"
|
||||
#include "tf2_ros/transform_listener.h"
|
||||
#include "rclcpp/rclcpp.hpp"
|
||||
#include "rclcpp_lifecycle/lifecycle_node.hpp"
|
||||
#include "pluginlib/class_loader.hpp"
|
||||
#include "geometry_msgs/msg/pose_stamped.hpp"
|
||||
#include "geometry_msgs/msg/twist_stamped.hpp"
|
||||
#include "nav_msgs/msg/path.hpp"
|
||||
#include "nav2_core/goal_checker.hpp"
|
||||
|
||||
|
||||
namespace nav2_core
|
||||
{
|
||||
|
||||
/**
|
||||
* @class Controller
|
||||
* @brief controller interface that acts as a virtual base class for all controller plugins
|
||||
*/
|
||||
class Controller
|
||||
{
|
||||
public:
|
||||
using Ptr = std::shared_ptr<nav2_core::Controller>;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Virtual destructor
|
||||
*/
|
||||
virtual ~Controller() {}
|
||||
|
||||
/**
|
||||
* @param parent pointer to user's node
|
||||
* @param costmap_ros A pointer to the costmap
|
||||
*/
|
||||
virtual void configure(
|
||||
const rclcpp_lifecycle::LifecycleNode::WeakPtr &,
|
||||
std::string name, std::shared_ptr<tf2_ros::Buffer>,
|
||||
std::shared_ptr<nav2_costmap_2d::Costmap2DROS>) = 0;
|
||||
|
||||
/**
|
||||
* @brief Method to cleanup resources.
|
||||
*/
|
||||
virtual void cleanup() = 0;
|
||||
|
||||
/**
|
||||
* @brief Method to active planner and any threads involved in execution.
|
||||
*/
|
||||
virtual void activate() = 0;
|
||||
|
||||
/**
|
||||
* @brief Method to deactive planner and any threads involved in execution.
|
||||
*/
|
||||
virtual void deactivate() = 0;
|
||||
|
||||
/**
|
||||
* @brief local setPlan - Sets the global plan
|
||||
* @param path The global plan
|
||||
*/
|
||||
virtual void setPlan(const nav_msgs::msg::Path & path) = 0;
|
||||
|
||||
/**
|
||||
* @brief Controller computeVelocityCommands - calculates the best command given the current pose and velocity
|
||||
*
|
||||
* It is presumed that the global plan is already set.
|
||||
*
|
||||
* This is mostly a wrapper for the protected computeVelocityCommands
|
||||
* function which has additional debugging info.
|
||||
*
|
||||
* @param pose Current robot pose
|
||||
* @param velocity Current robot velocity
|
||||
* @param goal_checker Pointer to the current goal checker the task is utilizing
|
||||
* @return The best command for the robot to drive
|
||||
*/
|
||||
virtual geometry_msgs::msg::TwistStamped computeVelocityCommands(
|
||||
const geometry_msgs::msg::PoseStamped & pose,
|
||||
const geometry_msgs::msg::Twist & velocity,
|
||||
nav2_core::GoalChecker * goal_checker) = 0;
|
||||
|
||||
/**
|
||||
* @brief Limits the maximum linear speed of the robot.
|
||||
* @param speed_limit expressed in absolute value (in m/s)
|
||||
* or in percentage from maximum robot speed.
|
||||
* @param percentage Setting speed limit in percentage if true
|
||||
* or in absolute values in false case.
|
||||
*/
|
||||
virtual void setSpeedLimit(const double & speed_limit, const bool & percentage) = 0;
|
||||
};
|
||||
|
||||
} // namespace nav2_core
|
||||
|
||||
#endif // NAV2_CORE__CONTROLLER_HPP_
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Copyright (c) 2017, Locus Robotics
|
||||
* Copyright (c) 2019, Intel Corporation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef NAV2_CORE__EXCEPTIONS_HPP_
|
||||
#define NAV2_CORE__EXCEPTIONS_HPP_
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
namespace nav2_core
|
||||
{
|
||||
|
||||
class PlannerException : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit PlannerException(const std::string description)
|
||||
: std::runtime_error(description) {}
|
||||
using Ptr = std::shared_ptr<PlannerException>;
|
||||
};
|
||||
|
||||
} // namespace nav2_core
|
||||
|
||||
#endif // NAV2_CORE__EXCEPTIONS_HPP_
|
||||
@@ -0,0 +1,83 @@
|
||||
// Copyright (c) 2019 Samsung Research America
|
||||
//
|
||||
// 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.
|
||||
|
||||
#ifndef NAV2_CORE__GLOBAL_PLANNER_HPP_
|
||||
#define NAV2_CORE__GLOBAL_PLANNER_HPP_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "rclcpp/rclcpp.hpp"
|
||||
#include "nav2_costmap_2d/costmap_2d_ros.hpp"
|
||||
#include "tf2_ros/buffer.h"
|
||||
#include "nav_msgs/msg/path.hpp"
|
||||
#include "geometry_msgs/msg/pose_stamped.hpp"
|
||||
#include "nav2_util/lifecycle_node.hpp"
|
||||
|
||||
namespace nav2_core
|
||||
{
|
||||
|
||||
/**
|
||||
* @class GlobalPlanner
|
||||
* @brief Abstract interface for global planners to adhere to with pluginlib
|
||||
*/
|
||||
class GlobalPlanner
|
||||
{
|
||||
public:
|
||||
using Ptr = std::shared_ptr<GlobalPlanner>;
|
||||
|
||||
/**
|
||||
* @brief Virtual destructor
|
||||
*/
|
||||
virtual ~GlobalPlanner() {}
|
||||
|
||||
/**
|
||||
* @param parent pointer to user's node
|
||||
* @param name The name of this planner
|
||||
* @param tf A pointer to a TF buffer
|
||||
* @param costmap_ros A pointer to the costmap
|
||||
*/
|
||||
virtual void configure(
|
||||
const rclcpp_lifecycle::LifecycleNode::WeakPtr & parent,
|
||||
std::string name, std::shared_ptr<tf2_ros::Buffer> tf,
|
||||
std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros) = 0;
|
||||
|
||||
/**
|
||||
* @brief Method to cleanup resources used on shutdown.
|
||||
*/
|
||||
virtual void cleanup() = 0;
|
||||
|
||||
/**
|
||||
* @brief Method to active planner and any threads involved in execution.
|
||||
*/
|
||||
virtual void activate() = 0;
|
||||
|
||||
/**
|
||||
* @brief Method to deactive planner and any threads involved in execution.
|
||||
*/
|
||||
virtual void deactivate() = 0;
|
||||
|
||||
/**
|
||||
* @brief Method create the plan from a starting and ending goal.
|
||||
* @param start The starting pose of the robot
|
||||
* @param goal The goal pose of the robot
|
||||
* @return The sequence of poses to get from start to goal, if any
|
||||
*/
|
||||
virtual nav_msgs::msg::Path createPlan(
|
||||
const geometry_msgs::msg::PoseStamped & start,
|
||||
const geometry_msgs::msg::PoseStamped & goal) = 0;
|
||||
};
|
||||
|
||||
} // namespace nav2_core
|
||||
|
||||
#endif // NAV2_CORE__GLOBAL_PLANNER_HPP_
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Copyright (c) 2017, Locus Robotics
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef NAV2_CORE__GOAL_CHECKER_HPP_
|
||||
#define NAV2_CORE__GOAL_CHECKER_HPP_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "rclcpp/rclcpp.hpp"
|
||||
#include "rclcpp_lifecycle/lifecycle_node.hpp"
|
||||
#include "geometry_msgs/msg/pose.hpp"
|
||||
#include "geometry_msgs/msg/twist.hpp"
|
||||
|
||||
#include "nav2_costmap_2d/costmap_2d_ros.hpp"
|
||||
|
||||
|
||||
namespace nav2_core
|
||||
{
|
||||
|
||||
/**
|
||||
* @class GoalChecker
|
||||
* @brief Function-object for checking whether a goal has been reached
|
||||
*
|
||||
* This class defines the plugin interface for determining whether you have reached
|
||||
* the goal state. This primarily consists of checking the relative positions of two poses
|
||||
* (which are presumed to be in the same frame). It can also check the velocity, as some
|
||||
* applications require that robot be stopped to be considered as having reached the goal.
|
||||
*/
|
||||
class GoalChecker
|
||||
{
|
||||
public:
|
||||
typedef std::shared_ptr<nav2_core::GoalChecker> Ptr;
|
||||
|
||||
virtual ~GoalChecker() {}
|
||||
|
||||
/**
|
||||
* @brief Initialize any parameters from the NodeHandle
|
||||
* @param parent Node pointer for grabbing parameters
|
||||
*/
|
||||
virtual void initialize(
|
||||
const rclcpp_lifecycle::LifecycleNode::WeakPtr & parent,
|
||||
const std::string & plugin_name,
|
||||
const std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros) = 0;
|
||||
|
||||
virtual void reset() = 0;
|
||||
|
||||
/**
|
||||
* @brief Check whether the goal should be considered reached
|
||||
* @param query_pose The pose to check
|
||||
* @param goal_pose The pose to check against
|
||||
* @param velocity The robot's current velocity
|
||||
* @return True if goal is reached
|
||||
*/
|
||||
virtual bool isGoalReached(
|
||||
const geometry_msgs::msg::Pose & query_pose, const geometry_msgs::msg::Pose & goal_pose,
|
||||
const geometry_msgs::msg::Twist & velocity) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get the maximum possible tolerances used for goal checking in the major types.
|
||||
* Any field without a valid entry is replaced with std::numeric_limits<double>::lowest()
|
||||
* to indicate that it is not measured. For tolerance across multiple entries
|
||||
* (e.x. XY tolerances), both fields will contain this value since it is the maximum tolerance
|
||||
* that each independent field could be assuming the other has no error (e.x. X and Y).
|
||||
* @param pose_tolerance The tolerance used for checking in Pose fields
|
||||
* @param vel_tolerance The tolerance used for checking velocity fields
|
||||
* @return True if the tolerances are valid to use
|
||||
*/
|
||||
virtual bool getTolerances(
|
||||
geometry_msgs::msg::Pose & pose_tolerance,
|
||||
geometry_msgs::msg::Twist & vel_tolerance) = 0;
|
||||
};
|
||||
|
||||
} // namespace nav2_core
|
||||
|
||||
#endif // NAV2_CORE__GOAL_CHECKER_HPP_
|
||||
@@ -0,0 +1,62 @@
|
||||
// Copyright (c) 2019 Intel Corporation
|
||||
//
|
||||
// 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.
|
||||
|
||||
#ifndef NAV2_CORE__PROGRESS_CHECKER_HPP_
|
||||
#define NAV2_CORE__PROGRESS_CHECKER_HPP_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "rclcpp/rclcpp.hpp"
|
||||
#include "rclcpp_lifecycle/lifecycle_node.hpp"
|
||||
#include "geometry_msgs/msg/pose_stamped.hpp"
|
||||
#include "geometry_msgs/msg/pose2_d.hpp"
|
||||
|
||||
namespace nav2_core
|
||||
{
|
||||
/**
|
||||
* @class nav2_core::ProgressChecker
|
||||
* @brief This class defines the plugin interface used to check the
|
||||
* position of the robot to make sure that it is actually progressing
|
||||
* towards a goal.
|
||||
*/
|
||||
class ProgressChecker
|
||||
{
|
||||
public:
|
||||
typedef std::shared_ptr<nav2_core::ProgressChecker> Ptr;
|
||||
|
||||
virtual ~ProgressChecker() {}
|
||||
|
||||
/**
|
||||
* @brief Initialize parameters for ProgressChecker
|
||||
* @param parent Node pointer
|
||||
*/
|
||||
virtual void initialize(
|
||||
const rclcpp_lifecycle::LifecycleNode::WeakPtr & parent,
|
||||
const std::string & plugin_name) = 0;
|
||||
/**
|
||||
* @brief Checks if the robot has moved compare to previous
|
||||
* pose
|
||||
* @param current_pose Current pose of the robot
|
||||
* @return True if progress is made
|
||||
*/
|
||||
virtual bool check(geometry_msgs::msg::PoseStamped & current_pose) = 0;
|
||||
/**
|
||||
* @brief Reset class state upon calling
|
||||
*/
|
||||
virtual void reset() = 0;
|
||||
};
|
||||
} // namespace nav2_core
|
||||
|
||||
#endif // NAV2_CORE__PROGRESS_CHECKER_HPP_
|
||||
@@ -0,0 +1,83 @@
|
||||
// Copyright (c) 2021 RoboTech Vision
|
||||
//
|
||||
// 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.
|
||||
|
||||
#ifndef NAV2_CORE__SMOOTHER_HPP_
|
||||
#define NAV2_CORE__SMOOTHER_HPP_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "nav2_costmap_2d/costmap_subscriber.hpp"
|
||||
#include "nav2_costmap_2d/footprint_subscriber.hpp"
|
||||
#include "tf2_ros/buffer.h"
|
||||
#include "tf2_ros/transform_listener.h"
|
||||
#include "rclcpp/rclcpp.hpp"
|
||||
#include "rclcpp_lifecycle/lifecycle_node.hpp"
|
||||
#include "pluginlib/class_loader.hpp"
|
||||
#include "nav_msgs/msg/path.hpp"
|
||||
|
||||
|
||||
namespace nav2_core
|
||||
{
|
||||
|
||||
/**
|
||||
* @class Smoother
|
||||
* @brief smoother interface that acts as a virtual base class for all smoother plugins
|
||||
*/
|
||||
class Smoother
|
||||
{
|
||||
public:
|
||||
using Ptr = std::shared_ptr<nav2_core::Smoother>;
|
||||
|
||||
/**
|
||||
* @brief Virtual destructor
|
||||
*/
|
||||
virtual ~Smoother() {}
|
||||
|
||||
virtual void configure(
|
||||
const rclcpp_lifecycle::LifecycleNode::WeakPtr &,
|
||||
std::string name, std::shared_ptr<tf2_ros::Buffer>,
|
||||
std::shared_ptr<nav2_costmap_2d::CostmapSubscriber>,
|
||||
std::shared_ptr<nav2_costmap_2d::FootprintSubscriber>) = 0;
|
||||
|
||||
/**
|
||||
* @brief Method to cleanup resources.
|
||||
*/
|
||||
virtual void cleanup() = 0;
|
||||
|
||||
/**
|
||||
* @brief Method to activate smoother and any threads involved in execution.
|
||||
*/
|
||||
virtual void activate() = 0;
|
||||
|
||||
/**
|
||||
* @brief Method to deactivate smoother and any threads involved in execution.
|
||||
*/
|
||||
virtual void deactivate() = 0;
|
||||
|
||||
/**
|
||||
* @brief Method to smooth given path
|
||||
*
|
||||
* @param path In-out path to be smoothed
|
||||
* @param max_time Maximum duration smoothing should take
|
||||
* @return If smoothing was completed (true) or interrupted by time limit (false)
|
||||
*/
|
||||
virtual bool smooth(
|
||||
nav_msgs::msg::Path & path,
|
||||
const rclcpp::Duration & max_time) = 0;
|
||||
};
|
||||
|
||||
} // namespace nav2_core
|
||||
|
||||
#endif // NAV2_CORE__SMOOTHER_HPP_
|
||||
@@ -0,0 +1,69 @@
|
||||
// Copyright (c) 2020 Fetullah Atas
|
||||
//
|
||||
// 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.
|
||||
|
||||
|
||||
#ifndef NAV2_CORE__WAYPOINT_TASK_EXECUTOR_HPP_
|
||||
#define NAV2_CORE__WAYPOINT_TASK_EXECUTOR_HPP_
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "rclcpp/rclcpp.hpp"
|
||||
#include "rclcpp_lifecycle/lifecycle_node.hpp"
|
||||
#include "geometry_msgs/msg/pose_stamped.hpp"
|
||||
|
||||
namespace nav2_core
|
||||
{
|
||||
/**
|
||||
* @brief Base class for creating a plugin in order to perform a specific task at waypoint arrivals.
|
||||
*
|
||||
*/
|
||||
class WaypointTaskExecutor
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Simple Task Execution At Waypoint Base object
|
||||
*
|
||||
*/
|
||||
WaypointTaskExecutor() {}
|
||||
|
||||
/**
|
||||
* @brief Destroy the Simple Task Execution At Waypoint Base object
|
||||
*
|
||||
*/
|
||||
virtual ~WaypointTaskExecutor() {}
|
||||
|
||||
/**
|
||||
* @brief Override this to setup your pub, sub or any ros services that you will use in the plugin.
|
||||
*
|
||||
* @param parent parent node that plugin will be created within(for an example see nav_waypoint_follower)
|
||||
* @param plugin_name plugin name comes from parameters in yaml file
|
||||
*/
|
||||
virtual void initialize(
|
||||
const rclcpp_lifecycle::LifecycleNode::WeakPtr & parent,
|
||||
const std::string & plugin_name) = 0;
|
||||
|
||||
/**
|
||||
* @brief Override this to define the body of your task that you would like to execute once the robot arrived to waypoint
|
||||
*
|
||||
* @param curr_pose current pose of the robot
|
||||
* @param curr_waypoint_index current waypoint, that robot just arrived
|
||||
* @return true if task execution was successful
|
||||
* @return false if task execution failed
|
||||
*/
|
||||
virtual bool processAtWaypoint(
|
||||
const geometry_msgs::msg::PoseStamped & curr_pose, const int & curr_waypoint_index) = 0;
|
||||
};
|
||||
} // namespace nav2_core
|
||||
#endif // NAV2_CORE__WAYPOINT_TASK_EXECUTOR_HPP_
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||
<package format="3">
|
||||
<name>nav2_core</name>
|
||||
<version>1.1.18</version>
|
||||
<description>A set of headers for plugins core to the Nav2 stack</description>
|
||||
<maintainer email="stevenmacenski@gmail.com">Steve Macenski</maintainer>
|
||||
<maintainer email="carl.r.delsey@intel.com">Carl Delsey</maintainer>
|
||||
<license>Apache-2.0</license>
|
||||
|
||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||
<build_depend>nav2_common</build_depend>
|
||||
|
||||
<depend>rclcpp</depend>
|
||||
<depend>rclcpp_lifecycle</depend>
|
||||
<depend>std_msgs</depend>
|
||||
<depend>geometry_msgs</depend>
|
||||
<depend>nav2_costmap_2d</depend>
|
||||
<depend>pluginlib</depend>
|
||||
<depend>nav_msgs</depend>
|
||||
<depend>tf2_ros</depend>
|
||||
<depend>nav2_util</depend>
|
||||
|
||||
<test_depend>ament_lint_common</test_depend>
|
||||
<test_depend>ament_lint_auto</test_depend>
|
||||
<test_depend>ament_cmake_gtest</test_depend>
|
||||
<test_depend>ament_cmake_pytest</test_depend>
|
||||
<test_depend>launch</test_depend>
|
||||
<test_depend>launch_testing</test_depend>
|
||||
|
||||
<export>
|
||||
<build_type>ament_cmake</build_type>
|
||||
</export>
|
||||
</package>
|
||||
Reference in New Issue
Block a user