Ask Your Question

How to use setPositionTarget method of MoveGroup [closed]

asked 2013-07-07 02:15:13 -0600

Albert K gravatar image

I follow the tutorial on MoveIt successfully on Groovy, Ubuntu 12.04. And then I would like to modify the code to specify the position of the goal. Therefore I check the API and find this method:

setPositionTarget (double x, double y, double z, const std::string &end_effector_link="")

So here is the code after some modification:

#include <ros/ros.h>
#include <moveit/move_group_interface/move_group.h>

int main(int argc, char **argv)
  if( argc < 4)
          ROS_ERROR("Usage: [your program name] x y z");
          return -1;

  ros::init(argc, argv, "move_group_interface_demo", ros::init_options::AnonymousName);
  // start a ROS spinning thread
  ros::AsyncSpinner spinner(1);
  // this connecs to a running instance of the move_group node
  move_group_interface::MoveGroup group("right_arm");

  double x = atof(argv[1]);
  double y = atof(argv[2]);
  double z = atof(argv[3]);
  ROS_INFO("Move to : x=%f, y=%f, z=%f",x,y,z);

  // plan the motion and then move the group to the sampled target 

It simply gets the input (x,y,z) point and send to setPositionTarget. However, when I run this code, I always get the following messages:

[ INFO] [1373198852.715022422, 4391.182000000]: Ready to take MoveGroup commands for group right_arm.
[ INFO] [1373198852.715148228, 4391.183000000]: Move to : x=1.000000, y=-0.200000, z=1.500000
[ INFO] [1373198857.757555026, 4395.171000000]: ABORTED: No motion plan found. No execution attempted.

In the move_group.launch terminal I get:

[ INFO] [1373198852.715678219, 4391.183000000]: Combined planning and execution request received for MoveGroup action. Forwarding to planning and execution pipeline.
[ INFO] [1373198852.715763527, 4391.183000000]: Planning attempt 1 of at most 1
[ INFO] [1373198852.716399837, 4391.183000000]: Starting state is just outside bounds (joint 'r_wrist_flex_joint'). Assuming within bounds.
[ INFO] [1373198852.723363965, 4391.183000000]: Starting with 1 states
[ERROR] [1373198857.732519018, 4395.159000000]: Unable to sample any valid states for goal tree
[ INFO] [1373198857.732570153, 4395.159000000]: Created 1 (1 start + 0 goal) states in 1 cells (1 start (1 on boundary) + 0 goal (0 on boundary))
[ INFO] [1373198857.732592218, 4395.159000000]: No solution found after 5.010660 seconds
[ INFO] [1373198857.756456336, 4395.170000000]: Unable to solve the planning problem

The robot arm will never move.

I've tried many target points which are feasible when I use arm_navigation, but here I always got the same messages.

Is ther anything wrong using setPositionTarget method here? Thanks for any help~

edit retag flag offensive reopen merge delete

Closed for the following reason Question does not follow our guidelines for questions. Please see: for more details. by Albert K
close date 2013-07-10 23:58:19


You'll probably get better support on the moveit-users mailing list, the MoveIt developers seem to rather respond there than here. Just repost your question there (maybe with a link here).

Martin Günther gravatar image Martin Günther  ( 2013-07-07 03:30:03 -0600 )edit

I am having a same kind of problem, Can you give any suggestions ?

dinesh_sl gravatar image dinesh_sl  ( 2014-06-21 04:34:48 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2013-07-10 21:36:52 -0600

fivef gravatar image

For me setPositionTarget() works.

  1. with move_group->getEndEffectorLink() check if your end-effector is correct. (or you can just pass your end-effector name as string as a 4th argument)
  2. make sure the position you pass into getEndEffectoLink() is reachable with this end-effector. The values you used would not be reachable for my robot (Neuronics katana), but it depends on your robot.
edit flag offensive delete link more


I can't reproduce the problem on my laptop, so I just close the question. Sorry for that.

Albert K gravatar image Albert K  ( 2013-07-10 23:59:10 -0600 )edit

Question Tools

1 follower


Asked: 2013-07-07 02:15:13 -0600

Seen: 2,997 times

Last updated: Jul 10 '13