forked from basler/gst-plugin-pylon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_sequencer_state.py
More file actions
82 lines (63 loc) · 2.76 KB
/
check_sequencer_state.py
File metadata and controls
82 lines (63 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env python3
"""
Check the current state of the sequencer and pixel format settings
"""
from pypylon import pylon
try:
camera = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice())
camera.Open()
print(f"Connected to: {camera.GetDeviceInfo().GetModelName()}")
print(f"Serial Number: {camera.GetDeviceInfo().GetSerialNumber()}\n")
# Check current sequencer state
print('Current Sequencer State:')
print(f'SequencerMode: {camera.SequencerMode.GetValue()}')
print(f'SequencerConfigurationMode: {camera.SequencerConfigurationMode.GetValue()}')
# Check if pixel format can change in sequencer
print('\n--- Checking Sequencer Sets Configuration ---')
# Store original values
orig_seq_mode = camera.SequencerMode.GetValue()
orig_config_mode = camera.SequencerConfigurationMode.GetValue()
orig_pixel_format = camera.PixelFormat.GetValue()
print(f'Original Pixel Format (outside sequencer): {orig_pixel_format}')
try:
# Make sure sequencer is off first
if camera.SequencerMode.GetValue() == "On":
camera.SequencerMode.SetValue("Off")
# Enter config mode
camera.SequencerConfigurationMode.SetValue('On')
# Check first few sequencer sets
for set_idx in range(3):
camera.SequencerSetSelector.SetValue(set_idx)
print(f'\n--- Sequencer Set {set_idx} ---')
print(f' Exposure Time: {camera.ExposureTime.GetValue():.2f} μs')
print(f' Pixel Format: {camera.PixelFormat.GetValue()}')
print(f' Width: {camera.Width.GetValue()}')
print(f' Height: {camera.Height.GetValue()}')
print(f' SequencerSetNext: {camera.SequencerSetNext.GetValue()}')
# Exit config mode
camera.SequencerConfigurationMode.SetValue('Off')
# Restore original sequencer mode
camera.SequencerMode.SetValue(orig_seq_mode)
except Exception as e:
print(f'Error checking sequencer sets: {e}')
# Try to exit config mode if error occurred
try:
camera.SequencerConfigurationMode.SetValue('Off')
except:
pass
# Check if sequencer is currently enabled
print(f'\n--- Final State ---')
print(f'SequencerMode: {camera.SequencerMode.GetValue()}')
print(f'Current Pixel Format: {camera.PixelFormat.GetValue()}')
# Check what exposure mode is active
try:
if hasattr(camera, 'ExposureMode'):
print(f'Exposure Mode: {camera.ExposureMode.GetValue()}')
except:
pass
# Check trigger configuration
print(f'\n--- Trigger Configuration ---')
print(f'SequencerTriggerSource: {camera.SequencerTriggerSource.GetValue()}')
camera.Close()
except Exception as e:
print(f"Error: {e}")