Skip to content

Porting CHOMP to latest MoveIt #15

Closed

Description

@ksatyaki

I recently started trying to port the CHOMP planner to the latest moveit API.
I have worked a bit on (https://github.com/jhu-lcsr-forks/moveit_planners). For now, the moveit plugin for planning compiles and runs with moveit. Please find my fork here: https://github.com/ksatyaki/moveit_planners

However, I need some insight to figure out why I get this error.

Could not initialize hybrid collision world from planning scene
Could not initialize optimizer

These are errors generated when creating an optimizer instance.

I tried running it on a jaco2 arm.I didn't configure a kinect / 3d sensor. I first wanted to try it without any obstacles. Am I missing something?

Please let me know if you need more information. Any help is highly appreciated.

My launch files are at:
https://github.com/ksatyaki/jaco_chomp_launch
https://github.com/ksatyaki/manipulation_launch

I run the manipulation.launch from jaco_chomp_launch which basically loads move_group with a different planning pipeline.

Activity

  1. ksatyaki commented on Aug 4, 2016

    @ksatyaki
    ContributorAuthor

    Update

    I discovered that the "planning_scene->getCollisionWorld().get()" is returning a NULL pointer. I don't understand it completely. But, I could work around the problem by adding a new CollisionDetectorHybrid to the planning scene and calling the setActiveCollisionDetector() to set it to active.

    However, now I encounter the following problem:

    No link state found for link jaco_link_finger_1

    I am guessing that this has to do something with the urdf or srdf.

  2. Ry0 commented on Aug 4, 2016

    @Ry0

    I'm also facing that problem.
    I just tried your moveit_planner (https://github.com/ksatyaki/moveit_planners).
    The following errors are not happened.

    Could not initialize hybrid collision world from planning scene
    Could not initialize optimizer
    

    But, The following description is output.

    No link state found for link hoge
    

    After the output, move_group process died.

    I have a question.
    Do you use ros-planning/moveit_experimental for using collision_distance_field package?
    (https://github.com/ros-planning/moveit_experimental)

  3. jrgnicho commented on Aug 4, 2016

    @jrgnicho
    Contributor

    @ksatyaki are you implementing a planning_interface::PlannerManager and planning_interface::PlanningContext. These classes define the planning workflow which involves initializing the planning scene before calling the solve method on the planner. Take a look at the stomp_planner_manager.h and stomp_planner.h if you need an example of this

  4. davetcoleman commented on Aug 4, 2016

    @davetcoleman
    Member

    @jbohren has worked with CHOMP and moveit_experimental, see davetcoleman#2

    Would be great to get that PR or your work merged into MoveIt soon

    @jrgnicho can probably advise on this subject also... wait he already did :)

  5. ksatyaki commented on Aug 4, 2016

    @ksatyaki
    ContributorAuthor

    @jrgnicho Thanks so much. I will get back soon after I look at the stomp. :)

    @davetcoleman Thanks again!

    @Ry0 I am using @jrgnicho's moveit_experimental ... This one is ported to the new moveit API. And to catkin ...

  6. added a commit that references this issue on Aug 4, 2016
  7. ksatyaki commented on Aug 5, 2016

    @ksatyaki
    ContributorAuthor

    While setting up a planning scene, is it enough to set it up for the planner like it is done in Stomp? Or should one use the PlanningSceneMonitor read-write class? What is the difference?

    Update

    Both approaches seem to give the same results. I still get the "no link state found" error for the finger links.

    @jrgnicho Do you have a moveit simulation setup (on which stomp works) to test chomp? That way we have something common to test on, perhaps?

  8. v4hn commented on Aug 5, 2016

    @v4hn
    Contributor

    On Fri, Aug 05, 2016 at 02:49:53AM -0700, Chittaranjan Srinivas Swaminathan wrote:

    While setting up a planning scene, is it enough to set it up for the planner like it is done in Stomp?
    Or should one use the PlanningSceneMonitor read-write class? What is the difference?

    See http://moveit.ros.org/documentation/concepts/ on Planning Scene.
    If you like to have the scene updated with the robot's joint states, etc. you will need a monitor.

  9. jrgnicho commented on Aug 5, 2016

    @jrgnicho
    Contributor

    @ksatyaki There is a stomp_test_kr_moveit_config package that you can use for your testing. It's already configured to load the stomp planner instead of ompl. Essentially, you must create a planning_plugin for your planner using the pluginlib library as shown here and by setting up a plugin.xml file with the plugin information. Then, in your moveit_config package, you define a [your_planner_name]_moveit_planning_pipeline.launch file (see example) and then have the move_group.launch file load it by setting the pipeline parameter to your planner's name.
    Since the planner is loaded by the move_group node I don't think there's any need to maintain a planning scene monitor inside your planner, in fact move_group should ensured that the planning_scene pointer gets passed to the planner before requesting a to solve a motion plan.

  10. ksatyaki commented on Aug 7, 2016

    @ksatyaki
    ContributorAuthor

    I have tried using the config. I still get a similar error.

    No link state found for link gripper_body

    I have tried commenting the return statement when a link state is not found. It appears that not all links have a corresponding link state. I am not entirely sure why this is the case or how this works. But when I do that, I get the error:

    No link body decomposition for link workcell_bounds

    I am wondering if the code in collision_robot_distance_field.cpp needs some update.

  11. jrgnicho commented on Aug 8, 2016

    @jrgnicho
    Contributor

    @ksatyaki the code in moveit_experimental was copied into industrial_moveit where it went through some further development. You should try switching to that repo instead. It be helpful if you were to provide a more detailed description of the workflow that you follow that exposes these issues.

  12. ksatyaki commented on Aug 8, 2016

    @ksatyaki
    ContributorAuthor

    @jrgnicho Oh, thanks. It looks like the last commit on the other repo pertains to my error.

    I am starting the "demo.launch" for the config you gave me, but with the chomp plugin. Then I issue a simple goal using rviz. Once the planner receives the goal, the error occurs.

  13. jrgnicho commented on Aug 8, 2016

    @jrgnicho
    Contributor

    @ksatyaki yes it looks like the commit may address that "No link body decomposition ... " issue you saw. See if you still get it after switching to the newer `moveit_experimental' code.

  14. ksatyaki commented on Aug 11, 2016

    @ksatyaki
    ContributorAuthor

    @jrgnicho After trying to use the moveit_experimental package from industrial_moveit, I still get the error

    No link body decomposition for link workcell_bounds

    Related question.

    I am not sure I am initializing the planning scene correctly.
    I used the STOMP moveit interface as an example and I create one planning context per JointModelGroup. So in the initialize function of the PlannerManager I do,

    bool initialize(const robot_model::RobotModelConstPtr& model, const std::string &ns)
      {
        std::vector <std::string> groups = model->getJointModelGroupNames();
        ROS_INFO_STREAM("Following groups exist:");
        for(int i = 0; i < groups.size(); i++) {
          ROS_INFO("%s", groups[i].c_str());
          planning_contexts_[groups[i]] = ChompPlanningContextPtr(new ChompPlanningContext("chomp_planning_context", groups[i], model));
        }
        return true;
      }
    

    Where planning_contexts_ is

    std::map <std::string, ChompPlanningContextPtr> planning_contexts_;
    

    And in the constructor of the ChompPlanningContext I do,

    boost::shared_ptr<collision_detection::CollisionDetectorAllocator> hybrid_cd (new collision_detection::CollisionDetectorAllocatorHybrid());
    
      if (!this->getPlanningScene())
      {
        ROS_INFO_STREAM("Configuring New Planning Scene.");
        planning_scene::PlanningScenePtr planning_scene_ptr(new planning_scene::PlanningScene(model));
        planning_scene_ptr->addCollisionDetector(hybrid_cd);
        planning_scene_ptr->setActiveCollisionDetector(hybrid_cd->getName());
        setPlanningScene(planning_scene_ptr);
      }
    
    

    Does this make sense?

    It appears that may be none of the link body decompositions are initialized.

  15. ksatyaki commented on Aug 15, 2016

    @ksatyaki
    ContributorAuthor

    I have an update on where the error happens and why.

    When I add a collision detector as mentioned in the previous post, it simply creates an empty CollisionRobotDistanceField using the first constructor. So the link_body_decomposition_vector_ is not initialized.

    I am wondering how one could initialize this class properly or add a Collision Detector properly.

  16. 13 remaining items

  17. davetcoleman commented on Oct 27, 2016

    @davetcoleman
    Member

    This has been completed except documentation, issue: #237

  18. BoltzmannBrain commented on Jan 24, 2018

    @BoltzmannBrain

    @ksatyaki I'm hoping you can help me here. I've been trying to extract the signed distance field (SDF) functionality from CHOMP -- I simply want to write a method PlanningScene::CheckSDF that gives me a vector of distance values from each robot sphere to its nearest obstacle. With the following code I came across this issue,

        const collision_detection::CollisionWorldHybrid* hy_world;
        const collision_detection::CollisionRobotHybrid* hy_robot;
    
        hy_world =
            dynamic_cast< const collision_detection::CollisionWorldHybrid* >(
                planning_scene_->getCollisionWorld(planning_scene_->getActiveCollisionDetectorName()).get());
        if (!hy_world) {
            std::cerr << "Could not initialize hybrid collision world from planning scene" << std::endl;
            return false;
        }
    
        hy_robot = dynamic_cast<const collision_detection::CollisionRobotHybrid*>(
            planning_scene_->getCollisionRobot(planning_scene_->getActiveCollisionDetectorName()).get()
        );
        if (!hy_robot) {
            std::cerr << "Could not initialize hybrid collision robot from planning scene" << std::endl;
            return false;
        }
    
        auto req = collision_detection::CollisionRequest();
        auto res = collision_detection::CollisionResult();
        moveit::core::RobotState state(robot_model_);
        collision_detection::GroupStateRepresentationPtr gsr;
        auto robot = *hy_robot->getCollisionRobotDistanceField().get();
    
        hy_world->checkCollisionDistanceField(req, res, robot, state, gsr);  // Passthrough to `cworld_distance_->checkCollision(req, res, robot, state, gsr);`
    
        // Debug lines to see what's going on:
        int num_collision_points_ = 0;
        std::map<std::string, std::string> fixed_link_resolution_map;
        std::cout << "Num grads = "<< gsr->gradients_.size() << std::endl;
        for (auto g = 0; g < gsr->gradients_.size(); g++)
        {
            num_collision_points_ += gsr->gradients_[g].gradients.size();
            collision_detection::GradientInfo& info = gsr->gradients_[g];
            std::vector<double> distances = info.distances;
            std::cout << distances.size() << std::endl;
        }
    
    

    which gives me the Could not initialize hybrid collision world from planning scene error message.

    Also note that I can use PlanningScene::CheckCollision and then look at the CollisionResult for the distance value, but this only gives me one distance value for the full robot.

    I'm using the collision_distance_field package from moveit_experimental. Any help you can offer me would be greatly appreciated 😄

  19. ksatyaki commented on Jan 25, 2018

    @ksatyaki
    ContributorAuthor

    It's been a long time since I worked on this package. So it is possible that I might be of no help at all. I will try, nevertheless :-)

    I am not sure what you mean by "extract the signed distance field (SDF) functionality from CHOMP". Do you simply want to use the SDF Functions?

    If that is the case, take a look at this repo. On the devel branch we have a sdf_tracker_grasping, sdf_tracker_msgs and sdf_collision_check. I suggest these, because they are maintained at our University at the moment and we can provide help in using these packages. These packages are not dependent on the rest of the grasping stack, so you should be able to use them separately.

    However, you might find in that repository how we use this SDF tracker along with the collision checker. Maybe the author of sdf_tracker, @dcanelhas, can provide some help too.

    For the issue at hand, I believe that there is something fishy with the moveit configuration files / parameters that leads to the error, "Could not initialize hybrid collision world from planning scene". But I am not sure what.

    Sorry if I haven't been of any help :)

  20. BoltzmannBrain commented on Jan 25, 2018

    @BoltzmannBrain

    Thank you for the quick reply @ksatyaki! I'll look through the SDF functions in that repo and follow-up later.

    What I mean by "extract the SDF functionality from CHOMP", I mean that I'd like to use a sphere-robot model and a distance field to check for collisions during motion planning, but I'll be using a different optimization algorithm. Importantly, I need the distance field to provide a vector of distances at a given state, one value for each of the robot's spheres to the nearest obstacle.

    Regarding that error message, I believe it's due to a null pointer from getCollisionWorld, as mentioned earlier in this thread.

  21. BoltzmannBrain commented on Jan 25, 2018

    @BoltzmannBrain

    I appreciate you sharing your grasping code @ksatyaki, but I'm constrained to use the PlanningScene class provided by MoveIt. It looks like the sdf_X code is all custom and independent from the MoveIt package. That is, I already have an initialized PlanningScene with pointcloud info, and all I need is a simple function that returns a 3-dimensional std::vector representing a distance field.

  22. dcanelhas commented on Jan 26, 2018

    @dcanelhas

    I noticed this issue is closed, but let me know if I can be of assistance. It seems if you are working with point cloud data, you probably don't want the full volumetric SDF representation just to get the distances. You're better off using eg nanoflann to build a kd tree in tiles and doing a nn lookup, and computing the point to plane distance.

  23. ksatyaki commented on Jan 26, 2018

    @ksatyaki
    ContributorAuthor

    @BoltzmannBrain I don't know why there is a null pointer returned. If I remember correctly, collision distance field worked fine when I tried it.

  24. BoltzmannBrain commented on Jan 26, 2018

    @BoltzmannBrain

    @dcanelhas thank you for the tip. Would you be able to point me to some more info on that approach? Is it something included in ROS or MoveIt (I hope!)?

  25. BoltzmannBrain commented on Jan 26, 2018

    @BoltzmannBrain

    @ksatyaki do you mean the code I posted, using collision distance field from moveit_experimental, would work fine? Regarding the null pointer, I'm referring to your earlier comment in this thread.

  26. dcanelhas commented on Jan 26, 2018

    @dcanelhas

    @BoltzmannBrain have a look at KdTreeFLANN Assume you have a query point q and a obtain the nearest map point p with associated normal n, the (signed) point-to-plane distance is simply
    dot( (p-q), n)

  27. khalilibrahim commented on Apr 11, 2019

    @khalilibrahim

    @ksatyaki I have problem when I install stomp planner (Moveit/Rviz) (indigo) no library loading in my package.I found this error (process has died) as you see. anyone see this before to help me!!!
    image

  28. omeranar1 commented on Oct 26, 2021

    @omeranar1

    moveit_servo/src/collision_check.cpp can measure "self_collision_distance_" but not the "scene_collision_distance_"

    scene_ro->getCollisionWorld()->getWorld()->size() is 0

  29. simonschmeisser commented on Oct 26, 2021

    @simonschmeisser
    Contributor

    Please don't necromance old and unrelated issues, try getting feedback on answers.ros.org or discourse or open a new and complete issue

  30. locked as resolved and limited conversation to collaborators on Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions