Hi Joris,
i had similar problems when setting the start state to the current state
in the past. I observed that a second motion did not start at the
current position and it was not a visualization issue. Additionally, i
had some object attached to the endeffector, which was not considered in
planning when using group.setStartStateToCurrentState(). My current
workaround is to explicitly request the planning scene using a service
call and then use the current state from that scene. I am using
ROS-Indigo packages in Ubuntu 14.04 (there might be differences to Hydro
...).
// initialization
const std::string PLANNING_SCENE_SERVICE = "get_planning_scene";
planning_scene_monitor::PlanningSceneMonitorPtr
planning_scene_monitor_ =
boost::make_shared<planning_scene_monitor::PlanningSceneMonitor>("robot_description",
tf_listener_);
moveit::planning_interface::MoveGroup group("arm")
// each time the current state is needed
planning_scene_monitor_->requestPlanningSceneState(PLANNING_SCENE_SERVICE);
planning_scene_monitor::LockedPlanningSceneRW ps(planning_scene_monitor_);
ps->getCurrentStateNonConst().update();
robot_state::RobotState current_state = ps->getCurrentState();
group.setStartState(current_state);
I do not recall if without attached objects
group.setStartStateToCurrentState() was sufficient.
I have some more notes. First, the setup consists of two nodes, the
move_group node and a client node which uses an instance of
moveit::planning_interface::MoveGroup to communicate with the move_group
node. Therefore, if we want to access the current state in the client
node, there has to be some communication to retrieve it. I think a
blocking call in the client node blocks the whole move_group node. This
could prevent us from getting the latest state (?). In your example you
had a sleep(5.0), so this should not be an issue.
Second, from looking at the code, i know that
group.setStartStateToCurrentState() circumvents this problem by not
setting any start state in the planning request, resulting in move_group
using its own current state. This should be what we want, but in my case
with attached object, collisions of the object were not avoided, hence
the above workaround. This also implies that
group.setStartStateToCurrentState() and group.setStartState(
*group.getCurrentState()) are not the same.
@Yoan
I do not understand your answer. If you do
> group.setPoseTarget(idle_pose); // Go to idle pose
> group.setPoseTarget(target_pose1); // Go to goal 1
> group.setPoseTarget(idle_pose); // Go to idle pose
> group.setPoseTarget(target_pose2); // Got to goal 2
each call overwrites the previous pose target. And the final call to
success = group.move();
will plan and move only to target_pose2.
regards
Jochen
On 27.04.2015 17:46, Yoan Mollard wrote:
> Hi Joris,
>
> Your video on Google Drive is private.
>
> It looks like you need to go back to an idle position between each goal.
> It seems that several targets in MoveIt are considered as way points, so
> if you need to reach several goals by returning to an idle (=starting)
> position between them, then you should set your idle position as an
> intermediary goal.
>
> geometry_msgs::Pose idle_pose;
> // Fill idle_pose here with current or whatever pose
> group.setPoseTarget(idle_pose); // Go to idle pose
> group.setPoseTarget(target_pose1); // Go to goal 1
> group.setPoseTarget(idle_pose); // Go to idle pose
> group.setPoseTarget(target_pose2); // Got to goal 2
> // Add new goals here
> success = group.move(); // Plan and move according to the way points
> defined hereabove
>
> Consider that your robot cannot jumpy from point A to point B without
> indication about how to go there (could be motion planning,
> interpolation in joint space, interpolation in task space, ...). If you
> do jump between A and B and send this direcly to the controllers you
> will most likely damage your motors that will perform this motion at
> full speed with maximum energy. Thus even the return trajectory going
> back in idle position must be planned through a new MoveIt goal.
>
> *Yoan Mollard*
> Research engineer – 3rd hand project
> *
> INRIA Research center, Flowers lab*
> *
http://flowers.inria.fr/
> *
> *
http://3rdhandrobot.eu/
> *
>
>
> ------------------------------------------------------------------------
>
> *From: *"Joris Beuls" <
joris...@student.uhasselt.be>
> *To: *
moveit...@googlegroups.com
> *Cc: *"joris beuls" <
joris...@student.uhasselt.be>, "yoan
> mollard" <
yoan.m...@inria.fr>
> *Sent: *Monday, 27 April, 2015 4:19:58 PM
> *Subject: *Re: Set a start state for the robot
> *Yoan Mollard*
> Research engineer – 3rd hand project
> *
> INRIA Research center, Flowers lab*
> *
http://flowers.inria.fr/
> *
> *
http://3rdhandrobot.eu/
> *
>
>
> ------------------------------------------------------------------------
>
> *From: *"Joris Beuls" <
joris...@student.uhasselt.be>
> *To: *
moveit...@googlegroups.com
> *Sent: *Thursday, 23 April, 2015 11:01:35 AM
> *Subject: *Set a start state for the robot
> moveit::planning_interface::MoveGroupgroup("epson_arm");