xacro: Traditional processing is deprecated. Switch to --inorder processing! To check for compatibility of your document, use option --check-order. For more infos, see http://wiki.ros.org/xacro#Processing_Order xacro.py is deprecated; please use xacro instead
<!-- Spawn a robot into Gazebo --> <nodename="spawn_urdf"pkg="gazebo_ros"type="spawn_model"args="-file $(find baxter_description)/urdf/baxter.urdf -urdf -z 1 -model baxter" />
对于xacro,这样编写:
1 2 3 4 5
<!-- Convert an xacro and put on parameter server --> <paramname="robot_description"command="$(find xacro)/xacro.py $(find pr2_description)/robots/pr2.urdf.xacro" />
<!-- Spawn a robot into Gazebo --> <nodename="spawn_urdf"pkg="gazebo_ros"type="spawn_model"args="-param robot_description -urdf -model pr2" />
// place the new obstacles into a priority queue // each with a priority of zero to begin with for (std::vector<Observation>::const_iterator it = observations.begin(); it != observations.end(); ++it) { const Observation& obs = *it; const pcl::PointCloud<pcl::PointXYZ>& cloud = *(obs.cloud_); // obstacle_range_ 其实就是参数 obstacle_range double sq_obstacle_range = obs.obstacle_range_ * obs.obstacle_range_; // 遍历点云中的每一个点 for (unsignedint i = 0; i < cloud.points.size(); ++i) { double px = cloud.points[i].x, py = cloud.points[i].y, pz = cloud.points[i].z; // if the obstacle is too high or too far away from the robot we won't add it if (pz > max_obstacle_height_) { ROS_DEBUG("The point is too high"); continue; } // compute the squared distance from the hitpoint to the pointcloud's origin double sq_dist = (px - obs.origin_.x) * (px - obs.origin_.x) + (py - obs.origin_.y) * (py - obs.origin_.y) + (pz - obs.origin_.z) * (pz - obs.origin_.z);
// if the point is far enough away... we won't consider it if (sq_dist >= sq_obstacle_range) { ROS_DEBUG("The point is too far away"); continue; } // now we need to compute the map coordinates for the observation unsignedint mx, my; if (!worldToMap(px, py, mx, my)) { ROS_DEBUG("Computing map coords failed"); continue; } unsignedint index = getIndex(mx, my); costmap_[index] = LETHAL_OBSTACLE; touch(px, py, min_x, min_y, max_x, max_y); } } updateFootprint(robot_x, robot_y, robot_yaw, min_x, min_y, max_x, max_y);
ros::Time now = ros::Time::now(); if (last_publish_ + publish_cycle < now) { publisher_->publishCostmap(); last_publish_ = now; } } r.sleep(); // make sure to sleep for the remainder of our cycle time if (r.cycleTime() > ros::Duration(1 / frequency)) ROS_WARN("Map update loop missed its desired rate of %.4fHz... the loop actually took %.4f seconds", frequency, r.cycleTime().toSec()); } }
for (size_t i = 0; i < message.ranges.size(); i++) { float range = message.ranges[ i ]; if ( (!std::isfinite(range) && range > 0) ) { message.ranges[ i ] = message.range_max - epsilon; } }
if(!planner_->makePlan(start, goal, plan) || plan.empty()) { ROS_DEBUG_NAMED("move_base","Failed to find a plan to point (%.2f, %.2f)", goal.pose.position.x, goal.pose.position.y);