Coder Social home page Coder Social logo

acquire-driver-hdcam's People

Contributors

aliddell avatar dependabot[bot] avatar nclack avatar

Watchers

 avatar

acquire-driver-hdcam's Issues

Failure to set output trigger

Expected setting the output trigger to work:

import acquire
runtime = acquire.Runtime() # initializes driver adapters
props = runtime.get_configuration() 
props.video[0].camera.identifier = runtime.device_manager().select(acquire.DeviceKind.Camera, 'Hamamatsu C15440.*')

p.video[0].camera.settings.binning = 1
p.video[0].camera.settings.shape = (2304, 2304)
p.video[0].camera.settings.pixel_type = SampleType.U16
p.video[0].max_frame_count = 10 # finite acquisition of 10 frames. Use 0 for infinite.

p.video[0].camera.settings.input_triggers.frame_start = acquire.Trigger(
	enable=True, line=0, edge="Rising"
)
p.video[0].camera.settings.output_triggers.exposure = acquire.Trigger(
	enable=True, line=1, edge="Rising"
)

props.video[0].storage.identifier = runtime.device_manager().select(acquire.DeviceKind.Storage,'trash') 

props = runtime.set_configuration(props)

But it results in this:

ERROR acquire.runtime 2023-08-08 12:49:47,885 runtime.rs:40 C:\actions-runner\_work\acquire-driver-hdcam\acquire-driver-hdcam\src\dcam.getset.c:26 - prop_write_i32(): Expression failed:
        dcamprop_setgetvalue(hdcam, prop_id, &v, 0)
        DCAMERR_INVALIDPARAM invalid parameter

ERROR acquire.runtime 2023-08-08 12:49:47,885 runtime.rs:40 C:\actions-runner\_work\acquire-driver-hdcam\acquire-driver-hdcam\src\dcam.getset.c:154 - array_prop_rw_i32(): Expression was false:
        prop_write_i32(h, base + index * step, value, prop_name)

Error setting shape and offset of camera.

Setting an offset of the camera errors out if the new shape of the camera hasn't been set yet. Temporary work around is setting configuration after changing shape and then setting offset as seen below.

self.p.video[stream_id].camera.settings.shape = (tile_shape[0], tile_shape[1]) self.runtime.set_configuration(self.p) self.p.video[stream_id].camera.settings.offset = (int((2304 - tile_shape[0])/2), int((2304 - tile_shape[1])/2)) self.runtime.set_configuration(self.p)

image

Trigger metadata does not accurately reflect input/output capability for trigger types

On line 385 and the following verses:

metadata->digital_lines =
  (struct CameraPropertyMetadataDigitalLineMetadata){
      .line_count = 5,
      .names = {
        [LINE_EXT_TRIG] = "Ext.Trig",
        [LINE_TIMING1] = "Timing 1",
        [LINE_TIMING2] = "Timing 2",
        [LINE_TIMING3] = "Timing 3",
        [LINE_SOFTWARE] = "Software",
      },
};
metadata->triggers = (struct CameraPropertiesTriggerMetadata){
    .acquisition_start = { .input = 1, .output = 0 },
    .exposure = { .input = 1, .output = 1 },
    .frame_start = { .input = 1, .output = 1 },
};

e.g., metadata->triggers.exposure.output should be 0b00001110 since the "Timing" triggers are outputs (IIRC).

Aborting a finite acquisition hangs

When doing

  1. set max_frame_count>0
  2. enable frame triggering.
  3. acquire_start()
  4. acquire_abort()

The process hangs in the last step (abort). It appears to be specific to hdcam - doesn't happen when selecting a simulated camera. It's important to wait till the camera actually starts before calling abort.

  • reproduce
  • make a test
  • fix

DCAM startup times

DCAM appears to allocate a bunch of memory at some point when starting up.

It also tends to increase the test run time.

Runs without and with dcam:

Test project C:/Users/nclack/src/calliphlox/cpx/build
    Start 1: test-instance-stage-axis
1/4 Test acquire-project/cpx#1: test-instance-stage-axis .........   Passed    0.10 sec
    Start 2: test-list-devices
2/4 Test acquire-project/cpx#2: test-list-devices ................   Passed    0.11 sec
    Start 3: test-unit-tests
3/4 Test acquire-project/cpx#3: test-unit-tests ..................   Passed    0.11 sec
    Start 4: test-zero-config-start
4/4 Test acquire-project/cpx#4: test-zero-config-start ...........   Passed    0.11 sec

100% tests passed, 0 tests failed out of 4

Total Test time (real) =   0.44 sec
 ~#@❯  ctest -C Debug --output-on-failure                                                                        
Test project C:/Users/nclack/src/calliphlox/cpx/build
    Start 1: test-instance-stage-axis
1/4 Test acquire-project/cpx#1: test-instance-stage-axis .........   Passed    6.08 sec
    Start 2: test-list-devices
2/4 Test acquire-project/cpx#2: test-list-devices ................   Passed    6.08 sec
    Start 3: test-unit-tests
3/4 Test acquire-project/cpx#3: test-unit-tests ..................   Passed    6.11 sec
    Start 4: test-zero-config-start
4/4 Test acquire-project/cpx#4: test-zero-config-start ...........   Passed    6.06 sec

dcam start robustness issue

see this zulip message

  • Try to restart the dcam driver if dcam_start fails.

Questions

  • Why does dcam allocate so much memory on init? Is it controllable?
  • Is there a resource leak w dcam that I can measure?

setting an roi is broken

Doing something like:

import acquire
runtime = acquire.Runtime() 
p = runtime.get_configuration() 
p.video[0].camera.identifier = runtime.device_manager().select(acquire.DeviceKind.Camera, 'Hamamatsu C15440.*')
p.video[0].camera.settings.shape = (1700, 512)
p.video[0].camera.settings.offset = (302, 896)
p = runtime.set_configuration(p)

fails with

ERROR acquire.runtime 2023-08-14 13:49:21,136 runtime.rs:40 C:\actions-runner\_work\acquire-driver-hdcam\acquire-driver-hdcam\src\dcam.getset.c:53 - prop_write_u32(): Expression failed:
        dcamprop_setgetvalue(hdcam, prop_id, &v, 0)
        DCAMERR_INVALIDPARAM invalid parameter

ERROR acquire.runtime 2023-08-14 13:49:21,137 runtime.rs:40 C:\actions-runner\_work\acquire-driver-hdcam\acquire-driver-hdcam\src\dcam.getset.c:53 - prop_write_u32(): Expression failed:
        dcamprop_setgetvalue(hdcam, prop_id, &v, 0)
        DCAMERR_INVALIDSUBARRAY the combination of subarray values are invalid. e.g. DCAM_IDPROP_SUBARRAYHPOS + DCAM_IDPROP_SUBARRAYHSIZE is greater than the number of horizontal pixel of sensor.

dcam: trigger line parameter has the wrong symantics

Trigger.line ends up corresponding with DCAM_IDPROP_TRIGGER_CONNECTOR.

As it's implemented now, that prop is describing how the trigger line is routed internally. Right now, we effectively need always to set Trigger.line to 2, which corresponds to DCAMPROP_TRIGGER_CONNECTOR__BNC.

The design idea was that Trigger.line reflects a physical trigger line id. The index of the line in the list of trigger lines is the logical id.

Historically, I've gotten very confused about applying all this to dcam and what different parameters mean. So there's some additional experimentation needed here to really validate what DCAM_IDPROP_TRIGGER_CONNECTOR means and how to properly enumerate trigger lines.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.