RethinkRobotics / sawyer_simulator

Gazebo Simulation interface for the Sawyer Robot
http://sdk.rethinkrobotics.com/intera/Gazebo_Tutorial
Apache License 2.0
50 stars 65 forks source link

Add SumJointHandle, SharedJointInterface; Gravity Compensation controller #12

Closed rethink-rlinsalata closed 7 years ago

rethink-rlinsalata commented 7 years ago

Putting some interfaces in your interfaces. It's an interface to sum interfaces!


Add SharedJointInterface; Gravity Compensation controller

Introduce the SumJointHandle and SharedJointInterface, which allow for multiple controllers to command a single joint by summing the commanded values from each controller into a final output to the sim-joint.

The SharedJointInterface takes the place of the EffortJointInterface, from which controllers request JointHandles. The JointHandles behave exactly the same, but multiple unique handles can be commanded at the same time by a controller requesting a JointHandle with an additional 'sub-type' parameter.

This allows the introduction of the GravityCompensation Controller, which adds a parallel component to offset gravity to the commanded effort for each joint.

Major pieces:

Add copies of upstream effort_controllers to take SharedHWInterface

The normal ros_controllers/effort_controllers used by the SawyerControllers to control each joint do not allow a subclass of the EffortJointInterface to be passed in as a replacement. Thus, we need to (temporarily) copy in the upstream effort_controllers so that we can change them to take the SharedJointInterface.

We should remove these copies once we can upstream a change to make the init() and constructor virtual (or some similar modification) so that interfaces that inherit from EffortJointInterface can be used instead.