moveit / moveit2

:robot: MoveIt for ROS 2
https://moveit.ai/
BSD 3-Clause "New" or "Revised" License
1.03k stars 508 forks source link

Remove outdated and unused code #1038

Closed henningkayser closed 1 year ago

henningkayser commented 2 years ago

This epic is meant to coordinate efforts that make MoveIt leaner which helps us with keeping up with maintenance and and with making bigger changes in the future. It is also a first step for disentangling the code base. Here is a list of things that can either be removed or better be replaced with other libraries.

moveit_core

moveit_ros

moveit_planners

AndyZe commented 2 years ago

I think the controller_manager should also be removed since:

v4hn commented 2 years ago

I just saw this issue, so let me give my two cents for the discussed modules

yes, the interfaces in MGI should target the MTC capability instead (my fault for not reviewing/reworking the plugin there, I believe it needs more work)

Yes and no. It should be severely simplified at least and doesn't need the plugin interface. I do see a lot of merit in being able to specify which controllers should be used to actuate a given trajectory inside MoveIt. But to do that we could simply forward the requested controllers to the typical ros_control service API (assuming it exists) before execution. The obscure logic to decide the controller to use before execution should just be dropped. My main point about this years ago was that ros_control does it better anyway, so why even give yet another plugin API in MoveIt.

So you would want to remove RobotState::getJacobian as well and ban it to the IK solver plugins (which would implement it in very similar ways each)? These two methods are rather similarly important from my perspective and basic operators in robotics in their respective aspects. It's just that we (sadly) don't provide more interfaces that use dynamics handling. For example it would be brilliant to see this integrated with OMPL and the planner interfaces for better optimization objectives.

This could be renamed/simplified to something directly stating "ManipulabilityIndex", but aside from that it's a smaller sibling version of the other two. This is free "you can compute that with MoveIt" functionality, that some people consider basic computations on robot kinematic structures.

What's wrong with MOVEIT_CLASS_FORWARD which is used virtually everywhere? The deprecation.h header is indeed outdated, but aside from that I don't see what you would remove? (console_colors.h would be a candidate if you had an equally simple workaround)

It's how the planning scene maintains transforms and @JafarAbdi even failed to remove it for ROS at some point in the past because the API permeates quite a lot.

yes to splitting out the test utils. The rest seems core enough to me (it's basically a few free functions you need everywhere). But if you insist on keeping moveit_utils separately for no gain but more overhead, go ahead?

Is it common for python wrappers to be in separate packages? Sounds weird to me, but if you think you gain something that justifies more overhead with package version synchronization, it might make sense...

I guess I gave my opinion here already.

It sure is dead code. :+1:

v4hn commented 2 years ago

For two additional "external" components we depend on I would like to add to the list

schornakj commented 2 years ago

The obscure logic to decide the controller to use before execution should just be dropped.

@v4hn There are several important cases where the TrajectoryExecutionManager is expected to just figure out which controller to use when executing subtrajectories that do not specify a controller. For example, MTC's ExecuteTaskSolution capability doesn't have a way to get controller names for the different parts of the solution when putting together an ExecutableMotionPlan. I agree that the TEM's controller prioritization logic is a good thing to eliminate (it's incompletely implemented anyway -- it doesn't even have a way to get whether a given controller is active or default currently). How should we approach introducing the requirement that trajectories need to include controller info to be executed?

v4hn commented 2 years ago

I believe you got me wrong there. I meant the obscure logic, that compares subsets of controllers to choose which to activate using joint subsets. there's quite a lot of code there that makes you wonder what its use-case ever was.

for all existing use-cases I know of there is only a single such subset because each joint is mapped to exactly one controller. For all further use-cases I can come up with it would suffice to be able to specify a different controller with a specific trajectory for the execution managers to change the controller if necessary.

mikeferguson commented 2 years ago

Just noticed this ticket - I'd like to pipe in with one additional note about controller stuff: not everyone uses ros2_control on their robot (there are other interfaces out there) - so ideally whatever simplify towards does not require leveraging the ros2_control configuration stuff (control_msgs/FollowJointTrajectory is really the kind of API level that should be leveraged - mapping joints to particular action servers).

henningkayser commented 1 year ago

I'm closing this since the original purpose of this epic is fulfilled (identifying and removing stale, commented, unused code). There are still some ongoing refactorings that go beyond removal (random_numbers, exceptions) so I removed them from this epic. I like the discussions about better controller support, but they are clearly off-topic here and should be continued in a different issue.