Skip to content

Controller sorting can cause segfaults when interfaces are created on controller configuring #1164

Closed
@fmauch

Description

@fmauch

Describe the bug
There are controllers that specify their interfaces in on_configure such as the force_torque_sensor_broadcaster. Maybe that's an error already then we can close this here and I'll make a PR on the FTS broadcaster.

However that can lead to situations where when the FTS broadcaster is loaded but not yet configured and another controller is configured the controller sorting in configuring the other controller will also check the FTS broadcasterf for sorting. For this it will try to fetch all state and command interfaces which will use the force_torque_sensor_ object which unfortunately is a nullpointer before the FTS broadcaster has been configured.

To Reproduce
Steps to reproduce the behavior:

  1. Make a hardware with a JS broadcaster and an FTS broadcaster.
  2. Load both controllers
  3. configure the JS broadcaster
  4. controller_manager will die

Expected behavior
First of all I would expect things not to crash. One question is whether unconfigured controllers should be used for sorting, as well (see questions below).

Screenshots
I hope the problem is clear without screenshots.

Environment (please complete the following information):

  • OS: ubuntu 22.04
  • Version: Humble (probably also a problem on Iron and Rolling, but I have other issues there, as well.)

Possible solutions / workarounds
I see two possible solutions, but I am not sure which one would be preferred:

  • Is it intentional that controller sorting also considers unconfigured controllers? If so, this is currently violating this statement. We could probably add a switch in the sorting algorithm to check the other controller for being at least configured.
  • Is there a reason why the FTS broadcaster is reading its interface parameter during configuration and not during initialization? Changing this would probably fix the problem (I tested this locally and it helped).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions