rpiRobotics / rpi_gige_v_framework

BSD 3-Clause "New" or "Revised" License
6 stars 5 forks source link

Does the code only run in a rpi? #5

Open davidbsp opened 5 years ago

davidbsp commented 5 years ago

I'm trying to run this on ROS Melodic in a Ubuntu 18.04 Laptop.

This is the error msg I get:

 rosrun rpi_gige_v_framework display_frame 
[GevCameraInfo(fIPv6=False, ipAddr='192.168.1.152', ipAddrLow=0L, ipAddrHigh=0L, macLow=230897148L, macHigh=1L, host=GevNetworkInterface(fIpv6=False, ipAddr='192.168.1.153', ipAddrLow=0L, ipAddrHigh=0L, ifIndex=2L), mode=2147483649L, capabilites=0L, manufacturer='Teledyne DALSA', model='Nano-C2420', serial='S1153083', version='1.04', username='S1153083')]
Traceback (most recent call last):
  File "/home/david/catkin_ws/src/rpi_gige_v_framework/scripts/display_frame", line 33, in <module>
    main()
  File "/home/david/catkin_ws/src/rpi_gige_v_framework/scripts/display_frame", line 23, in main
    cam.read()
  File "/home/david/catkin_ws/src/rpi_gige_v_framework/src/rpi_gige_v_framework/rpi_gige_v_framework.py", line 172, in read
    res=gevapi.GevStartImageTransfer(self._camera, 1)
AttributeError: 'module' object has no attribute 'GevStartImageTransfer'

Is this only prepared to run in a rpi? If so, what should I do to change it for a different (x86_64) architecture?

davidbsp commented 5 years ago

So, I tried to re-generate the py libraries in my laptop with ctypesgen. First I ran into this error, while trying to generate the library:

ValueError: invalid literal for long() with base 8: '08420217248550443400745280086994171'

So, I applied THIS patch (source: https://github.com/ledatelescope/bifrost/issues/115)

It solved the error, and I generated the two new "gevapi.py" and "gevoslib.py" files.

Trying to run the code again, I now get a different error:

rosrun rpi_gige_v_framework display_frame 
[GevCameraInfo(fIPv6=False, ipAddr='192.168.1.152', ipAddrLow=0L, ipAddrHigh=0L, macLow=230897148L, macHigh=1L, host=GevNetworkInterface(fIpv6=False, ipAddr='192.168.1.153', ipAddrLow=0L, ipAddrHigh=0L, ifIndex=2L), mode=2147483649L, capabilites=0L, manufacturer='Teledyne DALSA', model='Nano-C2420', serial='S1153083', version='1.04', username='S1153083')]
Traceback (most recent call last):
  File "/home/david/catkin_ws/src/rpi_gige_v_framework/scripts/display_frame", line 33, in <module>
    main()
  File "/home/david/catkin_ws/src/rpi_gige_v_framework/scripts/display_frame", line 19, in main
    cam.open(camera_id)
  File "/home/david/catkin_ws/src/rpi_gige_v_framework/src/rpi_gige_v_framework/rpi_gige_v_framework.py", line 141, in open
    if (format_.value != gevapi.fmtMono8 and format_.value != gevapi.fMtBayerRG8):
AttributeError: 'module' object has no attribute 'fMtBayerRG8'

Does anyone have any suggestions to solve this?

wlawler45 commented 5 years ago

Can you check to make sure you can successfully import and access attributes in gevapi? It seems like your code cant reference certain things in gevapi. In the first issue you were able to successfully open the camera but failed on the first reference to gevapi when trying to read which is strange. Can you check to make sure the members in gevapi you are importing are not nested in classes that they shouldn't be? Also you might try deleting all the .pyc files in the directory and rerunning

wlawler45 commented 5 years ago

So we actually dont have the camera to test this code with, but I believe that if you go into the gevapi file in src in this repo and change that line to refer to gevapi.fmtBayerRG8 instead of gevapi.fMtBayerRG8 that might fix your problem. Since making this repo the camera manufacturer has updated their API. Their may be additional function and variable names that need to be changed. I would recommend checking variable names that give you issues against those defined in the manufacturer's gevapi.h and continue this thread if you come across other issues.

davidbsp commented 5 years ago

@wlawler45 thank you. I replaced all fmtBayerXXX instances by fMtBayerXXX in the gevapi.py file, and was able to overcome the issue. I don't have the camera here with me at the moment to test the ros node, but I will try it later and let you know :)

davidbsp commented 5 years ago

So I've tested the code and everything looks fine. I've created a pull request to update the package compatibility with the new version of the library, and also created a rospy node to publish camera images in ROS.