Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
cfa2373
initial
sathak93 Sep 2, 2021
898b91d
initial
sathak93 Sep 3, 2021
4f636c8
conflit resolve'
sathak93 Sep 3, 2021
d3d21a7
initialize
sathak93 Sep 3, 2021
044955b
un
sathak93 Sep 4, 2021
456e852
working
sathak93 Sep 4, 2021
536e2e7
lint fix
sathak93 Sep 4, 2021
d769f53
wrk
sathak93 Sep 7, 2021
e4cf2db
clean_up
sathak93 Sep 7, 2021
6cef400
remove code repettion
sathak93 Sep 8, 2021
7413f17
rm unused variable
sathak93 Sep 8, 2021
a465f9d
initialize footprint on configure itself
sathak93 Sep 8, 2021
f58ba26
revert to defaulted constructer
sathak93 Sep 8, 2021
0b572e8
remove rviz change
sathak93 Sep 8, 2021
c0ccf83
Merge branch 'ros-planning:main' into footprint_pr
sathak93 Sep 8, 2021
b797c55
remove unneccessary changes
sathak93 Sep 8, 2021
defbb23
review changes
sathak93 Sep 9, 2021
0743ab2
define traverse unkown
sathak93 Sep 9, 2021
1889ad3
set true
sathak93 Sep 9, 2021
16e8823
reviw changes
sathak93 Sep 10, 2021
631984b
styling changes
sathak93 Sep 15, 2021
51a1377
Merge branch 'ros-planning:main' into footprint_pr
sathak93 Sep 15, 2021
61ccdff
collision checking condition
sathak93 Oct 8, 2021
21daab5
used back()
sathak93 Oct 9, 2021
0255462
make loop end condition fixed
sathak93 Oct 12, 2021
e8d793a
Merge branch 'main' of https://github.com/sathak93/navigation2 into f…
sathak93 Oct 17, 2021
97bc1e4
review changes
sathak93 Oct 27, 2021
55ce803
Merge branch 'ros-planning:main' into footprint_pr
sathak93 Nov 1, 2021
cb05bb6
fix
sathak93 Nov 1, 2021
a34ccd9
Merge branch 'footprint_pr' of https://github.com/sathak93/navigation…
sathak93 Nov 1, 2021
edde2af
removed midpose curvature
sathak93 Nov 11, 2021
a5c59c8
removed stop collision check at goal pose
sathak93 Nov 11, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <algorithm>
#include <mutex>

#include "nav2_costmap_2d/footprint_collision_checker.hpp"
#include "nav2_core/controller.hpp"
#include "rclcpp/rclcpp.hpp"
#include "pluginlib/class_loader.hpp"
Expand Down Expand Up @@ -184,13 +185,16 @@ class RegulatedPurePursuitController : public nav2_core::Controller
const double &, const double &);

/**
* @brief Whether point is in collision
* @brief checks for collision at projected pose
* @param x Pose of pose x
* @param y Pose of pose y
* @param theta orientation of Yaw
* @return Whether in collision
*/
bool inCollision(const double & x, const double & y);

bool inCollision(
const double & x,
const double & y,
const double & theta);
/**
* @brief Cost at a point
* @param x Pose of pose x
Expand Down Expand Up @@ -273,6 +277,8 @@ class RegulatedPurePursuitController : public nav2_core::Controller
std::shared_ptr<rclcpp_lifecycle::LifecyclePublisher<geometry_msgs::msg::PointStamped>>
carrot_pub_;
std::shared_ptr<rclcpp_lifecycle::LifecyclePublisher<nav_msgs::msg::Path>> carrot_arc_pub_;
std::unique_ptr<nav2_costmap_2d::FootprintCollisionChecker<nav2_costmap_2d::Costmap2D *>>
Comment thread
sathak93 marked this conversation as resolved.
collision_checker_;

// Dynamic parameters handler
std::mutex mutex_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ void RegulatedPurePursuitController::configure(
global_path_pub_ = node->create_publisher<nav_msgs::msg::Path>("received_global_plan", 1);
carrot_pub_ = node->create_publisher<geometry_msgs::msg::PointStamped>("lookahead_point", 1);
carrot_arc_pub_ = node->create_publisher<nav_msgs::msg::Path>("lookahead_collision_arc", 1);

// initialize collision checker and set costmap
collision_checker_ = std::make_unique<nav2_costmap_2d::
FootprintCollisionChecker<nav2_costmap_2d::Costmap2D *>>(costmap_);
collision_checker_->setCostmap(costmap_);
}

void RegulatedPurePursuitController::cleanup()
Expand Down Expand Up @@ -389,7 +394,10 @@ bool RegulatedPurePursuitController::isCollisionImminent(
// odom frame and the carrot_pose is in robot base frame.

// check current point is OK
if (inCollision(robot_pose.pose.position.x, robot_pose.pose.position.y)) {
if (inCollision(
robot_pose.pose.position.x, robot_pose.pose.position.y,
tf2::getYaw(robot_pose.pose.orientation)))
{
return true;
}

Comment thread
sathak93 marked this conversation as resolved.
Expand All @@ -408,13 +416,9 @@ bool RegulatedPurePursuitController::isCollisionImminent(
curr_pose.y = robot_pose.pose.position.y;
curr_pose.theta = tf2::getYaw(robot_pose.pose.orientation);

// only forward simulate within time requested
int i = 1;
while (true) {
// only forward simulate within time requested
if (i * projection_time > max_allowed_time_to_collision_) {
break;
}

while (i * projection_time < max_allowed_time_to_collision_) {
i++;

// apply velocity at curr_pose over distance
Expand All @@ -428,8 +432,8 @@ bool RegulatedPurePursuitController::isCollisionImminent(
pose_msg.pose.position.z = 0.01;
arc_pts_msg.poses.push_back(pose_msg);

// check for collision at this point
if (inCollision(curr_pose.x, curr_pose.y)) {
// check for collision at the projected pose
if (inCollision(curr_pose.x, curr_pose.y, curr_pose.theta)) {
carrot_arc_pub_->publish(arc_pts_msg);
return true;
}
Expand All @@ -440,7 +444,10 @@ bool RegulatedPurePursuitController::isCollisionImminent(
return false;
}

bool RegulatedPurePursuitController::inCollision(const double & x, const double & y)
bool RegulatedPurePursuitController::inCollision(
const double & x,
const double & y,
const double & theta)
{
unsigned int mx, my;

Expand All @@ -453,13 +460,16 @@ bool RegulatedPurePursuitController::inCollision(const double & x, const double
return false;
}

unsigned char cost = costmap_->getCost(mx, my);

if (costmap_ros_->getLayeredCostmap()->isTrackingUnknown()) {
return cost >= INSCRIBED_INFLATED_OBSTACLE && cost != NO_INFORMATION;
} else {
return cost >= INSCRIBED_INFLATED_OBSTACLE;
double footprint_cost = collision_checker_->footprintCostAtPose(
x, y, theta, costmap_ros_->getRobotFootprint());
Comment thread
SteveMacenski marked this conversation as resolved.
if (footprint_cost == static_cast<double>(NO_INFORMATION) &&
costmap_ros_->getLayeredCostmap()->isTrackingUnknown())
{
return false;
}

// if occupied or unknown and not to traverse unknown space
return footprint_cost >= static_cast<double>(LETHAL_OBSTACLE);
}

double RegulatedPurePursuitController::costAtPose(const double & x, const double & y)
Expand Down