Skip to content
Snippets Groups Projects
Commit 4ddb816d authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

No commit message

No commit message
parent 74c3a328
No related branches found
No related tags found
No related merge requests found
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
SafeCmdAlgNode::SafeCmdAlgNode(void) : SafeCmdAlgNode::SafeCmdAlgNode(void) :
algorithm_base::IriBaseAlgorithm<SafeCmdAlgorithm>(), algorithm_base::IriBaseAlgorithm<SafeCmdAlgorithm>(),
front_obstacle_(false),
rear_obstacle_(false),
collision_time_(1), collision_time_(1),
min_dist_(0.3), min_dist_(0.3),
max_vel_front_(10), max_vel_front_(10),
...@@ -75,12 +73,12 @@ void SafeCmdAlgNode::cmd_vel_callback(const geometry_msgs::Twist::ConstPtr& msg) ...@@ -75,12 +73,12 @@ void SafeCmdAlgNode::cmd_vel_callback(const geometry_msgs::Twist::ConstPtr& msg)
{ {
if(Twist_msg_.linear.x < max_vel_front_ && Twist_msg_.linear.x > max_vel_rear_ ) if(Twist_msg_.linear.x < max_vel_front_ && Twist_msg_.linear.x > max_vel_rear_ )
{ {
Twist_msg_.linear.x =+ msg->.linear.x - last_twist_.linear.x ; Twist_msg_.linear.x =+ msg->linear.x - last_twist_.linear.x ;
Twist_msg_.linear.y =+ msg->.linear.y - last_twist_.linear.y ; Twist_msg_.linear.y =+ msg->linear.y - last_twist_.linear.y ;
Twist_msg_.linear.z =+ msg->.linear.z - last_twist_.linear.z ; Twist_msg_.linear.z =+ msg->linear.z - last_twist_.linear.z ;
Twist_msg_.angular.x =+ msg->.angular.x - last_twist_.angular.x; Twist_msg_.angular.x =+ msg->angular.x - last_twist_.angular.x;
Twist_msg_.angular.y =+ msg->.angular.y - last_twist_.angular.y; Twist_msg_.angular.y =+ msg->angular.y - last_twist_.angular.y;
Twist_msg_.angular.z =+ msg->.angular.z - last_twist_.angular.z; Twist_msg_.angular.z =+ msg->angular.z - last_twist_.angular.z;
} }
last_twist_= *msg; last_twist_= *msg;
} }
...@@ -154,4 +152,6 @@ float SafeCmdAlgNode::compute_max_velocity_(const sensor_msgs::LaserScan::ConstP ...@@ -154,4 +152,6 @@ float SafeCmdAlgNode::compute_max_velocity_(const sensor_msgs::LaserScan::ConstP
if (scan->ranges[i] / collision_time_ < max_velocity) if (scan->ranges[i] / collision_time_ < max_velocity)
max_velocity = scan->ranges[i] / collision_time_; max_velocity = scan->ranges[i] / collision_time_;
} }
return max_velocity;
} }
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