×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

INDI LibCamera Driver

  • Posts: 4
  • Thank you received: 2

Replied by Tyler Pickett on topic INDI LibCamera Driver


That's exactly what I was thinking, maybe with a wrapper to isolate the libcamera bits in a single place to keep it easy to make adjustments as they make API changes.
1 year 5 months ago #88656

Please Log in or Create an account to join the conversation.

  • Posts: 115
  • Thank you received: 34

Replied by Simon on topic INDI LibCamera Driver

If you experiance ERROR DeviceEnumerator device_enumerator.cpp:165 Removing media device /dev/media1 while still in use
It help if you just kill indiserver with this command:
sudo killall -9 indiserver

Yeeeeeej, rebooting isn't necessary any more! This is such a time saver!
1 year 5 months ago #88660

Please Log in or Create an account to join the conversation.

  • Posts: 115
  • Thank you received: 34

Replied by Simon on topic INDI LibCamera Driver

Yes ANJO indeed code inside Connect() method was causing EKOS troubles.
When I comented it completely out, EKOS starts and all buttons are active (see attached GIF).
Of course it crashes when I press image capture button, but that's OK ;)

See here for comented part of code: github.com/sajmons/indi-3rdparty/commit/...75e5c36cabf5fc9788ba

Next task is to figure out how to get that button to work! I have a feeling that it ain't gonna be easy! :)
Last edit: 1 year 4 months ago by Simon.
1 year 5 months ago #88661
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 11

Replied by Anjo on topic INDI LibCamera Driver

You can actually enable that code in connect again and just comment out the m_StillApp->Parse() whicn is what causes the crash.
The following user(s) said Thank You: Simon
1 year 5 months ago #88663

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 11

Replied by Anjo on topic INDI LibCamera Driver

The bad new is that it still crashes in workerExposure when touching the m_StillApp object. a) it was never opened and b) if you try to open it, it says it' can't be opened... if you don't open if, you crash in ConfigureStill
1 year 5 months ago #88664

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 11

Replied by Anjo on topic INDI LibCamera Driver

Adding this in InitProperties() will make setting the frame work. Still no exposures, though

// imx 290
PrimaryCCD.setResolution(1920,1080);
PrimaryCCD.setPixelSize(2.55, 2.55);
1 year 5 months ago #88666

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 2

Replied by Tyler Pickett on topic INDI LibCamera Driver

While working to excise libcamera-apps I took a detour through the libcamera docs. It looks like the Camera class has a properties() method that returns a ControlList instance. All of the available properties are documented in libcamera/include/libcamera/properties.h .
1 year 4 months ago #88681

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 11

Replied by Anjo on topic INDI LibCamera Driver

To get this thing off the ground as fast as possible, I would suggest 2 controls in the INDI ui: STILL_OPTIONS and VIDEO_OPTIONS.

Then let the FooOptions->Parse() them. Since doing a full fledged UI is error prone and tiresome and for the moment not needed.
1 year 4 months ago #88684

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 11

Replied by Anjo on topic INDI LibCamera Driver

OK, I managed to get somewhere. Make the manager a static and don't destroy it.

github.com/indilib/indi-3rdparty/compare...i-3rdparty:libcamera

Then connect and expose and you get this. I'm not sure of the whole approach of having two apps will work, as it's assuming you need two camera objects? I guess it would make more sense to somehow get at the preview buffer for the still app.
2022-12-01T07:10:44: Driver indi_libcamera_ccd: [17:15:09.937989200] [30612]  INFO RPI raspberrypi.cpp:1414 Registered camera /base/soc/i2c0mux/i2c@1/imx290@1a to Unicam device /dev/media4 and ISP device /dev/media0
2022-12-01T07:11:11: Client 9: new arrival from 192.168.0.113:57503 - welcome!
2022-12-01T07:11:16: Client 10: new arrival from 192.168.0.113:57540 - welcome!
2022-12-01T07:11:27: Driver indi_libcamera_ccd: Running without preview window
2022-12-01T07:11:27: Driver indi_libcamera_ccd: Opening camera...
2022-12-01T07:11:27: Driver indi_libcamera_ccd: [17:15:52.782629828] [30611] FATAL IPAManager ipa_manager.cpp:109 Multiple IPAManager objects are not allowed
2022-12-01T07:11:27: Driver indi_libcamera_ccd: Backtrace:
2022-12-01T07:11:27: Driver indi_libcamera_ccd: 
2022-12-01T07:11:27: Driver indi_libcamera_ccd: 
2022-12-01T07:11:27: Driver indi_libcamera_ccd: 
2022-12-01T07:11:27: Driver indi_libcamera_ccd: 
2022-12-01T07:11:27: Driver indi_libcamera_ccd: INDILibCamera::workerExposure(std::atomic<bool> const&, float)+0xe4 (/home/pi/astro/indi-3rdparty/indi-libcamera/indi_libcamera.cpp:190)
2022-12-01T07:11:27: Driver indi_libcamera_ccd: void std::__invoke_impl<void, void (INDILibCamera::*&)(std::atomic<bool> const&, float), INDILibCamera*&, std::atomic<bool> const&, float&>(std::__invoke_memfun_deref, void (INDILibCamera::*&)(std::atomic<bool> const&, float), INDILibCamera*&, std::atomic<bool> const&, float&)+0xd0 (/usr/include/c++/10/bits/invoke.h:73)
2022-12-01T07:11:27: Driver indi_libcamera_ccd: std::__invoke_result<void (INDILibCamera::*&)(std::atomic<bool> const&, float), INDILibCamera*&, std::atomic<bool> const&, float&>::type std::__invoke<void (INDILibCamera::*&)(std::atomic<bool> const&, float), INDILibCamera*&, std::atomic<bool> const&, float&>(void (INDILibCamera::*&)(std::atomic<bool> const&, float), INDILibCamera*&, std::atomic<bool> const&, float&)+0x80 (/usr/include/c++/10/bits/invoke.h:96)
2022-12-01T07:11:27: Driver indi_libcamera_ccd: void std::_Bind<void (INDILibCamera::*(INDILibCamera*, std::_Placeholder<1>, float))(std::atomic<bool> const&, float)>::__call<void, std::atomic<bool> const&, 0u, 1u, 2u>(std::tuple<std::atomic<bool> const&>&&, std::_Index_tuple<0u, 1u, 2u>)+0xc0 (/usr/include/c++/10/functional:418)
2022-12-01T07:11:27: Driver indi_libcamera_ccd: void std::_Bind<void (INDILibCamera::*(INDILibCamera*, std::_Placeholder<1>, float))(std::atomic<bool> const&, float)>::operator()<std::atomic<bool> const&, void>(std::atomic<bool> const&)+0x60 (/usr/include/c++/10/functional:501)
2022-12-01T07:11:27: Driver indi_libcamera_ccd: void std::__invoke_impl<void, std::_Bind<void (INDILibCamera::*(INDILibCamera*, std::_Placeholder<1>, float))(std::atomic<bool> const&, float)>&, std::atomic<bool> const&>(std::__invoke_other, std::_Bind<void (INDILibCamera::*(INDILibCamera*, std::_Placeholder<1>, float))(std::atomic<bool> const&, float)>&, std::atomic<bool> const&)+0x58 (/usr/include/c++/10/bits/invoke.h:60)
2022-12-01T07:11:27: Driver indi_libcamera_ccd: std::enable_if<is_invocable_r_v<void, std::_Bind<void (INDILibCamera::*(INDILibCamera*, std::_Placeholder<1>, float))(std::atomic<bool> const&, float)>&, std::atomic<bool> const&>, void>::type std::__invoke_r<void, std::_Bind<void (INDILibCamera::*(INDILibCamera*, std::_Placeholder<1>, float))(std::atomic<bool> const&, float)>&, std::atomic<bool> const&>(std::_Bind<void (INDILibCamera::*(INDILibCamera*, std::_Placeholder<1>, float))(std::atomic<bool> const&, float)>&, std::atomic<bool> const&)+0x58 (/usr/include/c++/10/bits/invoke.h:116)
2022-12-01T07:11:27: Driver indi_libcamera_ccd: std::_Function_handler<void (std::atomic<bool> const&), std::_Bind<void (INDILibCamera::*(INDILibCamera*, std::_Placeholder<1>, float))(std::atomic<bool> const&, float)> >::_M_invoke(std::_Any_data const&, std::atomic<bool> const&)+0x54 (/usr/include/c++/10/bits/std_function.h:292)
2022-12-01T07:11:27: Driver indi_libcamera_ccd: 
2022-12-01T07:11:27: Driver indi_libcamera_ccd: 
2022-12-01T07:11:27: Driver indi_libcamera_ccd: 
2022-12-01T07:11:27: Driver indi_libcamera_ccd: read EOF
1 year 4 months ago #88685

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 2

Replied by Tyler Pickett on topic INDI LibCamera Driver

> OK, I managed to get somewhere. Make the manager a static and don't destroy it.
> Then connect and expose and you get this. I'm not sure of the whole approach of having two apps will work, as it's assuming you need two camera objects? I guess it would make more sense to somehow get at the preview buffer for the still app.

Each of those App classes instantiates its own camera and camera manager objects, this is why it keeps crashing. libcamera won't allow either of those classes to have multiple instantiations which is why removing the libcamera-apps dependency is a good idea, possibly necessary.

In other news I put together a little program to extract the parameters available from any attached cameras, here's the output for my HQ camera:
<code>$ LIBCAMERA_LOG_LEVELS=ERROR ./cam_list
Found 1 cameras.1: 'imx477' (/base/soc/i2c0mux/i2c@1/imx477@1a)
ScalerCropMaximum: (0, 0)/0x0
ColorFilterArrangement: 0
PixelArrayActiveAreas: [ (8, 16)/4056x3040 ]
PixelArraySize: 4056x3040
Rotation: 180
Location: 2
UnitCellSize: 1550x1550
Model: imx477
</code>

The code: gist.github.com/tpickett66/7c206bb4f3bdf08f0d3c2df39e1ac817
The following user(s) said Thank You: Simon
Last edit: 1 year 4 months ago by Tyler Pickett. Reason: fixed whitespace
1 year 4 months ago #88687

Please Log in or Create an account to join the conversation.

Replied by Jasem Mutlaq on topic INDI LibCamera Driver

Removing libcamera-apps dependency is a good idea for the long term. I started with it since it was the easiest to do given what it offers, but it complicates the driver in the end.
The following user(s) said Thank You: Tyler Pickett
1 year 4 months ago #88689

Please Log in or Create an account to join the conversation.

  • Posts: 115
  • Thank you received: 34

Replied by Simon on topic INDI LibCamera Driver

Terry, thats great! What about pixel size and binning information? For imx477 value should be 1.55 if I'm correct?
We should get as much information as we can and set it to EKOS.
1 year 4 months ago #88695

Please Log in or Create an account to join the conversation.

Time to create page: 1.031 seconds