0
$\begingroup$

Rosanswers logo

I'm unable to get simple carrot planner code , for motion planning, up and running.

The problem I'm trying to write code for is: to use carrot planner to move the erratic gazebo robot from a start point to end point.Here are the problems I am facing:

(1) I doubt if my design is correct, or if there's a simpler way to solve the above problem. Currently, I start erratic_wg.launch within simulator_gazebo. Next, I have a tf::listener instance running in a separate program, excerpts from which are given below. The listener uses the carrot planner while transforming from base_link to map:

void transformPoint(const tf::TransformListener& listener) 
{
         
         geometry_msgs::PointStamped laser_point;
         laser_point.header.frame_id = "base_link";
              ...
         tf::TransformListener mytf(ros::Duration(10));

         costmap_2d::Costmap2DROS costmap("my_costmap", mytf);
         carrot_planner::CarrotPlanner cp  ;
         cp.initialize("my_carrot_planner", &costmap);
         try
         {
                geometry_msgs::PointStamped base_point;
                listener.transformPoint("map", laser_point, base_point);

                geometry_msgs::PoseStamped start  ;
                start.pose.position.x = 0 , start.pose.position.y = 0,
                start.pose.position.z = 0;
                geometry_msgs::PoseStamped end;
                end.pose.position.x = 5 , end.pose.position.y = 5,
                end.pose.position.z = 0;

                std::vector<geometry_msgs::PoseStamped> plan;
                cp.makePlan(start, end, plan);
                // Should I send a cmd_vel message now for each step of the plan?
        }
}

(2) When my costmap is initialized as above, the listener code segfaults. I have traced this to the constructor of Costmap2DPublisher called within Costmap2DROS constructor, but haven't gone deeper than this. I am using ros version 1.2.4 and the older version of the navigation stack (i.e. which contained nav_view). I am not sure how to specify the navigation stack version more precisely (i.e. repo revision, etc.). Also, the latest navigation stack doesn't build , as pcl_ros doesn't compile on my ros. So I stuck with a previous version I had downloaded around Nov. 2010. I can provide further details if necessary.


Originally posted by PKG on ROS Answers with karma: 365 on 2011-06-09

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

First off, navigation 1.2.4 is pretty old, its worth trying to update if you can. Second, you should probably be initializing both the costmap and the carrot planner outside of a ROS callback. As it stands right now, they'll be recreated every time the callback is called. Also, I'm not totally clear on what you're trying to do. Using the carrot planner in the way you're using it above won't even have the robot avoid obstacles while it drives. You might as well just publish velocity commands without doing collision checking. Perhaps the full navigation stack is better for your use case.


Originally posted by eitan with karma: 2743 on 2011-06-22

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.