On Fri, Dec 02, 2016 at 06:46:28AM -0800, 'Daniel Hoeltgen' via MoveIt! Users wrote:
> My first approach was to use or improve the existing functionality, but I
> couldn't really get behind how all this is working.
Welcome to the murky waters of middleware-engineering,
But I suppose you're somewhat used to it, otherwise you wouldn't send mails to this list. :)
> It seems that the move_group::execute() method forwards the trajectory to the
> execute_kinematic_path service but I couldn't find where exactly this
> service is started and where the received trajectory message is passed to
> sendTrajectory().
You missed one level of abstraction. MoveGroupInterface (until recently MoveGroup)
is the client side that calls a service (by recent addition alternatively an Action)
of the move_group node. This service is provided by a capability, that receives the plan
and pushes it to the execution manager here:
https://github.com/ros-planning/moveit/blob/kinetic-devel/moveit_ros/move_group/src/default_capabilities/execute_trajectory_service_capability.cpp#L82
This manager then chooses a set of applicable controllers that together can execute the trajectory,
switches them to active as required here
https://github.com/ros-planning/moveit/blob/kinetic-devel/moveit_ros/planning/trajectory_execution_manager/src/trajectory_execution_manager.cpp#L1576 ,
and eventually pushes the trajectories (or segments) to the selected controllers.
To decide applicability of controllers, it compares some characteristics of the controllers
and (among other things) prefers active controllers.
> I interpret it like this: The service is somehow provided by the
> simple_controller_manager plugin. In general we would just have to
> implement a message for switching controllers and change the handle object.
> But if it's really so easy I can't see why this is not implemented yet.
Well, it's a bit more complicated as you probably see from the pointers above. (:
One could implement logic in the movit_simple_controller_manager to make it support
"active" controllers with a simple bitmask stored in the controller manager,
implement switchControllers, add a forward method for this method to the
TrajectoryExecutionManager interface (not sure if this would be needed,
but it seems one can't directly unload a controller within moveit)
and then add a MoveGroupCapability that provides a ROS service to call that method
on the loaded manager. That's some thoughts off the top of my head...
> You can use a different controller manager plugin like the
> ros_control_interface
> <
https://github.com/ros-planning/moveit/tree/kinetic-devel/moveit_plugins/moveit_ros_control_interface>.
> This switches your ros controllers automatically and handles them correctly.
You can switch controllers on the ros-control side.
As this is forwarded to MoveIt by moveit_ros_control_interface,
the trajectory execution manager should prefer the now-active controller
according to the logic I described above (if they are otherwise equal).
So that way it probably is possible to change controllers without
having to tell MoveIt explicitly. No idea why I didn't see that when I wrote the previous mail.
Even so, this whole apparatus makes it pretty complex to turn the current concept
of a Controller*Manager* in MoveIt into one of a Controller*Interface* (this is what Dave proposed in the issue).
v4hn
--
Michael Görner, M.Sc. Cognitive Science, PhD Student
Universität Hamburg
Faculty of Mathematics, Informatics and Natural Sciences
Department of Informatics
Group Technical Aspects of Multimodal Systems
Vogt-Kölln-Straße 30
D-22527 Hamburg
Room: F-315
Phone:
+49 40 42883-2342