safe-ros / ros2_profiling

A set of tools and techniques for evaluating performance of ROS 2 based systems
Apache License 2.0
15 stars 4 forks source link

Tolerate subscriptions for which no callback is found #28

Closed tvaeth closed 1 year ago

tvaeth commented 1 year ago

Ocassionally, we get data recordings where the processing via ros2 profile process prompts an error message that association of the subscription callbacks fails:

Traceback (most recent call last):

  File "/opt/ros/humble/bin/ros2", line 33, in <module>

    sys.exit(load_entry_point('ros2cli==0.18.5', 'console_scripts', 'ros2')())

  File "/opt/ros/humble/lib/python3.10/site-packages/ros2cli/cli.py", line 89, in main

    rc = extension.main(parser=parser, args=args)

  File "~/safe-ros/install/ros2profile/lib/python3.10/site-packages/ros2profile/command/profile.py", line 35, in main

    return extension.main(args=args)

  File "~/safe-ros/install/ros2profile/lib/python3.10/site-packages/ros2profile/verb/process.py", line 27, in main

    process(args.input_path)

  File "~/safe-ros/install/ros2profile/lib/python3.10/site-packages/ros2profile/api/process.py", line 131, in process

    graph = build_graph(events)

  File "~/safe-ros/install/ros2profile/lib/python3.10/site-packages/ros2profile/data/__init__.py", line 136, in build_graph

    _associate_subscription_callbacks(ret)

  File "~/safe-ros/install/ros2profile/lib/python3.10/site-packages/ros2profile/data/__init__.py", line 573, in _associate_subscription_callbacks

    sub_cb_events = subscription.callback.events()

  File "~/safe-ros/install/ros2profile/lib/python3.10/site-packages/ros2profile/data/subscription.py", line 203, in callback

    return self._callback

AttributeError: 'Subscription' object has no attribute '_callback'. Did you mean: 'callback'?

A closer look on the matter showed that this, in our case, was related to the /parameter_events topic for which ignoring a failed callback association (+ printing a warning) seems to be fine to be able to proceed with data analysis. Especially since the issue can occur for a row of subsequent recordings.

mjcarroll commented 1 year ago

Closed by #29