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

only remove lane_idx if exist in closed_lanes #276

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

piliwilliam0306
Copy link
Contributor

Bug fix

Fixed bug

If lane_idx not in closed_lanes, it would show below error:

[fleet_adapter-14] Traceback (most recent call last):
[fleet_adapter-14]   File "/home/will/humble_harmonic/rmf_ws/install/rmf_demos_fleet_adapter/lib/rmf_demos_fleet_adapter/fleet_adapter", line 33, in <module>
[fleet_adapter-14]     sys.exit(load_entry_point('rmf-demos-fleet-adapter==2.5.0', 'console_scripts', 'fleet_adapter')())
[fleet_adapter-14]   File "/home/will/humble_harmonic/rmf_ws/install/rmf_demos_fleet_adapter/lib/python3.10/site-packages/rmf_demos_fleet_adapter/fleet_adapter.py", line 181, in main
[fleet_adapter-14]     rclpy_executor.spin()
[fleet_adapter-14]   File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 294, in spin
[fleet_adapter-14]     self.spin_once()
[fleet_adapter-14]   File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 739, in spin_once
[fleet_adapter-14]     self._spin_once_impl(timeout_sec)
[fleet_adapter-14]   File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 736, in _spin_once_impl
[fleet_adapter-14]     raise handler.exception()
[fleet_adapter-14]   File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/task.py", line 239, in __call__
[fleet_adapter-14]     self._handler.send(None)
[fleet_adapter-14]   File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 437, in handler
[fleet_adapter-14]     await call_coroutine(entity, arg)
[fleet_adapter-14]   File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 362, in _execute_subscription
[fleet_adapter-14]     await await_or_execute(sub.callback, msg)
[fleet_adapter-14]   File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 107, in await_or_execute
[fleet_adapter-14]     return callback(*args)
[fleet_adapter-14]   File "/home/will/humble_harmonic/rmf_ws/install/rmf_demos_fleet_adapter/lib/python3.10/site-packages/rmf_demos_fleet_adapter/fleet_adapter.py", line 459, in lane_request_cb
[fleet_adapter-14]     closed_lanes.remove(lane_idx)
[fleet_adapter-14] KeyError: 2

This PR will check if lane_idx in closed_lanes before calling closed_lanes.remove(lane_idx)

@piliwilliam0306 piliwilliam0306 changed the title only remove if lane_idx exist in closed_lanes only remove lane_idx if exist in closed_lanes Jan 23, 2025
Copy link
Member

@Yadunund Yadunund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@Yadunund Yadunund merged commit 989135c into open-rmf:main Jan 23, 2025
3 checks passed
@Yadunund
Copy link
Member

@Mergifyio backport jazzy humble

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

Successfully merging this pull request may close these issues.

2 participants