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

'AfWindows' parameter occurs error. #13

Closed
Woojin-Crive opened this issue Oct 28, 2023 · 15 comments · Fixed by #15
Closed

'AfWindows' parameter occurs error. #13

Woojin-Crive opened this issue Oct 28, 2023 · 15 comments · Fixed by #15

Comments

@Woojin-Crive
Copy link

Error

terminate called after throwing an instance of 'std::length_error'
  what():  cannot create std::vector larger than max_size()

Debug

"error " << id->type() << ", " << id->name() << ", " << info.def().toString() << ", " << info.min().toString() << ", " << info.max().toString());
error 7, AfWindows, (0, 0)/0x0, (0, 0)/0x0, (65535, 65535)/65535x65535

Error is caused when the below code is executed.

const rclcpp::ParameterValue value =
      cv_to_pv(clamp(info.def(), info.min(), info.max()), extent);
@Woojin-Crive Woojin-Crive mentioned this issue Oct 28, 2023
@christianrauch
Copy link
Owner

Can you please provide the details (libcamera version, camera hardware, etc.) and steps to reproduce this?

@Woojin-Crive
Copy link
Author

i am using
libcamera v0.1.0+103-02eea04
raspberry camera module v3 (imx708)
latest raspberry pi os (Debian GNU/Linux 12 (bookworm))

just running the given code can reproduce the error.

@christianrauch
Copy link
Owner

Can you provide a proper gdb backtrace to see where exactly the exception is thrown and what the content of the variables is?

Can you show the content of extent and also show what std::vector<T,Allocator>::max_size is? I assume the exception comes from

return cv_to_pv_array(std::vector<T>(extent, values[0]));
because extent is larger than std::vector<T>::max_size or negative.

@Woojin-Crive
Copy link
Author

Sorry for the dirty pull request and commits. I am not familiar with using git..
I closed the pull request.

If you give me some time. I will try to get the backtrace information.

@Woojin-Crive
Copy link
Author

Woojin-Crive commented Oct 29, 2023

extent => 18446744073709551615
max size of std::vector<T> => 576460752303423487

As you expected, extent is larger than std::vector<T>::max_size .

@christianrauch
Copy link
Owner

I see the issue now. AfWindows is defined as Control<Span<const Rectangle>>, i.e. it takes a dynamic list of "windows", and happens to be the only control that has no fixed extent (length) specified. The default value for the extent is libcamera::dynamic_extentwhich is simply the maximum possible value the type std::size_t can take.

Can you check if #15 fixes the issue for you?

@Woojin-Crive
Copy link
Author

I will check it today, thank you!

@Woojin-Crive
Copy link
Author

Woojin-Crive commented Nov 2, 2023

camera_node: ../include/libcamera/controls.h:167: T libcamera::ControlValue::get() const [with T = libcamera::Span<const libcamera::Rectangle>; typename std::enable_if<(libcamera::details::is_span<U>::value || std::is_same<std::__cxx11::basic_string<char>, typename std::remove_cv< <template-parameter-1-1> >::type>::value), std::nullptr_t>::type <anonymous> = nullptr]: Assertion 'isArray_' failed.

This is not working. Detailed information will be added later.

@Asd2gogo
Copy link

Asd2gogo commented May 3, 2024

I have a similar hw setup as mentioned in #13 (comment)

  • libcamera v0.2.0+120-eb00c13d
  • raspberry camera module v3 (imx708)
  • Ubuntu 22.04

I ran into the same 'cannot create std::vector..' issue.
I've tried #15 and got the same result as mentioned in #13 (comment)

Any further idea on how to fix this?

@Woojin-Crive
Copy link
Author

You can just skip the parameter
#14 (comment)

@christianrauch
Copy link
Owner

I only have a "Camera Module v1" (OV5647) and therefore cannot test the node with any other Camera Module. I tried to mock the AfWindows control to reproduce this and fixed this in #15. But in #13 (comment), it was reported that this still causes issues with the real "Camera Module 3" (IMX708).

@Asd2gogo You can check if #15 fixes your issue?

@Asd2gogo
Copy link

Asd2gogo commented May 5, 2024

Yea, i have tried #15, but got the same error that was reported in #13 (comment).

@christianrauch
Copy link
Owner

A general comment on hardware support:
I only have a Camera Module v1 to test the node with and I currently do not need another version of the Raspberry Pi Camera Module myself. Therefore, I am not willing to purchase additional modules. If someone needs support for a Camera Module other than v1, I essentially rely on financial and material support from the community.

Please get in contact with me if you want to sponsor a "Camera Module 3" in order to have this module tested with the node and potentially have this issue resolved properly.

@christianrauch
Copy link
Owner

christianrauch commented May 5, 2024

Yea, i have tried #15, but got the same error that was reported in #13 (comment).

Sorry. I overlooked that you already tried the PR with the same result.

Can you, or @Woojin-Crive, provide a gdb backtrace with debug symbols for this assertion?

@Woojin-Crive
Copy link
Author

Oh, i am now just using this with a docker.
They are just working fine.. I do not have the hardware now.! Sorry for that..
Below is the context of the dockefile.

Complie the libcamera

WORKDIR /root/libcamera
RUN git clone https://github.com/raspberrypi/libcamera.git . &&
git checkout 563cd78e1c9858769f7e4cc2628e2515836fd6e7 &&
meson setup build &&
ninja -C build install &&
ldconfig

I am now using my own fork.

git clone https://github.com/Woojin-Crive/camera_ros.git

Use the launch file to start a node.

ros2 launch camera_ros camera_launch.py

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 a pull request may close this issue.

3 participants