Ask Your Question

Set robot to position without planning

asked 2020-05-13 06:51:32 -0600

BrandDebiel gravatar image

Dear All,

I have been searching around the web for a solution for this as I think it will be an easy one. However I cannot find something that gives a proper solution for this.

What I want to do is set the manipulator arm in Rviz instantly at a certain position without using the planner. What I want to do is set the manipulator in a start position. Then set the goal position and start planning from that specific pose to the goal pose. Is this possible? And what would be the right steps to do so. I am using MoveIt and program in C++.

Thanks in advance.

edit retag flag offensive close merge delete


Rufus gravatar image Rufus  ( 2020-09-02 22:35:24 -0600 )edit

Also see if this answer helps

Rufus gravatar image Rufus  ( 2020-09-02 22:47:43 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-05-14 02:54:49 -0600

BrandDebiel gravatar image

updated 2020-05-14 02:55:01 -0600

Found out the answer after some more web research:

Basically get the current state, set the joints to whatever position you like and call setStartState:

moveit::planning_interface::MoveGroupInterface m_moveGroup("arm_group");
moveit::planning_interface::PlanningSceneInterface m_planningSceneInterface;
moveit::planning_interface::MoveGroupInterface::Plan m_plan;
PlanInterface planInterface(&m_moveGroup, &m_planningSceneInterface, &m_plan);

robot_model_loader::RobotModelLoader robot_model_loader("robot_description");
robot_model::RobotModelPtr kinematic_model = robot_model_loader.getModel();
planning_scene::PlanningScene planning_scene(kinematic_model);

robot_state::RobotState& current_state = planning_scene.getCurrentStateNonConst();
std::vector<double> joint_values = { 1.57, 1.57, 1.57, 1.57, 1.57, 1.57 };
const robot_model::JointModelGroup* joint_model_group = current_state.getJointModelGroup("arm_group");
current_state.setJointGroupPositions(joint_model_group, joint_values);

Now the planner will use joint_values as the start pose to plan from. In Rviz however teh start state will not change. Only once the planner start the trajectory will become visible with the starts state.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-05-13 06:51:32 -0600

Seen: 188 times

Last updated: May 14 '20