Ask Your Question
1

How to change MoveIt! goal state through code?

asked 2017-03-20 06:12:04 -0600

HenrySleek gravatar image

updated 2017-03-21 11:14:51 -0600

I am working with ROS Indigo and MoveIt! and I already set up my robot through the setup assistant, and In Rivz I can see the start and goal state, in green and orange. I can manually move the orange goal state from Rviz and then plan and execute a trajectory in order to reach it. Otherwise, I have a piece of code that sets a goal trajectory and plans and executes the whole trajectory to it.

But I would like to just move the (orange) goal state to a new position through a piece of code, without planning any trajectory. Just changing the goal state. How can I do it?

edit retag flag offensive close merge delete

Comments

Please stop editing your posts over and over again. This sends out notification emails every time to everyone who watches ros-answers.

v4hn gravatar imagev4hn ( 2017-03-21 05:38:26 -0600 )edit

Oh damn, I am sorry, I didn't know. I just wanted to have it pop up at the top of the question list in the Home page. I will stop now that I have an answer.

HenrySleek gravatar imageHenrySleek ( 2017-03-22 05:34:17 -0600 )edit

Hey you said that you had a piece of code that sets a goal trajectory and plans and executes that trajectory? I am struggling to figure out how to do this, would you mind giving some details?

levi strauss gravatar imagelevi strauss ( 2018-07-03 15:11:45 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-03-21 05:36:51 -0600

v4hn gravatar image

MoveIt's RViz display is mostly independent. The orange goal state corresponds to the goal state of the display only. There is no such thing as a "global goal state".

So actually you are looking for a way to tell the motion planning display to update the robot state it maintains as its goal state. Others asked for more general remote-control functionality of the whole motion planning display in the past. There is no satisfying implementation of this at the moment. Someone implemented a small part of it a while ago, but apparently lost interest. Since then, nobody provided patches to improve on the current state...

So this is what you can do out of the box:

If you check the "Allow External Comm." box in the planning tab, then you can send an std_msgs/Empty message to the /rviz/moveit/update_goal_state topic and the goal state will be set to the current state of the robot.

This is setup here: https://github.com/ros-planning/movei...

and implemented https://github.com/ros-planning/movei... .

It is pretty straight-forward and at most an afternoon of work to add another callback that receives a moveit_msgs/RobotState.msg and updates the start state or goal state with it.

A patch for this (and a pull-request for the moveit repository) would be awesome!

edit flag offensive delete link more

Comments

I checked that code and indeed it's really a pity that nobody tried to expand it. Anyway, maybe it is enough to call a planning_display_->setQueryGoalState(state); setting the wanted state. Though, trying it, I have the following problem: http://answers.ros.org/question/25752...

HenrySleek gravatar imageHenrySleek ( 2017-03-21 11:13:07 -0600 )edit

Yes and no. You can't do that from outside the rviz display, i.e. from your own node. You can just add another callback and subscriber though, that receives a moveit_msgs/RobotState.msg and calls planning_display_->setQueryGoalState() with that one.

v4hn gravatar imagev4hn ( 2017-03-21 12:03:12 -0600 )edit

I see. But I prefer not modifying the source code, since now it's installed with binaries and I didn't want to put my hands on it. Is there a way for doing it with MoveIt! installed from binaries?

HenrySleek gravatar imageHenrySleek ( 2017-03-22 03:03:17 -0600 )edit

It is quite easy to compile moveit locally (see install section on the website). If you implement the missing function and add a pull-request to the repository, we could have it in the next release and then you don't need your own source build anymore :) This is how open source contributions work...

v4hn gravatar imagev4hn ( 2017-03-22 05:32:54 -0600 )edit

If you are not willing to edit MoveIt source code, then no. You can't change the goal start arbitrarily (until someone contributed this functionality).

v4hn gravatar imagev4hn ( 2017-03-22 05:34:32 -0600 )edit

A tested patch is available here: https://github.com/phy25/moveit/tree/... . A PR will be made soon.

phy gravatar imagephy ( 2018-04-04 09:41:44 -0600 )edit

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-03-20 06:12:04 -0600

Seen: 1,347 times

Last updated: Mar 21 '17