Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tf2 exception handling in detections callback #19

Open
simutisernestas opened this issue Nov 17, 2020 · 0 comments
Open

Tf2 exception handling in detections callback #19

simutisernestas opened this issue Nov 17, 2020 · 0 comments

Comments

@simutisernestas
Copy link
Contributor

Bug report

Required Info:

  • Operating System:
    • Ubuntu 20.04
  • ROS2 Version:
    • Foxy binary
  • DDS implementation:
    • Fast-RTPS

Steps to reproduce issue

If this function gets msg without specified frame_id, tf2 throws an exception, which is not handled.

def callback(self, msg):
    '''callback function for detection result'''

Error:


[INFO] [launch]: All log files can be found below /home/ernestas/.ros/log/2020-11-15-14-41-55-170412-ernestas-pc-47727
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [kf_hungarian_node-1]: process started with pid [47729]
[kf_hungarian_node-1] Traceback (most recent call last):
[kf_hungarian_node-1]   File "/home/ernestas/nav2_dyn/install/kf_hungarian_tracker/lib/kf_hungarian_tracker/kf_hungarian_node", line 33, in <module>
[kf_hungarian_node-1]     sys.exit(load_entry_point('kf-hungarian-tracker', 'console_scripts', 'kf_hungarian_node')())
[kf_hungarian_node-1]   File "/home/ernestas/nav2_dyn/build/kf_hungarian_tracker/kf_hungarian_tracker/kf_hungarian_node.py", line 257, in main
[kf_hungarian_node-1]     rclpy.spin(node)
[kf_hungarian_node-1]   File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/__init__.py", line 191, in spin
[kf_hungarian_node-1]     executor.spin_once()
[kf_hungarian_node-1]   File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 687, in spin_once
[kf_hungarian_node-1]     raise handler.exception()
[kf_hungarian_node-1]   File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/task.py", line 239, in __call__
[kf_hungarian_node-1]     self._handler.send(None)
[kf_hungarian_node-1]   File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 407, in handler
[kf_hungarian_node-1]     await call_coroutine(entity, arg)
[kf_hungarian_node-1]   File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 332, in _execute_subscription
[kf_hungarian_node-1]     await await_or_execute(sub.callback, msg)
[kf_hungarian_node-1]   File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 118, in await_or_execute
[kf_hungarian_node-1]     return callback(*args)
[kf_hungarian_node-1]   File "/home/ernestas/nav2_dyn/build/kf_hungarian_tracker/kf_hungarian_tracker/kf_hungarian_node.py", line 101, in callback
[kf_hungarian_node-1]     trans = self.tf_buffer.lookup_transform(self.global_frame, msg.header.frame_id, rclpy.time.Time())
[kf_hungarian_node-1]   File "/home/ernestas/nav2_dyn/install/tf2_ros/lib/python3.8/site-packages/tf2_ros/buffer.py", line 112, in lookup_transform
[kf_hungarian_node-1]     return self.lookup_transform_core(target_frame, source_frame, time)
[kf_hungarian_node-1] tf2.InvalidArgumentException: Invalid argument "" passed to lookupTransform argument source_frame - in tf2 frame_ids cannot be empty
[ERROR] [kf_hungarian_node-1]: process has died [pid 47729, exit code 1, cmd '/home/ernestas/nav2_dyn/install/kf_hungarian_tracker/lib/kf_hungarian_tracker/kf_hungarian_node --ros-args -r __node:=kf_hungarian_node --params-file /home/ernestas/nav2_dyn/install/kf_hungarian_tracker/share/kf_hungarian_tracker/config/kf_hungarian.yaml'].

Expected behavior

All possible tf2 exceptions should be considered.

Actual behavior

Node crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant