Skip to content
Snippets Groups Projects
Commit 92fc2b94 authored by Martí Morta Garriga's avatar Martí Morta Garriga
Browse files

using velocity to define the safe area

parent d34fa6fd
No related branches found
No related tags found
No related merge requests found
...@@ -68,7 +68,7 @@ class SafeCmdAlgNode : public algorithm_base::IriBaseAlgorithm<SafeCmdAlgorithm> ...@@ -68,7 +68,7 @@ class SafeCmdAlgNode : public algorithm_base::IriBaseAlgorithm<SafeCmdAlgorithm>
// [action client attributes] // [action client attributes]
bool front_obstacle_; bool front_obstacle_;
bool rear_obstacle_; bool rear_obstacle_;
float radius_; float scale_;
bool is_point_in_safe_area_(const sensor_msgs::LaserScan::ConstPtr& scan); bool is_point_in_safe_area_(const sensor_msgs::LaserScan::ConstPtr& scan);
public: public:
......
...@@ -4,7 +4,7 @@ SafeCmdAlgNode::SafeCmdAlgNode(void) : ...@@ -4,7 +4,7 @@ SafeCmdAlgNode::SafeCmdAlgNode(void) :
algorithm_base::IriBaseAlgorithm<SafeCmdAlgorithm>(), algorithm_base::IriBaseAlgorithm<SafeCmdAlgorithm>(),
front_obstacle_(false), front_obstacle_(false),
rear_obstacle_(false), rear_obstacle_(false),
radius_(0.5) scale_(1)
{ {
//init class attributes if necessary //init class attributes if necessary
//this->loop_rate_ = 2;//in [Hz] //this->loop_rate_ = 2;//in [Hz]
...@@ -134,7 +134,7 @@ bool SafeCmdAlgNode::is_point_in_safe_area_(const sensor_msgs::LaserScan::ConstP ...@@ -134,7 +134,7 @@ bool SafeCmdAlgNode::is_point_in_safe_area_(const sensor_msgs::LaserScan::ConstP
uint i=0; uint i=0;
while (i < scan->ranges.size()) while (i < scan->ranges.size())
{ {
if(scan->ranges[i] < radius_ && scan->ranges[i] > scan->range_min) if(scan->ranges[i] < fabs(last_twist_.linear.x)*scale_ && scan->ranges[i] > scan->range_min)
return true; return true;
i++; i++;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment