×

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

Bi-monthly release with minor bug fixes and improvements

INDI LibCamera Driver

  • Posts: 112
  • Thank you received: 34

Replied by Simon on topic INDI LibCamera Driver

ANJO I see your knowledge of C++ and Linux workflow exedes mine by far.

Yes, I remember that I read somewhere in libcamera docs that libcamera-raw can record video and single images.
libcamera-raw -t 1000 --ev -10 --awbgains 1.0,1.0 --gain 1.0 --analoggain 1.0 --sharpness 2.0 --denoise off --rawfull 1 --flush 1 --shutter 9000 --mode 4056:3040:12:P -o test%05d.raw --segment 1

If you have the knowlwdge of how to operate with those single raw frames, that would be total win.

Here is a little code snippet for getting resolution and pixel size from camera->properties(). You can use it inside Connect() method instead hardcoded values:
const ControlList props = cameraManager->cameras()[0]->properties();
 
auto pas = props.get(properties::PixelArraySize);
PrimaryCCD.setResolution(pas->width, pas->height);
LOGF_INFO("PixelArraySize %i x %i", pas->width, pas->height);
 
auto ucs = props.get(properties::UnitCellSize);
auto ucsWidth = ucs->width / 1000.0;
auto ucsHeight = ucs->height / 1000.0;
PrimaryCCD.setPixelSize(ucsWidth, ucsHeight);
LOGF_INFO("UnitCellSize %f x %f", ucsWidth, ucsHeight);
The following user(s) said Thank You: Anjo
Last edit: 1 year 4 months ago by Simon.
1 year 4 months ago #88704

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

  • Posts: 112
  • Thank you received: 34

Replied by Simon on topic INDI LibCamera Driver

ANJO and Jasem, please help me with this one.
How can one attach debugger to KSTARS to acctually be able to stop execution at break point?
Do you even attach to KSTARS or do you send commands to EKOS from commandline or something like that?

I'm really struggling by that because I'm not able to debug EKOS actions.
And yes I followed Jasem's tutorial and I did set Additional Startup Commands in GDB.
set follow-fork-mode child
handle SIG33 noprint nostop
handle SIGCONT noprint nostop

Here is the log from the point that I'm pressing start EKOS arrow till I press exposure icon in Camera tab inside EKOS.
[2022-12-01T18:56:37.056 UTC DEBG ][           org.kde.kstars.ekos] - Resetting Ekos Manager...
[2022-12-01T18:56:37.166 UTC INFO ][           org.kde.kstars.ekos] - "Starting INDI services..."
[2022-12-01T18:56:37.172 UTC DEBG ][           org.kde.kstars.indi] - INDI: Starting local drivers...
[2022-12-01T18:56:37.173 UTC DEBG ][           org.kde.kstars.indi] - Starting INDI Server:  ("-v", "-p", "7624", "-m", "1024", "-r", "0", "-f", "/tmp/indififo546a838e") -f "/tmp/indififo546a838e"
[2022-12-01T18:56:37.204 UTC DEBG ][           org.kde.kstars.indi] - INDI: INDI Server started locally on port  7624
[2022-12-01T18:56:37.208 UTC DEBG ][           org.kde.kstars.indi] - INDI Server Started?  true
[2022-12-01T18:56:37.209 UTC DEBG ][           org.kde.kstars.indi] - Starting INDI Driver "indi_libcamera_ccd"
[2022-12-01T18:56:37.217 UTC DEBG ][           org.kde.kstars.indi] - Adding managed driver "LibCamera"
[2022-12-01T18:56:37.218 UTC DEBG ][           org.kde.kstars.indi] - INDIListener: Adding a new client manager to INDI listener..
[2022-12-01T18:56:37.219 UTC DEBG ][           org.kde.kstars.indi] - INDI: Connecting to local INDI server on port  7624  ...
[2022-12-01T18:56:37.223 UTC DEBG ][           org.kde.kstars.indi] - INDI server connected.
[2022-12-01T18:56:37.224 UTC INFO ][           org.kde.kstars.ekos] - "INDI services started on port 7,624."
[2022-12-01T18:56:37.268 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: startup: /usr/bin/indiserver -v -p 7624 -m 1024 -r 0 -f /tmp/indififo546a838e"
[2022-12-01T18:56:37.269 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: listening to port 7624 on fd 5"
[2022-12-01T18:56:37.269 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Local server: listening on local domain at: @/tmp/indiserver"
[2022-12-01T18:56:37.270 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: FIFO: start indi_libcamera_ccd -n \"LibCamera\""
[2022-12-01T18:56:37.272 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: With name: LibCamera"
[2022-12-01T18:56:37.272 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: FIFO: Starting driver indi_libcamera_ccd"
[2022-12-01T18:56:37.272 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Driver indi_libcamera_ccd: pid=17198 rfd=9 wfd=9 efd=10"
[2022-12-01T18:56:37.273 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Client 8: new arrival from 127.0.0.1:54180 - welcome!"
[2022-12-01T18:56:37.273 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  ""
[2022-12-01T18:56:37.390 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Driver indi_libcamera_ccd: snooping on Telescope Simulator.EQUATORIAL_EOD_COORD"
[2022-12-01T18:56:37.391 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Driver indi_libcamera_ccd: snooping on Telescope Simulator.EQUATORIAL_COORD"
[2022-12-01T18:56:37.391 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Driver indi_libcamera_ccd: snooping on Telescope Simulator.TELESCOPE_INFO"
[2022-12-01T18:56:37.393 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Driver indi_libcamera_ccd: snooping on Telescope Simulator.GEOGRAPHIC_COORD"
[2022-12-01T18:56:37.394 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Driver indi_libcamera_ccd: snooping on Telescope Simulator.TELESCOPE_PIER_SIDE"
[2022-12-01T18:56:37.394 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Driver indi_libcamera_ccd: snooping on Rotator Simulator.ABS_ROTATOR_ANGLE"
[2022-12-01T18:56:37.394 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Driver indi_libcamera_ccd: snooping on Focuser Simulator.ABS_FOCUS_POSITION"
[2022-12-01T18:56:37.395 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Driver indi_libcamera_ccd: snooping on Focuser Simulator.FOCUS_TEMPERATURE"
[2022-12-01T18:56:37.395 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Driver indi_libcamera_ccd: snooping on CCD Simulator.FILTER_SLOT"
[2022-12-01T18:56:37.395 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Driver indi_libcamera_ccd: snooping on CCD Simulator.FILTER_NAME"
[2022-12-01T18:56:37.395 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Driver indi_libcamera_ccd: snooping on SQM.SKY_QUALITY"
[2022-12-01T18:56:37.395 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Driver indi_libcamera_ccd: [36:21:57.287289614] [17198] \u001B[1;32m INFO \u001B[1;37mCamera \u001B[1;34mcamera_manager.cpp:299 \u001B[0mlibcamera v0.0.1"
[2022-12-01T18:56:37.395 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  ""
[2022-12-01T18:56:37.491 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:37: Driver indi_libcamera_ccd: [36:21:57.402932403] [17201] \u001B[1;32m INFO \u001B[1;37mRPI \u001B[1;34mraspberrypi.cpp:1386 \u001B[0mRegistered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media1 and ISP device /dev/media0"
[2022-12-01T18:56:37.492 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  ""
[2022-12-01T18:56:37.493 UTC DEBG ][           org.kde.kstars.indi] - Received new device LibCamera
[2022-12-01T18:56:37.505 UTC DEBG ][           org.kde.kstars.indi] - INDIListener: New device "LibCamera"
[2022-12-01T18:56:37.507 UTC INFO ][           org.kde.kstars.ekos] - Ekos received a new device:  "LibCamera"
[2022-12-01T18:56:37.509 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CONNECTION >
[2022-12-01T18:56:37.604 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < DRIVER_INFO >
[2022-12-01T18:56:37.635 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < POLLING_PERIOD >
[2022-12-01T18:56:37.643 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < DEBUG >
[2022-12-01T18:56:37.654 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CONFIG_PROCESS >
[2022-12-01T18:56:37.672 UTC INFO ][           org.kde.kstars.indi] - LibCamera :  "[INFO] Debug is enabled. "
[2022-12-01T18:56:37.672 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < DEBUG_LEVEL >
[2022-12-01T18:56:37.689 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < LOGGING_LEVEL >
[2022-12-01T18:56:37.695 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < LOG_OUTPUT >
[2022-12-01T18:56:37.700 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Toggle Debug Level -- Driver Debug "
[2022-12-01T18:56:37.701 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Toggle Logging Level -- Messages "
[2022-12-01T18:56:37.702 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < ACTIVE_DEVICES >
[2022-12-01T18:56:37.726 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CAMERAS >
[2022-12-01T18:56:37.851 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Toggle Debug Level -- Driver Debug "
[2022-12-01T18:56:38.001 UTC INFO ][           org.kde.kstars.ekos] - Connecting to "LibCamera"
[2022-12-01T18:56:38.012 UTC WARN ][                       default] - QSqlDatabasePrivate::addDatabase: duplicate connection name 'opticaltrains_db', old connection removed.
[2022-12-01T18:56:38.058 UTC INFO ][           org.kde.kstars.indi] - LibCamera :  "[INFO] PixelArraySize 4056 x 3040 "
[2022-12-01T18:56:38.062 UTC INFO ][           org.kde.kstars.indi] - LibCamera :  "[INFO] UnitCellSize 1.550000 x 1.550000 "
[2022-12-01T18:56:38.063 UTC INFO ][           org.kde.kstars.ekos] - "LibCamera" Version: "1.0" Interface: 2 is connected.
[2022-12-01T18:56:38.200 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_EXPOSURE >
[2022-12-01T18:56:38.205 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_ABORT_EXPOSURE >
[2022-12-01T18:56:38.210 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_FRAME >
[2022-12-01T18:56:38.231 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_FRAME_RESET >
[2022-12-01T18:56:38.236 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_BINNING >
[2022-12-01T18:56:38.250 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < FITS_HEADER >
[2022-12-01T18:56:38.259 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_CAPTURE_FORMAT >
[2022-12-01T18:56:38.263 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_TRANSFER_FORMAT >
[2022-12-01T18:56:38.270 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_INFO >
[2022-12-01T18:56:38.293 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_COMPRESSION >
[2022-12-01T18:56:38.302 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD1 >
[2022-12-01T18:56:38.310 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_FRAME_TYPE >
[2022-12-01T18:56:38.320 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_CFA >
[2022-12-01T18:56:38.335 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < SCOPE_INFO >
[2022-12-01T18:56:38.347 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < WCS_CONTROL >
[2022-12-01T18:56:38.353 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < UPLOAD_MODE >
[2022-12-01T18:56:38.361 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < UPLOAD_SETTINGS >
[2022-12-01T18:56:38.373 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_FAST_TOGGLE >
[2022-12-01T18:56:38.379 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_FAST_COUNT >
[2022-12-01T18:56:38.384 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_VIDEO_STREAM >
[2022-12-01T18:56:38.392 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < STREAM_DELAY >
[2022-12-01T18:56:38.399 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < STREAMING_EXPOSURE >
[2022-12-01T18:56:38.413 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < FPS >
[2022-12-01T18:56:38.426 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < RECORD_STREAM >
[2022-12-01T18:56:38.436 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < RECORD_FILE >
[2022-12-01T18:56:38.452 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < RECORD_OPTIONS >
[2022-12-01T18:56:38.468 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_STREAM_FRAME >
[2022-12-01T18:56:38.491 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_STREAM_ENCODER >
[2022-12-01T18:56:38.497 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_STREAM_RECORDER >
[2022-12-01T18:56:38.502 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < LIMITS >
[2022-12-01T18:56:38.547 UTC INFO ][           org.kde.kstars.indi] - LibCamera :  "[INFO] Loading device configuration... "
[2022-12-01T18:56:38.549 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Toggle Debug Level -- Driver Debug "
[2022-12-01T18:56:38.549 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Toggle Logging Level -- Messages "
[2022-12-01T18:56:38.550 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Snopping on Mount Telescope Simulator "
[2022-12-01T18:56:38.551 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Snopping on Rotator Rotator Simulator "
[2022-12-01T18:56:38.551 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Snopping on Focuser Focuser Simulator "
[2022-12-01T18:56:38.551 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Snopping on Filter Wheel CCD Simulator "
[2022-12-01T18:56:38.557 UTC INFO ][           org.kde.kstars.indi] - LibCamera :  "[INFO] Upload settings set to client only. "
[2022-12-01T18:56:38.560 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Pixel format 100 is supported by SER recorder. "
[2022-12-01T18:56:38.561 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Pixel format 100 is supported by RAW encoder. "
[2022-12-01T18:56:38.563 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Frame ROI x:0 y:0 w:0 h:0 "
[2022-12-01T18:56:38.564 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Setting frame buffer size to 0 bytes. "
[2022-12-01T18:56:38.567 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Configuration successfully saved for CAMERAS. "
[2022-12-01T18:56:38.574 UTC INFO ][           org.kde.kstars.indi] - LibCamera :  "[INFO] Device configuration applied. "
[2022-12-01T18:56:38.574 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Configuration successfully loaded. "
[2022-12-01T18:56:38.637 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:38: Client 11: new arrival from 127.0.0.1:54186 - welcome!"
[2022-12-01T18:56:38.638 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  ""
[2022-12-01T18:56:38.815 UTC DEBG ][   org.kde.kstars.ekos.capture] - Registering new Module ( "Mount" )
[2022-12-01T18:56:38.902 UTC INFO ][     org.kde.kstars.ekos.focus] - "Idle."
[2022-12-01T18:56:39.227 UTC INFO ][     org.kde.kstars.ekos.align] - "World Coordinate System (WCS) is enabled."
[2022-12-01T18:56:39.245 UTC INFO ][           org.kde.kstars.ekos] - "LibCamera is online."
[2022-12-01T18:56:39.375 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Requested CCD Frame is (0,0) (4056 x 3040) "
[2022-12-01T18:56:39.376 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Frame ROI x:0 y:0 w:4056 h:3040 "
[2022-12-01T18:56:39.383 UTC DEBG ][           org.kde.kstars.indi] - LibCamera : "[DEBUG] Setting frame buffer size to 12330240 bytes. "
[2022-12-01T18:56:39.402 UTC INFO ][           org.kde.kstars.indi] - LibCamera :  "[INFO] World Coordinate System is enabled. "
[2022-12-01T18:56:39.403 UTC DEBG ][           org.kde.kstars.indi] - < LibCamera >: < CCD_ROTATION >
[2022-12-01T18:56:39.677 UTC INFO ][           org.kde.kstars.ekos] - "LibCamera is online."
[2022-12-01T18:56:43.508 UTC DEBG ][   org.kde.kstars.ekos.capture] - Preparing capture job "/home/stellarmate/Pictures/" for execution.
[2022-12-01T18:56:43.514 UTC INFO ][   org.kde.kstars.ekos.capture] - "Capturing 1.000-second  image..."
[2022-12-01T18:56:43.569 UTC DEBG ][           org.kde.kstars.indi] - Removing device "LibCamera"
[2022-12-01T18:56:43.620 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd: Options:"
[2022-12-01T18:56:43.621 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     verbose: 0"
[2022-12-01T18:56:43.622 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     info_text:"
[2022-12-01T18:56:43.622 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     timeout: 0"
[2022-12-01T18:56:43.623 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     width: 4056"
[2022-12-01T18:56:43.623 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     height: 3040"
[2022-12-01T18:56:43.623 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     output: "
[2022-12-01T18:56:43.623 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     post_process_file: "
[2022-12-01T18:56:43.623 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     rawfull: 0"
[2022-12-01T18:56:43.623 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     preview: none"
[2022-12-01T18:56:43.624 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     qt-preview: 0"
[2022-12-01T18:56:43.624 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     transform: identity"
[2022-12-01T18:56:43.624 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     roi: all"
[2022-12-01T18:56:43.625 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     metering: "
[2022-12-01T18:56:43.625 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     exposure: "
[2022-12-01T18:56:43.625 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     ev: 0"
[2022-12-01T18:56:43.625 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     awb: "
[2022-12-01T18:56:43.625 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     flush: false"
[2022-12-01T18:56:43.626 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     wrap: 0"
[2022-12-01T18:56:43.626 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     brightness: 0"
[2022-12-01T18:56:43.626 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     contrast: 0"
[2022-12-01T18:56:43.626 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     saturation: 0"
[2022-12-01T18:56:43.626 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     sharpness: 0"
[2022-12-01T18:56:43.626 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     framerate: 30"
[2022-12-01T18:56:43.626 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     denoise: "
[2022-12-01T18:56:43.626 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     viewfinder-width: 0"
[2022-12-01T18:56:43.627 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     viewfinder-height: 0"
[2022-12-01T18:56:43.627 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     tuning-file: "
[2022-12-01T18:56:43.627 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     lores-width: 0"
[2022-12-01T18:56:43.627 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     lores-height: 0"
[2022-12-01T18:56:43.627 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     mode: unspecified"
[2022-12-01T18:56:43.627 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     viewfinder-mode: unspecified"
[2022-12-01T18:56:43.628 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd:     metadata: Valid options are"
[2022-12-01T18:56:43.628 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd: read EOF"
[2022-12-01T18:56:43.628 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "<delProperty device=\"LibCamera\"/>"
[2022-12-01T18:56:43.628 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  "2022-12-01T18:56:43: Driver indi_libcamera_ccd: Terminated after #0 restarts."
[2022-12-01T18:56:43.628 UTC DEBG ][           org.kde.kstars.indi] - INDI Server:  ""
[2022-12-01T18:56:43.629 UTC CRIT ][           org.kde.kstars.indi] - INDI driver  "indi_libcamera_ccd"  crashed!
[2022-12-01T18:56:43.675 UTC DEBG ][           org.kde.kstars.indi] - INDIListener: Removing device "LibCamera"
[2022-12-01T18:56:43.677 UTC INFO ][           org.kde.kstars.ekos] - "LibCamera is offline."
[2022-12-01T18:56:43.680 UTC DEBG ][           org.kde.kstars.indi] - INDI: Stopping local drivers...
[2022-12-01T18:56:43.682 UTC DEBG ][           org.kde.kstars.indi] - Removing managed driver "LibCamera"
[2022-12-01T18:56:43.683 UTC DEBG ][           org.kde.kstars.indi] - INDIListener: Removing client manager for server localhost @ 7624
[2022-12-01T18:56:43.688 UTC DEBG ][           org.kde.kstars.indi] - Stopping INDI Driver  "indi_libcamera_ccd"
[2022-12-01T18:56:43.690 UTC DEBG ][           org.kde.kstars.indi] - Stopping INDI Server  "localhost" @ 7624
[2022-12-01T18:56:43.693 UTC DEBG ][           org.kde.kstars.indi] - INDI server disconnected from BLOB manager for Device: "LibCamera" Property: "CCD1" Exit code: -1
[2022-12-01T18:56:43.693 UTC DEBG ][           org.kde.kstars.ekos] - Resetting Ekos Manager...
[2022-12-01T18:56:43.862 UTC INFO ][           org.kde.kstars.ekos] - "INDI services stopped."
Last edit: 1 year 4 months ago by Simon.
1 year 4 months ago #88705

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 don't attach to kstars, you attach to the driver code. You can debug the whole thing without kstars by using indi_setprop with the right properties.

If you follow you instructions, you can set a breakpoint in, say, Connect() and then hit the connect button in kstars (or set it to On via indi_set_prop). You debugger will stop at that breakpoint.
1 year 4 months ago #88707

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

  • Posts: 112
  • Thank you received: 34

Replied by Simon on topic INDI LibCamera Driver

Thank you ANJO.
Can you give me example of how to start exposure with indi_setprop? Probably there is domentation somewhere that I should have read? :)
1 year 4 months ago #88708

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

Start the driver, connect and then:

pi@astrocam:~/astro/cam/libcamera-apps/build $ indi_getprop |grep EXP
LibCamera.CCD_EXPOSURE.CCD_EXPOSURE_VALUE=1
LibCamera.CCD_ABORT_EXPOSURE.ABORT=Off
LibCamera.STREAMING_EXPOSURE.STREAMING_EXPOSURE_VALUE=0.10000000000000000555
LibCamera.STREAMING_EXPOSURE.STREAMING_DIVISOR_VALUE=1
LibCamera.STREAMING_EXPOSURE.STREAMING_EXPOSURE_VALUE=0.10000000000000000555
LibCamera.STREAMING_EXPOSURE.STREAMING_DIVISOR_VALUE=1
pi@astrocam:~/astro/cam/libcamera-apps/build $ indi_setprop LibCamera.CCD_EXPOSURE.CCD_EXPOSURE_VALUE=1
Last edit: 1 year 4 months ago by Anjo.
1 year 4 months ago #88709

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

Other neat tricks:

# connect a driver
pi@astrocam:~/astro/cam/libcamera-apps/build $ indi_setprop LibCamera.CONNECTION.CONNECT=On
# disconnect a connected driver
pi@astrocam:~/astro/cam/libcamera-apps/build $ indi_setprop LibCamera.CONNECTION.DISCONNECT=On
1 year 4 months ago #88710

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

Basically, at this point I wouldn't worry about EKOS. The primary target is to get several exposures and aborts working which can be done via the shell. When you're debugging, you can already see you're getting the correct exposure values.

All other things, like gain or whatever should be done by putting in a command line string in INDI via some generic LIBCAMERA_OPTIONS and parse that. Then you can quily test if things work.

After that, there should be UI for the individual options, but frankly, that's pretty tiresome work. Bla create prop, Bla create propP, bla parse INewFoo. Boooring.

The only interesting part is getting the whole thing to run - and hopefully more reliable than v4l2 and raspi...
1 year 4 months ago #88711

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

Finally I can help at least a bit, I do not know how ekos is translating RAW frames, that Jasem might know but I my self use this python script, but it uses openCV, i guess we can do it without that :):
I will redact code as I use openCV to detect object and crop it. This is used for PACKED mipi, for unpacked, we do not need this part of unpacking code.
    width = int(sys.argv[3])
    height = int(sys.argv[4])
    bayer_order = bayer_order_maps[sys.argv[5].lower()]
   img = unpack_mipi_raw10(remove_padding(data, width, height, 10)).reshape(height, width, 1)
   img = img >> 2
   img = img.astype(np.uint8)
   img = cv2.cvtColor(img, bayer_order)
   save_image(imgCrop, os.path.splitext(outputPath)[0] + ".tiff")
 
def unpack_mipi_raw10(byte_buf):
    data = np.frombuffer(byte_buf, dtype=np.uint8)
    # 5 bytes contain 4 10-bit pixels (5x8 == 4x10)
    b1, b2, b3, b4, b5 = np.reshape(
        data, (data.shape[0]//5, 5)).astype(np.uint16).T
    o1 = (b1 << 2) + ((b5) & 0x3)
    o2 = (b2 << 2) + ((b5 >> 2) & 0x3)
    o3 = (b3 << 2) + ((b5 >> 4) & 0x3)
    o4 = (b4 << 2) + ((b5 >> 6) & 0x3)
    unpacked = np.reshape(np.concatenate(
        (o1[:, None], o2[:, None], o3[:, None], o4[:, None]), axis=1),  4*o1.shape[0])
    return unpacked
 
def align_down(size, align):
    return (size & ~((align)-1))
 
def align_up(size, align):
    return align_down(size + align - 1, align)
 
def remove_padding(data, width, height, bit_width):
    buff = np.frombuffer(data, np.uint8)
    real_width = width // 8 * bit_width
    align_width = align_up(real_width, 32)
    align_height = align_up(height, 16)
    if(height == 1080):
        align_height=1080
 
    buff = buff.reshape(align_height, align_width)
    buff = buff[:height, :real_width]
    buff = buff.reshape(height * real_width)
    return buff
 
 
def save_image(img, name):
    cv2.imwrite(name, img, params=(cv2.IMWRITE_TIFF_COMPRESSION,1))
 
1 year 4 months ago #88719

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

  • Posts: 112
  • Thank you received: 34

Replied by Simon on topic INDI LibCamera Driver

Yeeeeee, OUTTA I'm glad that you solved issues with your device. I think we are making good progress here. I'm can't wait to put my HQ cam finnaly to test under clear skies and do some long exposure test! :D
1 year 4 months ago #88720

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

There's already code in libcamera-app to create dng, though, which are to my knowledge some "standard" raw format.

Check out dng_save in libcamera-apps/image/dng.cpp.

I played around some more and in theory I guess using one app should work.

There seem to be mixups between what libcamera threads and indi threads are doing. Also, startPreview seems to get called even when you give it nopreview in the options.
1 year 4 months ago #88721

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

I added your code to my fork, but it gives me the "full frame", ie 1937xsomething and not 1920x1080 as it should?

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

Also, I think we should just copy over the libcamera-app code verbatim like it was done before with the includes. I just don't know how to get the top level to also build the sublevel? Then we shouldn't need to make install or anything of the libcamera-apps, potentially overwriting system stuff.

When things work, we can pull out the bits we need into the driver and remove the apps code, but I'm not sure it's worth the effort.

For now, getting repeatable exposures to work should be the first prio.
Last edit: 1 year 4 months ago by Anjo.
1 year 4 months ago #88722

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

  • Posts: 112
  • Thank you received: 34

Replied by Simon on topic INDI LibCamera Driver

@Anjo: That's wierd! For my sensor imx477 it returns correct values. What about pixel size? Is that correct?
Last edit: 1 year 4 months ago by Simon.
1 year 4 months ago #88723

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

Time to create page: 1.743 seconds