ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

MoveIt Attach Object Error

asked 2016-10-26 03:28:22 -0500

bhavyadoshi26 gravatar image

Here is my node to add an object and attach it to the robot :

#include <moveit/move_group_interface/move_group.h>
#include <moveit/planning_scene_interface/planning_scene_interface.h>
#include <geometric_shapes/shape_operations.h>

using namespace Eigen; 

int main(int argc, char **argv)
{

ros::init(argc, argv, "add_workpiece_wall");
ros::NodeHandle nh;

ros::AsyncSpinner spin(1);
spin.start();


moveit::planning_interface::PlanningSceneInterface current_scene;
sleep(2.0);


Vector3d b(0.001, 0.001, 0.001);

moveit_msgs::CollisionObject co;            

co.id = "workpiece_wall";


shapes::Mesh* m = shapes::createMeshFromResource("package://mitsubishi_rv6sd_support/meshes/workpiece_wall.stl",b); 
ROS_INFO("Workpiece Wall mesh loaded");

shape_msgs::Mesh mesh;

shapes::ShapeMsg mesh_msg;  
shapes::constructMsgFromShape(m, mesh_msg);
mesh = boost::get<shape_msgs::Mesh>(mesh_msg);

co.meshes.resize(1);
co.mesh_poses.resize(1);

co.meshes[0] = mesh;
co.header.frame_id = "base_link";   

co.mesh_poses[0].position.x = 0.560651;
co.mesh_poses[0].position.y = 0.579113;
co.mesh_poses[0].position.z = 0.0;
co.mesh_poses[0].orientation.w= 0.0; 
co.mesh_poses[0].orientation.x= 0.0; 
co.mesh_poses[0].orientation.y= 0.0;
co.mesh_poses[0].orientation.z= 0.0;   

co.meshes.push_back(mesh);
co.mesh_poses.push_back(co.mesh_poses[0]);
co.operation = co.ADD;


std::vector<moveit_msgs::CollisionObject> abc;
abc.push_back(co);


ROS_INFO("Workpiece Wall added into the world");
current_scene.addCollisionObjects(abc);
sleep(5.0);

moveit::planning_interface::MoveGroup g("arm");     
ROS_INFO("Attach Workpiece Wall to the robot");
g.attachObject(co.id);
// Sleep to give Rviz time to show the object attached (different color).
sleep(4.0);


ros::shutdown();

return 0;
}

And the error I'm getting is this:

terminate called after throwing an instance of 'std::runtime_error'
  what():  No Trajectory execution capability available.
[add_workpiece_wall-7] process has died [pid 47204, exit code -6, cmd /home/sbr/mitsubishi/devel/lib/mitsubishi_rv6sd_support/add_workpiece_wall __name:=add_workpiece_wall __log:=/home/sbr/.ros/log/d1c6e840-9ac0-11e6-ba06-480fcf447f3c/add_workpiece_wall-7.log].
log file: /home/sbr/.ros/log/d1c6e840-9ac0-11e6-ba06-480fcf447f3c/add_workpiece_wall-7*.log

From my previous question it is somewhat clear that the error is only because of these lines :

moveit::planning_interface::MoveGroup g("arm");     
ROS_INFO("Attach Workpiece Wall to the robot");
g.attachObject(co.id);
// Sleep to give Rviz time to show the object attached (different color).
sleep(4.0);
edit retag flag offensive close merge delete

Comments

Isn't this the same question as MoveIt Attach Object std::runtime_error?

gvdhoorn gravatar image gvdhoorn  ( 2016-10-26 04:31:29 -0500 )edit

yes, but I had deleted that question before posting this one.

bhavyadoshi26 gravatar image bhavyadoshi26  ( 2016-10-26 07:54:42 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-10-31 10:23:17 -0500

Try and follow the instructions from the moveit.org website here. Your pose's quaternion is ill defined, the "w" component must be "1" if you are trying to set the orientation to identity.

edit flag offensive delete link more

Comments

I set w equal to 1.0 but it still gives the same error.

bhavyadoshi26 gravatar image bhavyadoshi26  ( 2016-11-02 10:33:25 -0500 )edit

Are you running the "move_group" separately? It is required that the move_group node be running in order to service the moveit::planning_interface::MoveGroup requests.

jrgnicho gravatar image jrgnicho  ( 2016-11-02 10:53:25 -0500 )edit

I am running this node after launching the demo.launch from my moveit config package. So move_group is being started automatically with demo.launch

bhavyadoshi26 gravatar image bhavyadoshi26  ( 2016-11-03 02:49:20 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-10-26 03:28:22 -0500

Seen: 930 times

Last updated: Oct 31 '16