tiagocoutinho / pylonctl

Basler command line tool
GNU General Public License v3.0
5 stars 1 forks source link

issue with image acquisition - daA2500-14uc #1

Open te-01 opened 3 years ago

te-01 commented 3 years ago

Hello,

I have problems with pypylon + gstreamer. Therefore I was searching for a solution and found pylonctl.

Getting some info from the Basler daA2500-14uc dart camera was possible with pylonctl but acquireing images / videostreams was not possible (please see logging at the end)

$ pylonctl --log-level=debug camera --serial=23504187 acquire -n 3 -e .1

(my intention was to use this (pylonctl -) stream as an input for gstreamer with an udpsink on the commandline like $ pylonctl acquire <options?> | gst-launch-1.0 -v fdsrc ! ... ! udpsink ...) )

could you please check the issue for the Basler daA2500-14uc and for the daA3840-45uc (we will use both of them)

Thank you in advance!


$ pylonctl table +-----------+----------+-----------+------------------------+------------+------------+----------+-----------+------------+--------------+--------+------------+-------------+-------------+-----------+----------+ | Class | DeviceGU | DeviceIdx | Friendly name | Full name | Manufactur | Name | ProductId | Serial Nb. | SpeedSupport | TLType | TransferMo | UsbDriverTy | UsbPortVers | User name | VendorId | | | ID | | | | erInfo | | | | Bitmask | | deKey | peName | ionBcd | | | +-----------+----------+-----------+------------------------+------------+------------+----------+-----------+------------+--------------+--------+------------+-------------+-------------+-----------+----------+ | BaslerUsb | 26760166 | 0x2 | Basler daA2500-14uc (2 | 2676:ba03: | dtx=xa3 | daA2500- | 0xba03 | 23504187 | 12 | U3V | dtx | Libusb | 0x210 | | 0x2676 | | | A53B | | 3504187) | 1:1:2 | | 14uc | | | | | | | | | | +-----------+----------+-----------+------------------------+------------+------------+----------+-----------+------------+--------------+--------+------------+-------------+-------------+-----------+----------+

$ pylonctl camera --serial 23504187 info DeviceClass: BaslerUsb DeviceFactory: USB/BaslerUsb 6.2.0.18677 DeviceGUID: 26760166A53B DeviceIdx: 0x2 FriendlyName: Basler daA2500-14uc (23504187) FullName: 2676:ba03:1:1:2 InterfaceID: DefaultInterface ManufacturerInfo: dtx=xa3 ModelName: daA2500-14uc ProductId: 0xba03 SerialNumber: 23504187 SpeedSupportBitmask: 12 TLType: U3V TransferModeKey: dtx UsbDriverTypeName: Libusb UsbPortVersionBcd: 0x210 UserDefinedName: VendorId: 0x2676 VendorName: Basler XMLSource: Device

$ pylonctl --log-level=debug camera --serial=23504187 acquire -n 3 -e .1 Acquiring 3 frames on Basler daA2500-14uc (23504187) (Total acq. time: 0.300s) 2021-04-23 15:18:21,222 DEBUG MainThread 2676:ba03:1:1:2: OnOpened: Preparing network parameters 2021-04-23 15:18:21,225 DEBUG MainThread 2676:ba03:1:1:2: OnOpened: Finished configuration Traceback (most recent call last): File "/home/xyz/.local/bin/pylonctl", line 8, in sys.exit(cli()) File "/usr/lib/python3/dist-packages/click/core.py", line 764, in call return self.main(args, kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke return callback(args, *kwargs) File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), args, *kwargs) File "/home/xyz/.local/lib/python3.8/site-packages/pylonctl/cli.py", line 338, in general_acquisition with Acquisition( File "/home/xyz/.local/lib/python3.8/site-packages/pylonctl/camera.py", line 207, in enter self.prepare() File "/home/xyz/.local/lib/python3.8/site-packages/pylonctl/camera.py", line 118, in prepare_acq camera.ExposureTimeAbs = exposure 1e6 File "/home/xyz/.local/lib/python3.8/site-packages/pylonctl/camera.py", line 58, in setattr return setattr(self.icam, name, value) File "/home/xyz/.local/lib/python3.8/site-packages/pypylon/pylon.py", line 4300, in setattr self.GetNodeMap().GetNode(attribute).SetValue(val) File "/home/xyz/.local/lib/python3.8/site-packages/pypylon/genicam.py", line 1357, in GetNode return _genicam.INodeMap_GetNode(self, Name) _genicam.LogicalErrorException: Node not existing (file 'genicam_wrap.cpp', line 16139)

tiagocoutinho commented 3 years ago

Thanks for raising the issue. I confirm your bug. Seems some models use ExposureTimeAbs (the ones I am working with). Other models (such as the dart models) use ExposureTime.

Older model (pilot and scout) seem to need a configuration using ExposureTimeBaseAbs + camera.ExposureTimeRaw

I will try to provide a fix ASAP

tiagocoutinho commented 3 years ago

I made a fix in the master branch. I also built a new version (0.2.3) which should be available to test on pypi.

Since I don't have this kind of cameras it is a little hard to test so if you could confirm if the fix solves your problem it would be great.

te-01 commented 3 years ago

Hello Tiago,

thank you very much for your fast response! unfortunately I have now another issue with the emoji library:

$ pylonctl --log-level=debug camera --serial=23504187 acquire -n 3 -e .1 Traceback (most recent call last): File "/home/xyz/.local/bin/pylonctl", line 8, in sys.exit(cli()) File "/usr/lib/python3/dist-packages/click/core.py", line 764, in call return self.main(args, kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke return callback(args, *kwargs) File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), args, **kwargs) File "/home/xyz/.local/lib/python3.8/site-packages/pylonctl/cli.py", line 354, in camera_acquisition movie_camera = emoji.EMOJI_ALIAS_UNICODE[":movie_camera:"] AttributeError: module 'emoji' has no attribute 'EMOJI_ALIAS_UNICODE'

$ pip3 list | grep emoji emoji 1.2.0

tiagocoutinho commented 3 years ago

I was using emoji 0.6. Seems this library evolved a lot in the last 8 months. Always embarrassing to have an emoji related bug in your code, isn't it ;-) ?

I fixed it and launched a new version 0.2.5 in pypi.

Thanks for testing.

te-01 commented 3 years ago

Hello Tiago,

thank you - i will test this patch today as soon as possible and also check the other things

te-01 commented 3 years ago

Hello Tiago, testing v0.2.6 shows the same error as v0.2.2


$ pylonctl --log-level=debug camera --serial=23504187 acquire -n 3 -e .1 2021-05-05 00:01:56,450 DEBUG MainThread asyncio: Using selector: EpollSelector 2021-05-05 00:01:56,450 DEBUG MainThread asyncio: Using selector: EpollSelector 2021-05-05 00:01:56,454 DEBUG MainThread root: OnOpened: Preparing network parameters 2021-05-05 00:01:56,457 DEBUG MainThread root: OnOpened: Finished configuration Elapsed time: 0.000000s Traceback (most recent call last): File "/home/xyz/.local/bin/pylonctl", line 8, in sys.exit(cli()) File "/usr/lib/python3/dist-packages/click/core.py", line 764, in call return self.main(args, kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke return callback(args, *kwargs) File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), args, **kwargs) File "/home/xyz/.local/lib/python3.8/site-packages/pylonctl/cli.py", line 367, in camera_acquisition with camera, acq, prog_bar: File "/home/xyz/.local/lib/python3.8/site-packages/pylonctl/camera.py", line 232, in enter self.prepare() File "/home/xyz/.local/lib/python3.8/site-packages/pylonctl/camera.py", line 212, in prepare prepare_acq( File "/home/xyz/.local/lib/python3.8/site-packages/pylonctl/camera.py", line 132, in prepare_acq camera.AcquisitionFrameRateEnable = False File "/home/xyz/.local/lib/python3.8/site-packages/pylonctl/camera.py", line 59, in setattr return setattr(self.icam, name, value) File "/home/xyz/.local/lib/python3.8/site-packages/pypylon/pylon.py", line 4300, in setattr self.GetNodeMap().GetNode(attribute).SetValue(val) File "/home/xyz/.local/lib/python3.8/site-packages/pypylon/genicam.py", line 1357, in GetNode return _genicam.INodeMap_GetNode(self, Name) _genicam.LogicalErrorException: Node not existing (file 'genicam_wrap.cpp', line 16139)

$ pip3 show pylonctl Name: pylonctl Version: 0.2.6 ... Location: /home/xyz/.local/lib/python3.8/site-packages Requires: numpy, beautifultable, PyQt5, click, chronometer, wcwidth, pypylon, treelib, pyqtgraph, emoji, prompt-toolkit Required-by:

tiagocoutinho commented 3 years ago

I am sorry it is not working yet. Seems like your model doesn't support setting AcquisitionFrameRateEnable. Before I make another fix, can you please run:

pylonctl camera --serial=23504187 param table --style=compact > dump.txt

and send me the generated dump.txt output? This will give me a better idea of what nodes your camera has