acquire-project / acquire-driver-hdcam Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
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)
See acquire-project/acquire-common#34
execute_trigger
behavior needs to be updated so that when it is called, a software trigger is effectively issued even if hardware triggering is enabled. This is used during acquire_abort()
so the devices release a hardware-timed wait.
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)
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).
When doing
max_frame_count>0
acquire_start()
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.
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
see this zulip message
Questions
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.
Observing 17 fps from the Orca fusions at 2304x2304 u16 even though bandwidth says 940-950MB/s.
17 fps corresponds to 180 MB/s.
What's going on?
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.