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

Remove run.cpu_bound for rotation computation #167

Merged
merged 2 commits into from
Aug 12, 2024
Merged

Conversation

rodja
Copy link
Member

@rodja rodja commented Aug 12, 2024

Caused by #153, resolving the frame on a different process fails:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/process.py", line 261, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rodja/Projects/rosys/rosys/vision/camera_objects_.py", line 81, in get_rotation
    return calibration.extrinsics.resolve().rotation.R  # computing euler rotation is cpu expensive
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rodja/Projects/rosys/rosys/geometry/object3d.py", line 42, in resolve
    return self.relative_to(None)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rodja/Projects/rosys/rosys/geometry/object3d.py", line 36, in relative_to
    return self.transform_with(frame_registry[self._frame_id].resolve())
                               ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'odometer'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/rodja/Projects/nicegui/nicegui/elements/timer.py", line 96, in _invoke_callback
    await result
  File "/Users/rodja/Projects/rosys/rosys/vision/camera_objects_.py", line 51, in update
    await self.update_cameras()
  File "/Users/rodja/Projects/rosys/rosys/vision/camera_objects_.py", line 77, in update_cameras
    camera_groups[uid].rotate_R(await run.cpu_bound(self.get_rotation, camera.calibration))
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rodja/Projects/rosys/rosys/run.py", line 52, in cpu_bound
    return await loop.run_in_executor(process_pool, callback, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'odometer'

As far as I can see, accessing the properties is not cpu intensive. Hence the code could be simplified.

because it's not cpu intensive and resolving the frame on a different process fails
@rodja rodja added the bug Something isn't working label Aug 12, 2024
@rodja rodja added this to the 0.14.0 milestone Aug 12, 2024
@falkoschindler falkoschindler merged commit 432320c into main Aug 12, 2024
4 checks passed
@falkoschindler falkoschindler deleted the simpler-euler branch August 12, 2024 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants