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

Implement get_sensor_info() for Pylon (single and tri) and PyBullet drivers #40

Merged
merged 15 commits into from
Aug 21, 2024

Conversation

luator
Copy link
Member

@luator luator commented Aug 20, 2024

Description

In open-dynamic-robot-initiative/robot_interfaces#133, robot_interfaces adds an option to provide static sensor information. Use this to provide information about frame rate and intrinsic/extrinsic camera parameters to the user.

This PR adds a CameraInfo struct which extends CameraParameters by also adding frame rate information. This is used as sensor info in the PylonDriver. TriCameraInfo, used by TriCameraDriver and the PyBulletTriCameraDriver, simply holds an array with a CameraInfo instance for each camera.
Note that in this case the frame rate is stored for each camera separately (but all to the same value), which is maybe not super-nice but adding a more specific struct for TriCamera setup seemed a bit overkill to me.

No sensor info is provided for the OpenCV driver, which I think is not really used anywhere (it was just implemented for easy testing of the pipeline).

For testing this, I also made some adjustments to the demo scripts and added scripts to easily run a camera backend.

Do not merge before

Add executable `single_camera_backend` and add `--multi-processing` flag
to `demo_camera` for easier of the multi-process camera data with only a
single camera.
Add a CameraInfo struct which contains the calibration parameters as
well as the frame rate.  Use this as output for `get_sensor_info()`.

This requires to provide the calibration file to the constructor of the
driver.  The old constructor is still kept for backward compatibility.
In this case, the calibration parameter fields are set to zero.
Frame rate and image size are queried from the camera directly, so these
fields are always set.
Add an overloaded constructor to PylonDriver that expects the path to a
camera info file (including name and the calibration coefficients).  If
used, the data from the file is used to fill the CameraInfo object
returned by get_sensor_info().
Check if the image size provided in the calibration file matches with
what is reported by the camera.  If they don't match, this is likely due
to the wrong calibration file being used, so raise an error.

If initialized without calibration file, the width/height in
camera_info_ should be default-initialized to zero, so skip the check in
that case.
The OpenCV driver is anyway only for testing, so don't bother to add
sensor info there.
Get the calibration parameters from the simulated camera instance (need
to distinct between simple `Camera` and `CalibratedCamera`.
@luator luator added the enhancement New feature or request label Aug 20, 2024
@luator luator self-assigned this Aug 20, 2024
@luator luator merged commit 5cc26b3 into master Aug 21, 2024
4 of 5 checks passed
@luator luator deleted the fkloss/sensor_info branch August 21, 2024 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant