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

How to set start state in moveit except setStartState()

asked 2016-11-08 02:36:59 -0500

Robin Hu gravatar image

updated 2016-11-08 02:38:58 -0500

I do not want my robot plan from current pose. So I try to set start pose of my robot to another pose.

I followed http://docs.ros.org/indigo/api/moveit... , and used setStartState() to change robot start pose.

robot_state::RobotState start_state(*group.getCurrentState());
geometry_msgs::Pose start_pose2;
start_pose2.orientation.w = 1.0;
start_pose2.position.x = 0.55;
start_pose2.position.y = -0.05;
start_pose2.position.z = 0.8;
const robot_state::JointModelGroup *joint_model_group =
                start_state.getJointModelGroup(group.getName());
start_state.setFromIK(joint_model_group, start_pose2);
group.setStartState(start_state);

But, I found setFromIK() always return false and could not find IK solution.

Is there any problem in this program? Or is there other method to set start pose of robot? Thank you very much.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2016-11-08 03:44:15 -0500

rbbg gravatar image

The code seems fine and should work. Judging from the move_group API the setStartState function is the only way to set the start_state, so you can't directly set it to a pose.

Are you using the PR2 or another robot? The code returning False on setFromIK indicates that the IK cannot find a valid solution, which would make sense if you are using a different robot (or different planning group) from the PR2. If you are indeed running the code with another robot, try setting the pose to values which you know are reachable.

edit flag offensive delete link more

Comments

Thank you!I try to setting pose with setJointGroupPositions(). It worked!

Robin Hu gravatar image Robin Hu  ( 2016-11-09 05:16:59 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2016-11-08 02:36:59 -0500

Seen: 2,372 times

Last updated: Nov 08 '16