Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
b7230b7
adding flag to identify start node, passing tf_buffer to edge scorer
alexanderjyuen Feb 25, 2025
cb665ef
passing tf to route planner
alexanderjyuen Feb 25, 2025
178cc21
added null buffer to tests
alexanderjyuen Feb 25, 2025
eb6e17e
added null buffer to planner configure in performance bench marking test
alexanderjyuen Feb 25, 2025
8707ef2
changed arguments of all old edge scorers to also take tf_buffer
alexanderjyuen Feb 25, 2025
9021151
changed configure to take tf_buffer, added bool to identify start_edg…
alexanderjyuen Feb 25, 2025
f6db192
added start_pose_orientation_scorer to CMake
alexanderjyuen Feb 25, 2025
d507f40
added StartPoseOrientationScorer as and edge scroer
alexanderjyuen Feb 25, 2025
bedf5fc
added tf_buffer to constructor, added start edge bool on score method…
alexanderjyuen Feb 25, 2025
80f1189
added tf_buffer to configure method, added start_id_ member variable,…
alexanderjyuen Feb 25, 2025
7f7e84e
modified all configures to take a tf_buffer, modified all score funct…
alexanderjyuen Feb 25, 2025
63d02ac
adding start_pose_orientation_scorer.cpp
alexanderjyuen Feb 25, 2025
d02bb47
edge scorer modified to take in tf_buffer and pass it to scorer plugi…
alexanderjyuen Feb 25, 2025
be1a59f
removed redundant parameter declarations, changed robot frame to base…
alexanderjyuen Mar 14, 2025
2917ff7
changed robot frame to base frame, year bump on copy right
alexanderjyuen Mar 14, 2025
b54c47b
removed unnecessary tf_buffer_ from edge_scorer
alexanderjyuen Mar 14, 2025
95e4f1a
added EdgeType enum class
alexanderjyuen Mar 14, 2025
6bf96d0
all edge scorer plugins changed to use EdgeType
alexanderjyuen Mar 14, 2025
b51f535
edge_scorer modified to use EdgeType enum class
alexanderjyuen Mar 14, 2025
d87a888
edge_cost_function base class modified to use EdgeType enum class
alexanderjyuen Mar 14, 2025
78451ac
modified tests for new scorer signature
alexanderjyuen Mar 14, 2025
feeff0d
added method to classify edge type
alexanderjyuen Mar 14, 2025
7a27675
ament_cpplinting
alexanderjyuen Mar 14, 2025
d1d6303
linting
alexanderjyuen Mar 14, 2025
743fc09
changed EdgeType to const ref
alexanderjyuen Mar 19, 2025
4bb3131
added option to score orientations instead of outright rejecting star…
alexanderjyuen Mar 19, 2025
4124841
updated docstrings to have better description for goal pose and start…
alexanderjyuen Mar 19, 2025
224218d
Merge branch 'nav2_route_server' into nav2_route_server_start_pose_or…
alexanderjyuen Mar 19, 2025
5c56e61
fixed merge conflict in goal_orientation_scorer.hpp
alexanderjyuen Mar 19, 2025
b946857
fixed merge conflict in edge_cost_function.hpp
alexanderjyuen Mar 19, 2025
3f23b82
removed TODO from costmap_scorer.cpp
alexanderjyuen Mar 26, 2025
1d4bd2d
added getStart method to goal_intent_extract and start pose argument …
alexanderjyuen Mar 26, 2025
d395cc3
added RouteData struct to types.hpp
alexanderjyuen Mar 26, 2025
b2f9010
added start_pose to edge scorer hpp and cpp
alexanderjyuen Mar 26, 2025
9d7bdd7
fixed type getStart return type in goal_intent_extractor.cpp
alexanderjyuen Mar 26, 2025
529b8c9
added passing of start_pose down to scorer in route_planner
alexanderjyuen Mar 26, 2025
9a2e60b
added start pose to base edge cost function class
alexanderjyuen Mar 26, 2025
6188fd3
underscore fix for goal_intent_extractor_
alexanderjyuen Mar 26, 2025
9d63e2f
changed signature of all edge cost functions to take start_pose
alexanderjyuen Mar 26, 2025
305b028
populating RouteData and passing it into findRoute
alexanderjyuen Mar 26, 2025
4c3a96f
passing route_data down to getTraversalCost
alexanderjyuen Mar 26, 2025
e2c763d
plugins modified to take in route_data, tests updated accordingly
alexanderjyuen Mar 26, 2025
96ae07d
using route data for goal_orientation_scorer and start_pose_orientati…
alexanderjyuen Mar 26, 2025
34edfc2
removed route frame, robot frame, and getRobotPose from start_pose_or…
alexanderjyuen Mar 26, 2025
e57e0db
removed used of stat_pose and goal_pose as it is replaced with route …
alexanderjyuen Mar 26, 2025
b9ad8bb
added InvalidCriticUse exception to nav2_core, goal_orientation_score…
alexanderjyuen Mar 26, 2025
143a18f
added INVALID_CRITIC_USE error code in route actions
alexanderjyuen Mar 26, 2025
d1d2d62
added orientation weighting for cost as an option instead of out righ…
alexanderjyuen Mar 26, 2025
cfd4a15
updated docstring for goal orientation scorer
alexanderjyuen Mar 26, 2025
8864fda
renamed Critic to EdgeScorer
alexanderjyuen Mar 27, 2025
0b20cfe
changed Critic to EdgeScorer in edge cost functions
alexanderjyuen Mar 27, 2025
e98fbe5
changed Critic to EdgeScorer, storing exception message in error msg
alexanderjyuen Mar 27, 2025
6cd284f
changed Critic to EdgeScorer in edge scorer tests
alexanderjyuen Mar 27, 2025
855f5f5
changed INVALID_CRITIC_USE to IVALID_EDGE_SCORER_US in actions
alexanderjyuen Mar 27, 2025
141fd89
changed RouteData and route_data to RouteRequest and route_request re…
alexanderjyuen Mar 27, 2025
08deb8a
added doxygen for EdgeType
alexanderjyuen Mar 27, 2025
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
7 changes: 7 additions & 0 deletions nav2_core/include/nav2_core/route_exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ class IndeterminantNodesOnGraph : public RouteException
: RouteException(description) {}
};

class InvalidEdgeScorerUse : public RouteException
{
public:
explicit InvalidEdgeScorerUse(const std::string & description)
: RouteException(description) {}
};

} // namespace nav2_core

#endif // NAV2_CORE__ROUTE_EXCEPTIONS_HPP_
1 change: 1 addition & 0 deletions nav2_msgs/action/ComputeAndTrackRoute.action
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ uint16 INDETERMINANT_NODES_ON_GRAPH=403
uint16 TIMEOUT=404
uint16 NO_VALID_ROUTE=405
uint16 OPERATION_FAILED=406
uint16 INVALID_EDGE_SCORER_USE=407

#goal definition
uint16 start_id
Expand Down
1 change: 1 addition & 0 deletions nav2_msgs/action/ComputeRoute.action
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ uint16 NO_VALID_GRAPH=402
uint16 INDETERMINANT_NODES_ON_GRAPH=403
uint16 TIMEOUT=404
uint16 NO_VALID_ROUTE=405
uint16 INVALID_EDGE_SCORER_USE=407

#goal definition
uint16 start_id
Expand Down
1 change: 1 addition & 0 deletions nav2_route/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ add_library(edge_scorers SHARED
src/plugins/edge_cost_functions/costmap_scorer.cpp
src/plugins/edge_cost_functions/semantic_scorer.cpp
src/plugins/edge_cost_functions/goal_orientation_scorer.cpp
src/plugins/edge_cost_functions/start_pose_orientation_scorer.cpp
)
target_include_directories(edge_scorers
PUBLIC
Expand Down
8 changes: 6 additions & 2 deletions nav2_route/include/nav2_route/edge_scorer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <memory>
#include <vector>

#include "tf2_ros/buffer.h"
#include "pluginlib/class_loader.hpp"
#include "pluginlib/class_list_macros.hpp"
#include "nav2_util/node_utils.hpp"
Expand Down Expand Up @@ -47,7 +48,9 @@ class EdgeScorer
/**
* @brief Constructor
*/
explicit EdgeScorer(nav2_util::LifecycleNode::SharedPtr node);
explicit EdgeScorer(
nav2_util::LifecycleNode::SharedPtr node,
const std::shared_ptr<tf2_ros::Buffer> tf_buffer);

/**
* @brief Destructor
Expand All @@ -63,7 +66,8 @@ class EdgeScorer
* @return If edge is valid
*/
bool score(
const EdgePtr edge, const geometry_msgs::msg::PoseStamped & goal_pose, bool final_edge,
const EdgePtr edge, const RouteRequest & route_request,
const EdgeType & edge_type,
float & score);

/**
Expand Down
6 changes: 6 additions & 0 deletions nav2_route/include/nav2_route/goal_intent_extractor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ class GoalIntentExtractor
*/
void overrideStart(const geometry_msgs::msg::PoseStamped & start_pose);

/**
* @brief gets the desired start pose
* @return PoseStamped of start pose
*/
geometry_msgs::msg::PoseStamped getStart();

protected:
rclcpp::Logger logger_{rclcpp::get_logger("GoalIntentExtractor")};
std::shared_ptr<NodeSpatialTree> node_spatial_tree_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <memory>
#include <string>

#include "tf2_ros/buffer.h"
#include "rclcpp/rclcpp.hpp"
#include "rclcpp_lifecycle/lifecycle_node.hpp"
#include "pluginlib/class_loader.hpp"
Expand Down Expand Up @@ -55,6 +56,7 @@ class EdgeCostFunction
*/
virtual void configure(
const rclcpp_lifecycle::LifecycleNode::SharedPtr node,
const std::shared_ptr<tf2_ros::Buffer> tf_buffer,
const std::string & name) = 0;

/**
Expand All @@ -63,8 +65,8 @@ class EdgeCostFunction
* start/end nodes and their associated metadata and actions
*/
virtual bool score(
const EdgePtr edge, const geometry_msgs::msg::PoseStamped & goal_pose,
bool final_edge, float & cost) = 0;
const EdgePtr edge, const RouteRequest & route_request,
const EdgeType & edge_type, float & cost) = 0;

/**
* @brief Get name of the plugin for parameter scope mapping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class CostmapScorer : public EdgeCostFunction
*/
void configure(
const rclcpp_lifecycle::LifecycleNode::SharedPtr node,
const std::shared_ptr<tf2_ros::Buffer> tf_buffer,
const std::string & name) override;

/**
Expand All @@ -61,8 +62,8 @@ class CostmapScorer : public EdgeCostFunction
* @return bool if this edge is open valid to traverse
*/
bool score(
const EdgePtr edge, const geometry_msgs::msg::PoseStamped & goal_pose, bool final_edge,
float & cost) override;
const EdgePtr edge, const RouteRequest & route_request,
const EdgeType & edge_type, float & cost) override;

/**
* @brief Get name of the plugin for parameter scope mapping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class DistanceScorer : public EdgeCostFunction
*/
void configure(
const rclcpp_lifecycle::LifecycleNode::SharedPtr node,
const std::shared_ptr<tf2_ros::Buffer> tf_buffer,
const std::string & name) override;

/**
Expand All @@ -59,8 +60,8 @@ class DistanceScorer : public EdgeCostFunction
* @return bool if this edge is open valid to traverse
*/
bool score(
const EdgePtr edge, const geometry_msgs::msg::PoseStamped & goal_pose, bool final_edge,
float & cost) override;
const EdgePtr edge, const RouteRequest & route_request,
const EdgeType & edge_type, float & cost) override;

/**
* @brief Get name of the plugin for parameter scope mapping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class DynamicEdgesScorer : public EdgeCostFunction
*/
void configure(
const rclcpp_lifecycle::LifecycleNode::SharedPtr node,
const std::shared_ptr<tf2_ros::Buffer> tf_buffer,
const std::string & name) override;

/**
Expand All @@ -62,8 +63,8 @@ class DynamicEdgesScorer : public EdgeCostFunction
* @return bool if this edge is open valid to traverse
*/
bool score(
const EdgePtr edge, const geometry_msgs::msg::PoseStamped & goal_pose, bool final_edge,
float & cost) override;
const EdgePtr edge, const RouteRequest & route_request,
const EdgeType & edge_type, float & cost) override;

/**
* @brief Get name of the plugin for parameter scope mapping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "rclcpp/rclcpp.hpp"
#include "rclcpp_lifecycle/lifecycle_node.hpp"
#include "nav2_core/route_exceptions.hpp"
#include "nav2_route/interfaces/edge_cost_function.hpp"
#include "nav2_util/line_iterator.hpp"
#include "nav2_util/node_utils.hpp"
Expand All @@ -33,7 +34,11 @@ namespace nav2_route

/**
* @class GoalOrientationScorer
* @brief Scores final edge by comparing the
* @brief Scores an edge leading to the goal node by comparing the orientation of the route
* pose and the orientation of the edge by multiplying the deviation from the desired
* orientation with a user defined weight. An alternative method can be selected, with
* the use_orientation_threshold flag, which rejects the edge it is greater than some
* tolerance
*/
class GoalOrientationScorer : public EdgeCostFunction
{
Expand All @@ -53,6 +58,7 @@ class GoalOrientationScorer : public EdgeCostFunction
*/
void configure(
const rclcpp_lifecycle::LifecycleNode::SharedPtr node,
const std::shared_ptr<tf2_ros::Buffer> tf_buffer,
const std::string & name) override;

/**
Expand All @@ -63,8 +69,8 @@ class GoalOrientationScorer : public EdgeCostFunction
* @return bool if this edge is open valid to traverse
*/
bool score(
const EdgePtr edge, const geometry_msgs::msg::PoseStamped & goal_pose, bool final_edge,
float & cost) override;
const EdgePtr edge, const RouteRequest & route_request,
const EdgeType & edge_type, float & cost) override;

/**
* @brief Get name of the plugin for parameter scope mapping
Expand All @@ -76,6 +82,8 @@ class GoalOrientationScorer : public EdgeCostFunction
rclcpp::Logger logger_{rclcpp::get_logger("GoalOrientationScorer")};
std::string name_;
double orientation_tolerance_;
float orientation_weight_;
bool use_orientation_threshold_;
};

} // namespace nav2_route
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class PenaltyScorer : public EdgeCostFunction
*/
void configure(
const rclcpp_lifecycle::LifecycleNode::SharedPtr node,
const std::shared_ptr<tf2_ros::Buffer> tf_buffer,
const std::string & name) override;

/**
Expand All @@ -58,8 +59,8 @@ class PenaltyScorer : public EdgeCostFunction
* @return bool if this edge is open valid to traverse
*/
bool score(
const EdgePtr edge, const geometry_msgs::msg::PoseStamped & goal_pose, bool final_edge,
float & cost) override;
const EdgePtr edge, const RouteRequest & route_request,
const EdgeType & edge_type, float & cost) override;

/**
* @brief Get name of the plugin for parameter scope mapping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class SemanticScorer : public EdgeCostFunction
*/
void configure(
const rclcpp_lifecycle::LifecycleNode::SharedPtr node,
const std::shared_ptr<tf2_ros::Buffer> tf_buffer,
const std::string & name) override;

/**
Expand All @@ -60,8 +61,8 @@ class SemanticScorer : public EdgeCostFunction
* @return bool if this edge is open valid to traverse
*/
bool score(
const EdgePtr edge, const geometry_msgs::msg::PoseStamped & goal_pose, bool final_edge,
float & cost) override;
const EdgePtr edge, const RouteRequest & route_request,
const EdgeType & edge_type, float & cost) override;

/**
* @brief Scores graph object based on metadata's semantic value at key
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// Copyright (c) 2025, Polymath Robotics 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.

#ifndef NAV2_ROUTE__PLUGINS__EDGE_COST_FUNCTIONS__START_POSE_ORIENTATION_SCORER_HPP_
#define NAV2_ROUTE__PLUGINS__EDGE_COST_FUNCTIONS__START_POSE_ORIENTATION_SCORER_HPP_

#include <memory>
#include <string>

#include "rclcpp/rclcpp.hpp"
#include "rclcpp_lifecycle/lifecycle_node.hpp"
#include "nav2_core/route_exceptions.hpp"
#include "nav2_route/interfaces/edge_cost_function.hpp"
#include "nav2_util/line_iterator.hpp"
#include "nav2_util/node_utils.hpp"
#include "nav2_util/robot_utils.hpp"
#include "nav2_costmap_2d/costmap_subscriber.hpp"
#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp"
#include "tf2/utils.h"
#include "angles/angles.h"

namespace nav2_route
{

/**
* @class StartPoseOrientationScorer
* @brief Scores initial edge by comparing the orientation of the robot's current
* pose and the orientation of the edge by multiplying the deviation from the desired
* orientation with a user defined weight. An alternative method can be selected, with
* the use_orientation_threshold flag, which rejects the edge it is greater than some
* tolerance
*/
class StartPoseOrientationScorer : public EdgeCostFunction
{
public:
/**
* @brief Constructor
*/
StartPoseOrientationScorer() = default;

/**
* @brief destructor
*/
virtual ~StartPoseOrientationScorer() = default;

/**
* @brief Configure
*/
void configure(
const rclcpp_lifecycle::LifecycleNode::SharedPtr node,
const std::shared_ptr<tf2_ros::Buffer> tf_buffer,
const std::string & name) override;

/**
* @brief Main scoring plugin API
* @param edge The edge pointer to score, which has access to the
* start/end nodes and their associated metadata and actions
* @param cost of the edge scored
* @return bool if this edge is open valid to traverse
*/
bool score(
const EdgePtr edge, const RouteRequest & route_request,
const EdgeType & edge_type, float & cost) override;

/**
* @brief Get name of the plugin for parameter scope mapping
* @return Name
*/
std::string getName() override;

protected:
rclcpp::Logger logger_{rclcpp::get_logger("StartPoseOrientationScorer")};
std::string name_;
std::shared_ptr<tf2_ros::Buffer> tf_buffer_;
double orientation_tolerance_;
float orientation_weight_;
bool use_orientation_threshold_;
};

} // namespace nav2_route

#endif // NAV2_ROUTE__PLUGINS__EDGE_COST_FUNCTIONS__START_POSE_ORIENTATION_SCORER_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class TimeScorer : public EdgeCostFunction
*/
void configure(
const rclcpp_lifecycle::LifecycleNode::SharedPtr node,
const std::shared_ptr<tf2_ros::Buffer> tf_buffer,
const std::string & name) override;

/**
Expand All @@ -60,8 +61,8 @@ class TimeScorer : public EdgeCostFunction
* @return bool if this edge is open valid to traverse
*/
bool score(
const EdgePtr edge, const geometry_msgs::msg::PoseStamped & goal_pose, bool final_edge,
float & cost) override;
const EdgePtr edge, const RouteRequest & route_request,
const EdgeType & edge_type, float & cost) override;

/**
* @brief Get name of the plugin for parameter scope mapping
Expand Down
Loading
Loading