How to use setPositionTarget method of MoveGroup [closed]
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);
spinner.start();
// 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);
group.setPositionTarget(x,y,z);
// plan the motion and then move the group to the sampled target
group.move();
ros::waitForShutdown();
}
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~
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).
I am having a same kind of problem, Can you give any suggestions ?