Rosanswers logo

I'm trying to implement a classical bin picking using Moveit.

So the problem I'm trying to solve at the moment is to find out which ones of several available boxes or objects can be grasped and transported away without collisions. I have a list of possible grasp positions and objects and search for which one there is

(a) a path for the empty graber towards the object and

(b) a path for the graber and the attached object towards a save position above the box

So now I am wondering how to tell the MoveGroup interface that I want to temporarily attach the object to the arm for planning. As far as I understand there is MoveGroup::setStartState(RobotState) and then I should be able to somehow attach the object and use MoveGroup::plan() for further planning.

So how do I

  1. Construct the correct RobotState given an MoveGroup::Plan/RobotTrajectory from which I want to use the end state
  2. How do I attach the box?

My current Code so far:

std::vector possibleGrasps = provider.getPossibleGrasps();

Eigen::Affine3d preApproach;
preApproach = Eigen::Translation3d(Eigen::Vector3d(1.1, 0, 1.0)) * Eigen::AngleAxisd(M_PI, Eigen::Vector3d::UnitX());

bool anyPathFound = false;

moveit_msgs::CollisionObject collision_object;
moveit::planning_interface::MoveGroup::Plan plan;


BOOST_FOREACH(Grasp grasp, possibleGrasps)


      moveit::planning_interface::MoveItErrorCode error = group.plan(plan);
      if (error != moveit_msgs::MoveItErrorCodes::SUCCESS)

      // Object andocken (an RobotState) und weiteren Weg planen
      if (error == moveit_msgs::MoveItErrorCodes::SUCCESS)
             anyPathFound = true;
             collision_object = grasp.object;

if (!anyPathFound) {
      ROS_ERROR("Could not find any valid pick");



ROS_INFO("Attach the object to the robot");
/* Sleep to give Rviz time to show the object attached (different color). */
Eigen::Affine3d approach_place = tower[box];
approach_place.translate(-0.33 * Eigen::Vector3d::UnitZ());

bool placed = group.move();
ros::Duration(0.5).sleep(); // sleep for half a second
ROS_INFO("Detach the object from the robot");
/* Sleep to give Rviz time to show the object detached. */

I'm using ros Indigo on Kubuntu 14.04 and the included moveit

Originally posted by Simon Schmeisser on ROS Answers with karma: 229 on 2015-03-13

Post score: 0


1 Answer 1


Rosanswers logo

Here is a short sketch how to do it:

Get a PlanningScene (by using LockedPlanningScene from PlanningSceneUpdater)

diff and detachFromParent (necessary?) to not spoil your "real" PlanningScene

Now you can use all of the api of PlanningScene and RobotState to check for collisions etc. Most of the trajectory planning code also allows passing in a PlanningScene to operate on

Originally posted by Simon Schmeisser with karma: 229 on 2016-11-06

This answer was ACCEPTED on the original site

Post score: 0


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.