PickNikRobotics / ros_control_boilerplate

Provides a simple simulation interface and template for setting up a hardware interface for ros_control
BSD 3-Clause "New" or "Revised" License
244 stars 89 forks source link

Export SimHWInterface for combined_robot_hw #34

Open RobertWilbrandt opened 4 years ago

RobertWilbrandt commented 4 years ago

It is surprisingly useful to have a purely kinematic simulation of a hardware interface in a combined_robot_hw. Using a custom adapter i already used it to allow for partially-simulated execution in a more complex combined_robot_hw setup, and it generally makes switching between real hardware and simulation in such projects much easier. I would however prefer this to be an upstream feature of ros_control_boilerplate (and am happy to provide a PR for it) for the following reasons:

Unfortunately i don't think simply changing SimHWInterface (or GenericHWInterface) would be possible without quite some restructuring, as pluginlib requires a parameterless constructor. Thus i would create an extra adapter class deriving from hardware_interface::RobotHW which would hold a SimHWInterface as a member and delay it's construction until init(), simply delegating all relevant calls from there on.

The way i see it the required steps for this are:

I'm happy to hear about opinions, otherwise i'd start implementing this in the next days.

Tuebel commented 3 years ago

I have just stumbled over this issue after opening PR #42 which is intended to bring support for combined_robot_hw. Definitely agree that an adapter could be a good solution. More concerns and ideas can be found in the PR, I don't want to cross-post too much.