SMACC
Loading...
Searching...
No Matches
Classes | Functions
cl_move_base_z::forward_local_planner Namespace Reference

Classes

class  ForwardLocalPlanner
 

Functions

tf::Stamped< tf::Pose > optionalRobotPose (costmap_2d::Costmap2DROS *costmapRos)
 
void clamp (geometry_msgs::Twist &cmd_vel, double max_linear_x_speed_, double max_angular_z_speed_)
 

Function Documentation

◆ clamp()

void cl_move_base_z::forward_local_planner::clamp ( geometry_msgs::Twist &  cmd_vel,
double  max_linear_x_speed_,
double  max_angular_z_speed_ 
)

Definition at line 224 of file forward_local_planner.cpp.

225{
226 if (max_angular_z_speed_ == 0 || max_linear_x_speed_ == 0)
227 return;
228
229 if (cmd_vel.angular.z == 0)
230 {
231 cmd_vel.linear.x = max_linear_x_speed_;
232 }
233 else
234 {
235 double kurvature = cmd_vel.linear.x / cmd_vel.angular.z;
236
237 double linearAuthority = fabs(cmd_vel.linear.x / max_linear_x_speed_);
238 double angularAuthority = fabs(cmd_vel.angular.z / max_angular_z_speed_);
239 if (linearAuthority < angularAuthority)
240 {
241 // lets go to maximum linear speed
242 cmd_vel.linear.x = max_linear_x_speed_;
243 cmd_vel.angular.z = kurvature / max_linear_x_speed_;
244 ROS_WARN_STREAM("k=" << kurvature << "lets go to maximum linear capacity: " << cmd_vel);
245 }
246 else
247 {
248 // lets go with maximum angular speed
249 cmd_vel.angular.x = max_angular_z_speed_;
250 cmd_vel.linear.x = kurvature * max_angular_z_speed_;
251 ROS_WARN_STREAM("lets go to maximum angular capacity: " << cmd_vel);
252 }
253 }
254}

◆ optionalRobotPose()

tf::Stamped< tf::Pose > cl_move_base_z::forward_local_planner::optionalRobotPose ( costmap_2d::Costmap2DROS *  costmapRos)

Definition at line 216 of file forward_local_planner.cpp.

217{
218 tf::Stamped<tf::Pose> tfpose;
219 costmapRos->getRobotPose(tfpose);
220 return tfpose;
221}

Referenced by cl_move_base_z::forward_local_planner::ForwardLocalPlanner::computeVelocityCommands().

Here is the caller graph for this function: