×

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

Bi-monthly release with minor bug fixes and improvements

INDI LibCamera Driver

  • Posts: 74
  • Thank you received: 11

Replied by Anjo on topic INDI LibCamera Driver

The reason you can't see it is probably because the accompanying xml still refers to the indi_asi driver instead of indi_libcamera_ccd:

github.com/indilib/indi-3rdparty/blob/ma...bcamera.xml.cmake#L5

This here when running from the build directory doesn't give the "not found", but still doesn't work:
indiserver -v `pwd`/indi_libcamera_ccd indi_simulator_telescope
->
pi@astrocam:~/astro/indi-3rdparty/build/indi-libcamera $ indiserver -v `pwd`/indi_libcamera_ccd indi_simulator_telescope
2022-11-06T10:40:56: startup: indiserver -v /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd indi_simulator_telescope
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: pid=16779 rfd=6 wfd=6 efd=7
2022-11-06T10:40:56: Driver indi_simulator_telescope: pid=16780 rfd=8 wfd=8 efd=9
2022-11-06T10:40:56: listening to port 7624 on fd 5
2022-11-06T10:40:56: Local server: listening on local domain at: @/tmp/indiserver
2022-11-06T10:40:56: Driver indi_simulator_telescope: HaAxis: TrackRate 1, trackingRateDegSec 15.041067 arcsec
2022-11-06T10:40:56: Driver indi_simulator_telescope: snooping on GPS Simulator.GEOGRAPHIC_COORD
2022-11-06T10:40:56: Driver indi_simulator_telescope: snooping on GPS Simulator.TIME_UTC
2022-11-06T10:40:56: Driver indi_simulator_telescope: snooping on Dome Simulator.DOME_PARK
2022-11-06T10:40:56: Driver indi_simulator_telescope: snooping on Dome Simulator.DOME_SHUTTER
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: snooping on Telescope Simulator.EQUATORIAL_EOD_COORD
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: snooping on Telescope Simulator.EQUATORIAL_COORD
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: snooping on Telescope Simulator.TELESCOPE_INFO
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: snooping on Telescope Simulator.GEOGRAPHIC_COORD
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: snooping on Telescope Simulator.TELESCOPE_PIER_SIDE
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: snooping on Rotator Simulator.ABS_ROTATOR_ANGLE
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: snooping on Focuser Simulator.ABS_FOCUS_POSITION
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: snooping on Focuser Simulator.FOCUS_TEMPERATURE
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: snooping on CCD Simulator.FILTER_SLOT
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: snooping on CCD Simulator.FILTER_NAME
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: snooping on SQM.SKY_QUALITY
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: [2:30:23.766169775] [16779]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3700-f30ad033
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: [2:30:23.794506306] [16782]  INFO RPI raspberrypi.cpp:1368 Registered camera /base/soc/i2c0mux/i2c@1/imx290@1a to Unicam device /dev/media4 and ISP device /dev/media1
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: [2:30:23.794801191] [16782] ERROR DeviceEnumerator device_enumerator.cpp:166 Removing media device /dev/media1 while still in use
2022-11-06T10:40:56: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: [2:30:23.794835005] [16782] ERROR DeviceEnumerator device_enumerator.cpp:166 Removing media device /dev/media4 while still in use

.... restarts until it gives up

However, with this little trick, I managed to at least get streaming with my imx290 to work:
pi@astrocam:~ $ cat /usr/bin/indi_wrapper_ccd 
/usr/bin/libcamerify /usr/bin/indi_v4l2_ccd

When you start this "driver" you can set it to RGB and stream and record, which is about all I want for the moment.

I hoped you can set the properties like gain, brightness etc via

github.com/raspberrypi/libcamera-apps/issues/344

but apparently it's always reset.
The following user(s) said Thank You: lemoyne
1 year 6 months ago #87863

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

Replied by Jasem Mutlaq on topic INDI LibCamera Driver

Thanks for the heads up, I fixed the XML file.
1 year 6 months ago #87864

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

It's also in a few other places, dunno how relevant the .spec is:

pi@astrocam:~/astro/indi-3rdparty/indi-libcamera $ rg asi |grep indi
README.md:Go to the directory where you unpacked indi_asi sources and do:
indi-libcamera.spec:Name: indi-asi
indi-libcamera.spec:BuildRequires: libasi
indi-libcamera.spec:Requires: libasi
indi-libcamera.spec:cd indi-asi
indi-libcamera.spec:cd indi-asi
indi_libcamera.xml.cmake: <driver name="ZWO CCD">indi_asi_ccd</driver>
indi_libcamera.xml.cmake: <driver name="ZWO Camera">indi_asi_single_ccd</driver>
indi_libcamera.xml.cmake: <driver name="ZWO Camera">indi_asi_single_ccd</driver>
indi_libcamera.xml.cmake: <driver name="ZWO Camera">indi_asi_single_ccd</driver>
indi_libcamera.xml.cmake: <driver name="ASI EFW">indi_asi_wheel</driver>
indi_libcamera.xml.cmake: <driver name="ASI EAF">indi_asi_focuser</driver>
indi_libcamera.xml.cmake: <driver name="ASI ST4">indi_asi_st4</driver>
1 year 6 months ago #87865

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

  • Posts: 124
  • Thank you received: 13

Replied by Outta on topic INDI LibCamera Driver

Unfortunately I do not have that wrapper or libcamerify, but that seams to be workaround.

Regarding long exposure on IMX290, I have IMX462 that uses same driver. In arducam variant there is a trick that you need to set registry to 0xffffff, but that I think that needs changes to driver. I tried to do that but failed. I did manage to build, but when replacing overlay nothing happened.
Arducam says:

For the long exposure mode, long exposure operation can be performed by lengthening the frame period.


When the sensor is operating in slave mode, this is done by lengthening the input vertical sync signal (XVS) pulse interval.


When the sensor is operating in master mode, it is done by designating a larger register VMAX [19:0] value compared to normal operation. When the integration time is extended by increasing the number of lines, the rear Vblanking increases by an equivalent amount.


We do some test and found that, in fact in long exposure mode, the VMAX can be set to 0xFFFFF, and the long exposure time is Texp = (hts/pixclk)(VMAX-1) = (2200/148500000)(0XFFFFF-1) = 15.53s



Regarding libcamera driver, this is debug issue I am. having both on IMX477 and IMX462 :
Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New inferior 2 (process 26797)]
[Inferior 1 (process 26794) detached]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/arm-linux-gnueabihf/libthread_db.so.1".
process 26797 is executing new program: /usr/bin/indi_libcamera_ccd
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0xb130f000 (LWP 26801)]
[New Thread 0xb0b0e000 (LWP 26802)]
[New Thread 0xb015e000 (LWP 26806)]
[New Thread 0xaf95d000 (LWP 26807)]
[Thread 0xb0b0e000 (LWP 26802) exited]
Thread 2.1 "indi_libcamera_" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb1312900 (LWP 26797)]
0x62696c2e in ?? ()
#0  0x62696c2e in ?? ()
#1  0xb5d3dba8 in libcamera::Thread::postMessage(std::unique_ptr<libcamera::Message, std::default_delete<libcamera::Message> >, libcamera::Object*) () from /usr/lib/arm-linux-gnueabihf/libcamera-base.so.0
#2  0xb5d3b330 in libcamera::Object::postMessage(std::unique_ptr<libcamera::Message, std::default_delete<libcamera::Message> >) () from /usr/lib/arm-linux-gnueabihf/libcamera-base.so.0
#3  0xb5d3b39c in libcamera::Object::deleteLater() () from /usr/lib/arm-linux-gnueabihf/libcamera-base.so.0
#4  0xb69673c8 in std::_Sp_counted_deleter<libcamera::Camera*, libcamera::Camera::create(std::unique_ptr<libcamera::Camera::Private, std::default_delete<libcamera::Camera::Private> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::set<libcamera::Stream*, std::less<libcamera::Stream*>, std::allocator<libcamera::Stream*> > const&)::Deleter, std::allocator<void>, (__gnu_cxx::_Lock_policy)1>::_M_dispose() () from /usr/lib/arm-linux-gnueabihf/libcamera.so.0
#5  0x0045f668 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)1>::_M_release (this=0xb02134a8) at /usr/include/c++/10/bits/shared_ptr_base.h:158
#6  0x0045a360 in std::__shared_count<(__gnu_cxx::_Lock_policy)1>::~__shared_count (this=0x4c35e4, __in_chrg=<optimized out>) at /usr/include/c++/10/bits/shared_ptr_base.h:733
#7  0x00477e68 in std::__shared_ptr<libcamera::Camera, (__gnu_cxx::_Lock_policy)1>::~__shared_ptr (this=0x4c35e0, __in_chrg=<optimized out>) at /usr/include/c++/10/bits/shared_ptr_base.h:1183
#8  0x0047d328 in std::shared_ptr<libcamera::Camera>::~shared_ptr (this=0x4c35e0, __in_chrg=<optimized out>) at /usr/include/c++/10/bits/shared_ptr.h:121
#9  0x0047d3a0 in std::_Destroy<std::shared_ptr<libcamera::Camera> > (__pointer=0x4c35e0) at /usr/include/c++/10/bits/stl_construct.h:140
#10 0x00477d70 in std::_Destroy_aux<false>::__destroy<std::shared_ptr<libcamera::Camera>*> (__first=0x4c35e0, __last=0x4c35e8) at /usr/include/c++/10/bits/stl_construct.h:152
#11 0x00470360 in std::_Destroy<std::shared_ptr<libcamera::Camera>*> (__first=0x4c35e0, __last=0x4c35e8) at /usr/include/c++/10/bits/stl_construct.h:185
#12 0x004678c4 in std::_Destroy<std::shared_ptr<libcamera::Camera>*, std::shared_ptr<libcamera::Camera> > (__first=0x4c35e0, __last=0x4c35e8) at /usr/include/c++/10/bits/alloc_traits.h:738
#13 0x0045e764 in std::vector<std::shared_ptr<libcamera::Camera>, std::allocator<std::shared_ptr<libcamera::Camera> > >::~vector (this=0xbeffec08, __in_chrg=<optimized out>) at /usr/include/c++/10/bits/stl_vector.h:680
#14 0x0044bba4 in INDILibCamera::detectCameras (this=0x4db4d0) at /home/astroberry/Projects/indi-3rdparty/indi-libcamera/indi_libcamera.cpp:528
#15 0x0044b3c0 in INDILibCamera::initProperties (this=0x4db4d0) at /home/astroberry/Projects/indi-3rdparty/indi-libcamera/indi_libcamera.cpp:444
#16 0xb6dda9b4 in INDI::DefaultDevice::ISGetProperties (this=0x4db4d0, dev=0x0) at /home/astroberry/Projects/indi/libs/indibase/defaultdevice.cpp:776
#17 0xb6e0c164 in INDI::CCD::ISGetProperties (this=0x4db4d0, dev=0x0) at /home/astroberry/Projects/indi/libs/indibase/indiccd.cpp:509
#18 0x0044b6f4 in INDILibCamera::ISGetProperties (this=0x4db4d0, dev=0x0) at /home/astroberry/Projects/indi-3rdparty/indi-libcamera/indi_libcamera.cpp:471
#19 0xb6dd6f38 in ISGetProperties (dev=0x0) at /home/astroberry/Projects/indi/libs/indibase/defaultdevice.cpp:57
#20 0xb6d99070 in dispatch (root=0x4e5198, msg=0xbeffee9c "erties version=\"1.7\"/>\n") at /home/astroberry/Projects/indi/indidriver.c:823
#21 0xb6d9d620 in flushDeferredMessages (arg=0x0) at /home/astroberry/Projects/indi/indidrivermain.c:137
#22 0xb6d9f2a4 in runImmediates () at /home/astroberry/Projects/indi/eventloop.c:563
#23 0xb6d9f090 in oneLoop () at /home/astroberry/Projects/indi/eventloop.c:504
#24 0xb6d9df9c in eventLoop () at /home/astroberry/Projects/indi/eventloop.c:110
#25 0xb6d9de6c in main (ac=0, av=0xbefff904) at /home/astroberry/Projects/indi/indidrivermain.c:317
#26 0xb65ef740 in __libc_start_main (main=0xbefff904, argc=-1234010112, argv=0xb65ef740 <__libc_start_main+276>, init=<optimized out>, fini=0x49b2dc <__libc_csu_fini>, rtld_fini=0xb6fdd510 <_dl_fini>, stack_end=0xbefff904) at libc-start.c:308
#27 0x004486bc in _start ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
Last edit: 1 year 6 months ago by Outta.
1 year 6 months ago #87868

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

  • Posts: 124
  • Thank you received: 13

Replied by Outta on topic INDI LibCamera Driver

Kick in a butt is a step forward!

We can completely ignore this error
Same error is happening in native libcamera app. So that is not an issue.
2022-11-05T21:05:18: Driver indi_libcamera_ccd: [0:12:18.950064319] [3997] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
1 year 6 months ago #87940

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

  • Posts: 124
  • Thank you received: 13

Replied by Outta on topic INDI LibCamera Driver

One step at the time :)

I have found out that issue is in invoking
INDI::CCD::ISGetProperties
Main problem is that I cannot even start driver so I cannot attach debugger to it...

I am trying now to compile indi so I can debug that but having issues. Any help greatly appriciated..

indilib.org/forum/development/12628-use-...or-is-ambiguous.html
The following user(s) said Thank You: Simon
1 year 5 months ago #88111

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

  • Posts: 119
  • Thank you received: 36

Replied by Simon on topic INDI LibCamera Driver

OUTTA I understand what you are doing, but I'm developer from parallel universe called Windows. So I can't help here. But I did noticed that guys developing indi_allsky already have libcamera (libcamera support (imx477, imx378, etc)) support, maybe they can help?

github.com/aaronwmorris/indi-allsky
1 year 5 months ago #88116

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

  • Posts: 124
  • Thank you received: 13

Replied by Outta on topic INDI LibCamera Driver

Hi Simon, Indeed I am developer from same universe C#/.net but I believe I can manage this as well. Thank you on that find, but it seems that they are using python! That is interesting I was not aware that is possible as well, interesting implementation but unfortunately translating it would be piece of work. As I saw job that Jason did is more than good, but we need to make it more stable now. Test it on multiple devices, load initial settings and modes (as libcamera apps use resolution modes instead of binning+ROI).

Binning and ROI are possible, but it does not effect performance as Analog crop has not been implemented by any of camerea drivers I noticed.
1 year 5 months ago #88118

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

  • Posts: 119
  • Thank you received: 36

Replied by Simon on topic INDI LibCamera Driver

I'm glad to hear that we are from same universe and speaking same language ;)
If you can share some information, how to setup developing environment on Linux, what developing tools to use, how to build everything, I can a least help with testing for a start.
I have Raspbery PI 4 with latest version of Stelarmate 64bit installed and HQ Camera with IMX477 connected to it.
1 year 5 months ago #88121

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

  • Posts: 124
  • Thank you received: 13

Replied by Outta on topic INDI LibCamera Driver

When I manage to get it running I will post all commands here!

Now for Jason, or someone experienced, I am unable to debug, I see issue is in this line ISGetProperties, but I am unable to hit any breakpoint.




For Simon this are commands:

6 sudo apt-get install -y git cdbs dkms cmake fxload libev-dev libgps-dev libgsl-dev libraw-dev libusb-dev zlib1g-dev libftdi-dev libgsl0-dev libjpeg-dev libkrb5-dev libnova-dev libtiff-dev libfftw3-dev librtlsdr-dev libcfitsio-dev libgphoto2-dev build-essential libusb-1.0-0-dev libdc1394-22-dev libboost-regex-dev libcurl4-gnutls-dev libtheora-dev
7 mkdir -p ~/Projects
8 cd ~/Projects
9 git clone github.com/indilib/indi.git
10 mkdir -p ~/Projects/build/indi-core
11 cd ~/Projects/build/indi-core
12 cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug ~/Projects/indi
13 make -j4
14 sudo make install
15 cd .. 
16 cd ..
16 sudo apt-get -y install libnova-dev libcfitsio-dev libusb-1.0-0-dev zlib1g-dev libgsl-dev build-essential cmake git libjpeg-dev libcurl4-gnutls-dev libtiff-dev libfftw3-dev libftdi-dev libgps-dev libraw-dev libdc1394-22-dev libgphoto2-dev libboost-dev libboost-regex-dev librtlsdr-dev liblimesuite-dev libftdi1-dev libavcodec-dev libavdevice-dev
17 sudo apt-get -y install libindi-dev
18 git clone github.com/indilib/indi-3rdparty
27 sudo apt install libcamera-apps
28 sudo nano /boot/config.txt  //add to end dtoverlay=imx### 
29 sudo reboot
30 libcamera-hello --list-cameras //check that there is camera detected
31 mkdir -p ~/Projects/build/indi-libcamera
32 cd ~/Projects/build/indi-libcamera
44 sudo apt install build-essential libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-test-dev
48 cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug ~/Projects/indi-3rdparty/indi-libcamera/
49 make -j4
50 sudo make install
The following user(s) said Thank You: Simon
Last edit: 1 year 5 months ago by Outta.
1 year 5 months ago #88126

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

Replied by Jasem Mutlaq on topic INDI LibCamera Driver

You need to set GDB settings for this to work, see screenshot
The following user(s) said Thank You: Outta
1 year 5 months ago #88142
Attachments:

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

  • Posts: 124
  • Thank you received: 13

Replied by Outta on topic INDI LibCamera Driver

I am in! Thanks! I think I might be useful now :D
So 528 cameraManager.reset(); is culprit for crashing, I think this has something with libcamera as well as there is commit similar to this on libcamera.

All in all I will be able to debug now and I will try to make driver more stable.

Simon you can try to run it as well, our environments are a bit different, but more the merrier. You have initial commands, then install QT creator(sudo apt install qtcreator)
then follow this tutorial:

www.indilib.org/developers/deveioper-man...ent-environment.html

I think you can skip steps building and installing just indi as you should have it on stellarmate
Last edit: 1 year 5 months ago by Outta.
1 year 5 months ago #88146

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

Time to create page: 1.199 seconds