neurogears / vestibular-vr

Closed-loop VR setup for Rancz Lab
2 stars 0 forks source link

Camera interface issues #20

Open RoboDoig opened 1 year ago

RoboDoig commented 1 year ago

From Ede:

Possible issue with Camera Trigger 1 To acquire with 2 cameras, I duplicated the relevant parts of the workflow and updated the register addresses (36 for CamHz and 37 for CamExposure), but the second camera doesn't start. Checked with a scope, T1 on the HARP board does not fire, T0 does as expected. As a workaround I just connected both cameras to the same trigger for now, so not high priority.

Camera Trigger duration limits For the camera trigger duration, the max value the board takes is 5000, above that it stops with errorneous write command. While 5ms max may be enough, it would be nice to be able to get more exposure times in certain conditions. I tried it with a low frame rate as well, so I don't think that the frame rate is limiting the pulse width.

ederancz commented 10 months ago

From Andrew (5 May) The board that you have had some errors in the original fabrication that were manually repaired by David. It was tested and working before shipping but possible that something broke during shipping. David is producing an updated v2 of the board without these errors that will be sent to you.

RoboDoig commented 4 months ago

@ederancz are the cameras still connected to the same trigger? Looked like the triggering was working for both cameras yesterday but I now realise they may still be on the same trigger port.

ederancz commented 4 months ago

Hi @robodoig, yes, they are still on the same trigger. TBH it is working fine, but if you need feedback, we can check on the weekend.

On 16 Feb 2024, at 10:14, RoboDoig @.***> wrote:

@ederancz https://github.com/ederancz are the cameras still connected to the same trigger? Looked like the triggering was working for both cameras yesterday but I now realise they may still be on the same trigger port.

— Reply to this email directly, view it on GitHub https://github.com/neurogears/vestibular-vr/issues/20#issuecomment-1948013091, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIRGCCMVK5OMLOWCHMTT2WTYT4PO5AVCNFSM6AAAAAAXG4UPA2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBYGAYTGMBZGE. You are receiving this because you were mentioned.

RoboDoig commented 4 months ago

Ok thanks for confirming. No need to check anything just wanted to make sure. The Bonsai workflow allows you to set different imaging settings for each camera but we should just keep in mind (when looking at metadata etc.) that in the current setup only one of those settings will be applied in practice.

RoboDoig commented 1 month ago

You should have now received extra H1/H2 boards from OEPS - are the camera interface issues still present on the new H1 board?

EleonoraAmbrad commented 1 month ago

I have not tested this but I was also not sure how to set different imaging settings from Bonsai. so far, I have used the spin view software to change gain and exposure time in each camera and these settings were then correctly applied in bonsai (cameras had different exposure times due to slight variations in setup).

RoboDoig commented 1 month ago

@EleonoraAmbrad see original message from Ede at the top of this issue for a debugging approach.

In the main workflow, the camera settings are currently hard-coded in the CameraControl sub-workflow. I think previously Ede connected both cameras to the same trigger because of this issue so only the Cam0 settings are used. Another way to debug would be to change the second camera to use the second trigger on the new H1 board. If the interface is working, both cameras should be stopped / started by the start / stop camera keys.

EleonoraAmbrad commented 1 month ago

I will test this with the new H1 and come back to you next week

EleonoraAmbrad commented 1 month ago

@RoboDoig i am not sure what you mean but in Main there does not seem to be a way to change exposure time and sampling rate. are you referring only to the triggering issue?

RoboDoig commented 1 month ago

Inside CameraControl there are a few HARP message creation nodes, Should be named something like Cam0TriggerFrequency, Cam0TriggerDuration, Cam1TriggerFrequency etc. The values there will set the sampling rate, exposure for the cameras.

Brings up another point which is that you may want these to be settable in the schema?

EleonoraAmbrad commented 1 month ago

ok I wasn't sure that's what those nodes do. the thing is I have been changing the exposure time manually on spin view. this has been the best way to get good illumination (not by setting "triggered width" exposure). would there be a way to change that from bonsai?

RoboDoig commented 1 month ago

Oh yes I remember now for exposure. Nonetheless, you should still be able to change frequency from Bonsai.

I think if you want to change exposure from the Bonsai trigger there is a setting in SpinView to have the incoming pulse override the manual exposure time.

EleonoraAmbrad commented 1 month ago

ok, and the incoming pulse would be a number (exposure time) generated by a harp command?

RoboDoig commented 1 month ago

Yes, I believe the way it works is that each pulse holds the camera shutter open depending on its length. So the HARP command just sets the pulse width for the camera trigger and then that in turn drives the shutter opening/closing.

EleonoraAmbrad commented 1 month ago

ok, thanks for the clarification. By the way do I need to take specific care about something before plugging the new H1 in? (do we need to do some firmware update?)

EleonoraAmbrad commented 1 month ago

updates on the new H1: triggers work well (both t1 and t0) and it is possible to change the length of the exposure time with the trigger. Max value still seems to be 5000 (microseconds?). This is not a big deal, provided that we can change the gain. Is it possible to control gain from bonsai?

Generally it would also be great to be able to set these variables from the schema.