×

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

Bi-monthly release with minor bug fixes and improvements

INDI LibCamera Driver

  • Posts: 124
  • Thank you received: 13

Replied by Outta on topic INDI LibCamera Driver

I have built libcamera now myself, but I am still having same issues, I might need to build kstars as well as my version is missing a lot of stuff, including buttons :D This might finally force me to go to Stellarmate :D But we should make it stable on RPi OS as well.
Last edit: 1 year 5 months ago by Outta.
1 year 5 months ago #88200

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

Replied by Jasem Mutlaq on topic INDI LibCamera Driver


Just pushed an update to Stellarmate stable channel with latest releases of both libcamera and libcamera-apps
1 year 5 months ago #88201

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

I found this forums.raspberrypi.com/viewtopic.php?t=315490. It seams that is related to our problem.
Therefore if the FrameBufferAllocator is not deleted before deleting the CameraManager, the Camera object will still exist hence triggering the /dev/media warnings.
By taking another look at the Stop, Teardown and Close routines in libcamera-apps/libcamera_app.hpp and ensuring that I delete the FrameBufferAllocator I have managed to get rid of the /dev/media errors (at least for now).

I modified detectCameras() like this:
void INDILibCamera::detectCameras()
{
    std::unique_ptr<LibcameraApp::CameraManager> cameraManager(new LibcameraApp::CameraManager());
    cameraManager->start();    
    auto cameras = cameraManager->cameras();
    // Do not show USB webcams as these are not supported in libcamera-apps!
    auto rem = std::remove_if(cameras.begin(), cameras.end(),
                              [](auto & cam)
    {
        return cam->id().find("/usb") != std::string::npos;
    });
    cameras.erase(rem, cameras.end());
 
    if (cameras.size() == 0)
    {
        LOG_ERROR("No cameras detected.");
        return;
    }
 
    CameraSP.resize(cameras.size());
    for (size_t i = 0; i < cameras.size(); i++)
        CameraSP[i].fill(cameras[i]->id().c_str(), cameras[i]->id().c_str(), ISS_OFF);
 
    int onIndex = -1;
    if (IUGetConfigOnSwitchIndex(getDeviceName(), "CAMERAS", &onIndex) == 0)
        CameraSP[onIndex].setState(ISS_ON);
    else
        CameraSP[0].setState(ISS_ON);
 
    cameraManager->stop();
    cameraManager.release(); // I added this line
    cameraManager.reset();
}

and now
[2022-11-16T20:00:50.609 CET DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-11-16T19:00:50: Driver indi_libcamera_ccd: [7:58:49.613104765] [99806] \u001B[1;31mERROR \u001B[1;37mDeviceEnumerator \u001B[1;34mdevice_enumerator.cpp:166 \u001B[0mRemoving media device /dev/media1 while still in use"
[2022-11-16T20:00:50.609 CET DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-11-16T19:00:50: Driver indi_libcamera_ccd: [7:58:49.613176968] [99806] \u001B[1;31mERROR \u001B[1;37mDeviceEnumerator \u001B[1;34mdevice_enumerator.cpp:166 \u001B[0mRemoving media device /dev/media2 while still in use

error is gone, when I start EKOS driver starts but reports:
[2022-11-16T20:01:14.562 CET INFO ][           org.kde.kstars.indi] - LibCamera :  "[ERROR] Error opening camera: illegal rotation value "
Last edit: 1 year 5 months ago by Simon.
1 year 5 months ago #88211

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

After updating libcamera and restarting Raspberry PI I get this:
[2022-11-16T23:29:52.316 CET DEBG ][           org.kde.kstars.indi] - INDI: Stopping local drivers...
[2022-11-16T23:29:52.317 CET DEBG ][           org.kde.kstars.indi] - Removing managed driver "LibCamera"
[2022-11-16T23:29:52.317 CET DEBG ][           org.kde.kstars.indi] - INDIListener: Removing client manager for server localhost @ 7624
[2022-11-16T23:29:52.318 CET DEBG ][           org.kde.kstars.indi] - INDI server disconnected. Exit code: 0
[2022-11-16T23:29:52.318 CET DEBG ][           org.kde.kstars.indi] - Stopping INDI Driver  "indi_libcamera_ccd"
[2022-11-16T23:29:52.318 CET DEBG ][           org.kde.kstars.indi] - Stopping INDI Server  "localhost" @ 7624
[2022-11-16T23:29:52.320 CET DEBG ][           org.kde.kstars.ekos] - Resetting Ekos Manager...
[2022-11-16T23:29:52.321 CET INFO ][           org.kde.kstars.ekos] - "INDI services stopped."
[2022-11-16T23:30:06.125 CET DEBG ][           org.kde.kstars.ekos] - Resetting Ekos Manager...
[2022-11-16T23:30:06.168 CET INFO ][           org.kde.kstars.ekos] - "Starting INDI services..."
[2022-11-16T23:30:06.171 CET DEBG ][           org.kde.kstars.indi] - INDI: Starting local drivers...
[2022-11-16T23:30:06.172 CET DEBG ][           org.kde.kstars.indi] - Starting INDI Server:  ("-v", "-p", "7624", "-m", "1024", "-r", "0", "-f", "/tmp/indififo824a90d4") -f "/tmp/indififo824a90d4"
[2022-11-16T23:30:06.188 CET DEBG ][           org.kde.kstars.indi] - INDI: INDI Server started locally on port  7624
[2022-11-16T23:30:06.188 CET DEBG ][           org.kde.kstars.indi] - INDI Server Started?  true
[2022-11-16T23:30:06.189 CET DEBG ][           org.kde.kstars.indi] - Starting INDI Driver "indi_libcamera_ccd"
[2022-11-16T23:30:06.199 CET DEBG ][           org.kde.kstars.indi] - Adding managed driver "LibCamera"
[2022-11-16T23:30:06.200 CET DEBG ][           org.kde.kstars.indi] - INDIListener: Adding a new client manager to INDI listener..
[2022-11-16T23:30:06.201 CET DEBG ][           org.kde.kstars.indi] - INDI: Connecting to local INDI server on port  7624  ...
[2022-11-16T23:30:06.202 CET DEBG ][           org.kde.kstars.indi] - INDI server connected.
[2022-11-16T23:30:06.204 CET INFO ][           org.kde.kstars.ekos] - "INDI services started on port 7,624."
[2022-11-16T23:30:06.209 CET DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-11-16T22:30:06: startup: /usr/bin/indiserver -v -p 7624 -m 1024 -r 0 -f /tmp/indififo824a90d4"
[2022-11-16T23:30:06.210 CET DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-11-16T22:30:06: listening to port 7624 on fd 5"
[2022-11-16T23:30:06.210 CET DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-11-16T22:30:06: Local server: listening on local domain at: @/tmp/indiserver"
[2022-11-16T23:30:06.210 CET DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-11-16T22:30:06: FIFO: start indi_libcamera_ccd -n \"LibCamera\""
[2022-11-16T23:30:06.210 CET DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-11-16T22:30:06: With name: LibCamera"
[2022-11-16T23:30:06.210 CET DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-11-16T22:30:06: FIFO: Starting driver indi_libcamera_ccd"
[2022-11-16T23:30:06.210 CET DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-11-16T22:30:06: Driver indi_libcamera_ccd: pid=2896 rfd=9 wfd=9 efd=10"
[2022-11-16T23:30:06.211 CET DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-11-16T22:30:06: Driver indi_libcamera_ccd: indi_libcamera_ccd: error while loading shared libraries: libcamera.so.0: cannot open shared object file: No such file or directory"
[2022-11-16T23:30:06.211 CET DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-11-16T22:30:06: Driver indi_libcamera_ccd: stderr EOF"
[2022-11-16T23:30:06.211 CET DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-11-16T22:30:06: Driver indi_libcamera_ccd: read: Connection reset by peer"
[2022-11-16T23:30:06.211 CET DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-11-16T22:30:06: Driver indi_libcamera_ccd: Terminated after #0 restarts."
[2022-11-16T23:30:06.211 CET DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-11-16T22:30:06: Client 8: new arrival from local pid 1121 (user: 1000:1001) - welcome!"
[2022-11-16T23:30:06.211 CET DEBG ][           org.kde.kstars.indi] - INDI Server:  ""
[2022-11-16T23:30:06.212 CET CRIT ][           org.kde.kstars.indi] - INDI driver  "indi_libcamera_ccd"  crashed!
[2022-11-16T23:30:10.382 CET DEBG ][           org.kde.kstars.indi] - INDI: Stopping local drivers...
[2022-11-16T23:30:10.386 CET DEBG ][           org.kde.kstars.indi] - Removing managed driver "LibCamera"
[2022-11-16T23:30:10.387 CET DEBG ][           org.kde.kstars.indi] - INDIListener: Removing client manager for server localhost @ 7624
[2022-11-16T23:30:10.388 CET DEBG ][           org.kde.kstars.indi] - Stopping INDI Driver  "indi_libcamera_ccd"
[2022-11-16T23:30:10.388 CET DEBG ][           org.kde.kstars.indi] - Stopping INDI Server  "localhost" @ 7624
[2022-11-16T23:30:10.389 CET DEBG ][           org.kde.kstars.indi] - INDI server disconnected. Exit code: 0
[2022-11-16T23:30:10.390 CET DEBG ][           org.kde.kstars.ekos] - Resetting Ekos Manager...
[2022-11-16T23:30:10.393 CET INFO ][           org.kde.kstars.ekos] - "INDI services stopped."
1 year 5 months ago #88219

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

Replied by Jasem Mutlaq on topic INDI LibCamera Driver

Need to recompile INDI Libcamera driver
1 year 5 months ago #88222

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

I did. This is compile output from QT Creator:
08:24:59: Running steps for project indi_libcamera...
08:25:00: Starting: "/usr/bin/cmake" --build . --target all
Scanning dependencies of target indi_libcamera_ccd
[ 50%] Building CXX object CMakeFiles/indi_libcamera_ccd.dir/indi_libcamera.cpp.o
[100%] Linking CXX executable indi_libcamera_ccd
[100%] Built target indi_libcamera_ccd
08:25:30: The process "/usr/bin/cmake" exited normally.
08:25:30: Starting: "/usr/bin/sudo" make install
[100%] Built target indi_libcamera_ccd
Install the project...
-- Install configuration: "Debug"
-- Installing: /usr/bin/indi_libcamera_ccd
-- Up-to-date: /usr/share/indi/indi_libcamera.xml
08:25:30: The process "/usr/bin/sudo" exited normally.
08:25:30: Elapsed time: 00:31.

Bare with me. I'm still learning :)
sudo find / -name libcamera.so
find: ‘/run/user/1000/gvfs’: Permission denied
/home/stellarmate/Projects/libcamera/build/src/libcamera/libcamera.so
/usr/local/lib/aarch64-linux-gnu/libcamera.so
/usr/lib/aarch64-linux-gnu/libcamera.so

Are locations correct?

Never mind, I corected problem with:
LD_LIBRARY_PATH=/usr/local/lib

And error went away. Not sure if it's the right thing to do though? Why would library output location change after updating to new version?
Last edit: 1 year 5 months ago by Simon.
1 year 5 months ago #88223

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

After commenting out the cameraManager->reset(), mine fails with the option parsing in StillOptions Option::Parse(). Where does this live anyway? The Option class just has this as virtual?

//if (Options::Parse(argc, argv) == false)
// return false;

Commenting this goes a bit further, but unsurprisingly croaks with:

ERROR 21.847219 sec : Error opening camera: bad thumbnail parameters

A workflow that halfway works for me is having two windows, in the one I recompile and start indi:

pi@astrocam:~/astro/indi-3rdparty/build/indi-libcamera $ make && indiserver -v `pwd`/indi_libcamera_ccd

and in the other I do:

pi@astrocam:~/.indi/logs/2022-11-26/indi_libcamera_ccd $ rm *.log && indi_setprop LibCamera.LOG_OUTPUT.FILE_DEBUG=On && indi_setprop LibCamera.CONNECTION.CONNECT=On && cat *.log

which deletes the previous log, sets logging to file to on and connects.

Faking the still options gives:

2022-11-26T23:11:00: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: Options:
2022-11-26T23:11:00: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: verbose: 182
2022-11-26T23:11:00: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: info_text:?
2022-11-26T23:11:00: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: timeout: 39462159524836000
2022-11-26T23:11:00: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: width: 8993704
2022-11-26T23:11:00: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: height: 1
2022-11-26T23:11:00: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: output:
2022-11-26T23:11:00: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: post_process_file: qt.qpa.xcb: could not connect to display
2022-11-26T23:11:00: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
2022-11-26T23:11:00: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
2022-11-26T23:11:00: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd:
2022-11-26T23:11:00: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
2022-11-26T23:11:00: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd:
2022-11-26T23:11:00: Driver /home/pi/astro/indi-3rdparty/build/indi-libcamera/indi_libcamera_ccd: read EOF
Last edit: 1 year 4 months ago by Anjo.
1 year 4 months ago #88557

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

Are there any instructions on installing QTCreator on the pi? I only found pretty involved stuff that requires recompiles and cross compiles?
1 year 4 months ago #88566

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

Replied by Jasem Mutlaq on topic INDI LibCamera Driver

sudo apt-get -y install qtcreator
1 year 4 months ago #88568

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

Just for your info it is very sluggish and freezing on 4b 1gb, while it works well on 8gb version.
1 year 4 months ago #88569

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

I run QT Creator on Raspberry Pi 4B 4GB and it works fine.

Finally I have managed to make some progress. Method detectCameras() no longer crashes. And driver starts in EKOS (see attached image).

More here: github.com/sajmons/indi-3rdparty/commit/...7f51c85f3f06789f2c4e.

OUTTA, Jasem, what would be next step? Probably fill in more information about camera capabilities, so that more buttons in EKOS gets enabled?
The following user(s) said Thank You: Jasem Mutlaq
Last edit: 1 year 4 months ago by Simon.
1 year 4 months ago #88636
Attachments:

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

I wonder if we'd be better off creating a static CameraManager instead of this create/destroy dance. We'd probably have to pull more bits of the libcamera-apps code in rather than linking to it, but that might not be such a bad thing sone those seem to be demos that might be unstable and/or depend on Raspberry Pi specific components. I'll start looking into what that would look like.
The following user(s) said Thank You: Jasem Mutlaq
1 year 4 months ago #88643

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

Time to create page: 0.845 seconds