Skip to content

Commit

Permalink
Parse hardware components instead
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich committed Feb 1, 2025
1 parent 685d0dd commit fcce5fb
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ros2controlcli/ros2controlcli/verb/view_controller_chains.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from controller_manager import list_controllers
from controller_manager import list_hardware_interfaces
from controller_manager import list_controllers, list_hardware_components

from ros2cli.node.direct import add_arguments
from ros2cli.node.strategy import NodeStrategy
Expand Down Expand Up @@ -168,8 +167,12 @@ def show_graph(


def parse_response(list_controllers_response, list_hardware_response, visualize=True):
command_interfaces = {x.name for x in list_hardware_response.command_interfaces}
state_interfaces = {x.name for x in list_hardware_response.state_interfaces}
command_interfaces = {
x.name for hw in list_hardware_response.component for x in hw.command_interfaces
}
state_interfaces = {
x.name for hw in list_hardware_response.component for x in hw.state_interfaces
}
command_connections = dict()
state_connections = dict()
input_chain_connections = {x.name: set() for x in list_controllers_response.controller}
Expand Down Expand Up @@ -211,7 +214,7 @@ def add_arguments(self, parser, cli_name):
def main(self, *, args):
with NodeStrategy(args).direct_node as node:
list_controllers_response = list_controllers(node, args.controller_manager)
list_hardware_response = list_hardware_interfaces(node, args.controller_manager)
list_hardware_response = list_hardware_components(node, args.controller_manager)
parse_response(
list_controllers_response, list_hardware_response, visualize=not args.save
)
Expand Down

0 comments on commit fcce5fb

Please sign in to comment.