roboception / rc_genicam_api

Roboception convenience layer around GenICam and GigE Vision.
Other
111 stars 45 forks source link

Unable to stream images from a Basler camera #21

Closed smitesh-sutaria closed 3 years ago

smitesh-sutaria commented 4 years ago

Hello, Using gc_info able to query the camera details. But when gc_stream is used, images are not getting saved.

Output of gc_stream

$ ./gc_stream 22034422

Package size: 1500
Received buffers:   5
Incomplete buffers: 0
Buffers per second: 1.89

Further debugging this shows, getBufferBool() is returning false in file rc_genicam_api/buffer.cc

So added the below code for debug:

diff --git a/rc_genicam_api/buffer.cc b/rc_genicam_api/buffer.cc index 7a2afea..eacb634 100644 --- a/rc_genicam_api/buffer.cc +++ b/rc_genicam_api/buffer.cc @@ -71,7 +71,8 @@ inline bool getBufferBool(const std::shared_ptr &gentl,

if (stream != 0 && buffer != 0) {

Output with snippet added for debug

$ ./gc_stream 22034422

Package size: 1500

0
-1014
0
-1014
0
-1014 
0
-1014
0
-1014

Received buffers:   5
Incomplete buffers: 0
Buffers per second: 1.89

**Please note that, -1014 is GC_ERR_NOT_AVAILABLE.

Output of gc_info

$ ./gc_info -l
Transport Layer ProducerGEV.cti
Vendor:         Basler
Model:          GEV GenTL Producer
Vendor version: 1.0.0.0
TL type:        GEV
Name:           ProducerGEV-1.3.2.cti
Pathname:       /opt/pylon5/lib64/gentlproducer/gtl/ProducerGEV-1.3.2.cti
Display name:   Basler GEV GenTL Producer
GenTL version   1.5

    Interface     Basler GEV GenTL Interface Module
    Display name: GigE Vision
    TL type:      GEV

        Device             Basler acA1300-30gc (22034422)
        Vendor:            Basler
        Model:             acA1300-30gc
        TL type:           GEV
        Display name:      acA1300-30gc (22034422)
        User defined name:
        Access status:     Unknown
        Serial number:     22034422
        Version:           104846-20
        TS Frequency:      0
heikohimu commented 4 years ago

The output of gc_stream shows that it successfully received buffers. gc_stream should either store images and show this on standard output, or produce an error message, e.g. if the image format is unknown. The only reason for not seeing either of it is that there is no image data contained in the buffer. I think that you should check if your camera is properly configured.

smitesh-sutaria commented 4 years ago

@heikohimu Thank you for the inputs.

When we change the settings for "ChunkModeActive" to 'False', get the below error :

$ ./gc_stream 22034422 ChunkModeActive=0
Package size: 1500

Exception: Invalid layout of buffer attached to chunk parser! : RuntimeException thrown (file 'ChunkAdapterGEV.cpp', line 97)

Does gc_stream work only when ChunkModeActive is 'True' ? If so, what should be the config value for "ChunkSelector"

heikohimu commented 4 years ago

Is there a reason for disabling chunks if they are available?

gc_stream checks if chunks a available and enables them if possible. This happens in this line https://github.com/roboception/rc_genicam_api/blob/master/tools/gc_stream.cc#L401 The user parameters are applied afterwards, so gc_stream expects chunks, but buffers do not contain any. I should change the code to check if the user explicitly disables chunks.

For the moment, you could just initialize chunkadapter with 0 in the code.

smitesh-sutaria commented 4 years ago

That worked. Thank you for the inputs.

Here is the diff for the reference :

diff --git a/tools/gc_stream.cc b/tools/gc_stream.cc
index e26191f..7a67560 100644
--- a/tools/gc_stream.cc
+++ b/tools/gc_stream.cc
@@ -398,8 +398,9 @@ int main(int argc, char *argv[])
         // get chunk adapter (this switches chunk mode on if possible and
         // returns a null pointer if this is not possible)

-        std::shared_ptr<GenApi::CChunkAdapter> chunkadapter=rcg::getChunkAdapter(nodemap, dev->getTLType());
+        //std::shared_ptr<GenApi::CChunkAdapter> chunkadapter=rcg::getChunkAdapter(nodemap, dev->getTLType());

+        std::shared_ptr<GenApi::CChunkAdapter> chunkadapter=0;
         // set values as given on the command line

         int n=1;
heikohimu commented 3 years ago

The problem with Basler cameras is fixed in rc_genicam_api release 2.5.0.

nocanstillbb commented 1 month ago

Access status: Unknown Even if I use basler's TL

heikohimu commented 1 month ago

We are working all the time with Basler cameras, with the producer from Basler and others. Can you be a bit more specific what the problem is? What camera model are you using? Which operating system? Which tool (with what parameters) or code are you using? What is the error message?

nocanstillbb commented 1 month ago

We are working all the time with Basler cameras, with the producer from Basler and others. Can you be a bit more specific what the problem is? What camera model are you using? Which operating system? Which tool (with what parameters) or code are you using? What is the error message?

Thanks for the quick response, I'm using: OS : raspbian aarch64 which is based on debian 12 bookworm rc_genicam_api branch : 4af5d76364

当我使用 ./gc_info -l

dv@rsap5:/opt/dv_app/lib $ ./gc_info  -l
Transport Layer ProducerGEV.cti
Vendor:         Basler
Model:          GEV
Vendor version: 1.0.0.0
TL type:        GEV
Name:           ProducerGEV.cti
Pathname:       /opt/pylon/lib/gentlproducer/gtl/ProducerGEV.cti
Display name:   Basler GEV GenTL Producer
GenTL version   1.5

    Interface     Basler GEV GenTL Interface Module
    Display name: GigE Vision
    TL type:      GEV

        Device             Basler acA640-120gm (23837243)
        Vendor:            Basler
        Model:             acA640-120gm
        TL type:           GEV
        Display name:      cam1
        User defined name: cam1
        Access status:     Unknown
        Serial number:     23837243
        Version:           106609-24
        TS Frequency:      0

Transport Layer ProducerU3V.cti
Vendor:         Basler
Model:          U3V
Vendor version: 1.0.0.0
TL type:        U3V
Name:           ProducerU3V.cti
Pathname:       /opt/pylon/lib/gentlproducer/gtl/ProducerU3V.cti
Display name:   Basler U3V GenTL Producer
GenTL version   1.5

    Interface     Basler U3V GenTL Interface Module
    Display name: USB3 Vision
    TL type:      U3V

The code for enumerating devices in the program refers to gc_info -l, so I also get the same Access status, which is Unknown. In addition, I also use device->getAccessStatus() to get the status, sometimes He can get OpenReadWrite, but in most cases he gets Unknown

but if i ignore access status, it can still open, grab ,close,

heikohimu commented 1 month ago

I can confirm that I also get the access status unknown when I use the pylon producer with some Basler cameras. However, the producer that comes with the rc_genicam_api correctly reports ReadWrite access status for the same cameras.

The rc_genicam_api just calls a function of the producer and translates the return value to a string. I guess you need to ask Basler why their producer reports an unknown access status for their camera.