Giter Club home page Giter Club logo

Comments (9)

TIS-Stefan avatar TIS-Stefan commented on August 16, 2024

Hello

Can you please let me know the tcambin version? Run tcam-ctrl -l
Also can you please post a minimal reproducible sample script? Even if I have an idea about what you are doing?

Thank you in advance!
Stefan

from tiscamera.

teawizardry avatar teawizardry commented on August 16, 2024

Sure!

tcambin version:

Versions: 
        Tcam:   1.1.1_master/ee45fcf7_rev_4142
        Aravis: 0.8_version_e977fa4
        Modules:        gst_aravis_arvu3v_v4l2_libusb_tools_doc_tests

I am not using aravis.

Camera initialization:

# initialize callback function and TIS
IC = ImageCallback(False, None)
Tis = TIS()

# Set callback function and open device.
Tis.set_image_callback(on_new_image, self.IC)

# select camera 
Tis.open_device(serial_number, height, width, framerate, SinkFormats.GRAY8, binning=binning, showvideo=False)

# Start Pipeline
Tis.set_property("TriggerMode", "Off")
IC.busy = True
Tis.start_pipeline()

# Set Properties
Tis.set_property("TriggerMode", "On")
# and set whatever other properties here

time.sleep(0.1) 
IC.busy = False

I slightly modified the Gst caps function to enable binning:

caps = Gst.Caps.from_string('video/x-raw,format=%s,width=%d,height=%d,binning=2x2,framerate=%s' % (self.sinkformat.value, self.width, self.height, self.framerate))

When I take an picture right now I'm simply using software triggers:

Tis.execute_command("TriggerSoftware")

And then for starting and stopping the camera I go from Ready => Paused => Playing then Playing => Paused => Ready.

def start_pipeline(self):
    """
    Start the pipeline, so the video runs
    """
    self._setcaps()
    if self.pipeline.get_state(5000000000)[1] != Gst.State.READY:
        self.pipeline.set_state(Gst.State.READY)
    self.pipeline.set_state(Gst.State.PAUSED)
    self.pipeline.set_state(Gst.State.PLAYING)
    error = self.pipeline.get_state(5000000000)
    if error[1] != Gst.State.PLAYING:
        print("Error starting pipeline. {0}".format(error))
        return False
    return True
    
def stop_pipeline(self):
    self.pipeline.set_state(Gst.State.PAUSED)
    self.pipeline.set_state(Gst.State.READY)

So in total my main loop is like:

# start camera
cam = Camera(serial_number = "12345",
             height = 1216,
             width = 1024,
             framerate = "60/1",
             binning = True)

# take pictures
foo()

# on exit
Tis.stop_pipeline()

The hang up happens both when stopping and starting the camera in the main code or when running the program multiple times. Right now I have eliminated starting and stopping the camera in the same program to try to isolate the error.

from tiscamera.

TIS-Kevin avatar TIS-Kevin commented on August 16, 2024

Hello teawizardry,

i tried to reproduce your issue but it is working on my machine.
But for some code optimization you can skip the step of state paused. Because if you set from playing to ready it will walk also through paused.

As you mentioned before "I'm trying to catch the behavior in a log file, but I think I didn't have the debug level set high enough. I'll update with that when I get it."

for logging you should use GST_DEBUG=:3,tcam:5
If you could let us know what the logging says we appreciate it.

Thank you in advance!
Kevin

from tiscamera.

TIS-Kevin avatar TIS-Kevin commented on August 16, 2024

Additionally i like to add something to my last message.
Because i saw you are working on PI with a usb camera. Is the camera connected directly to the Pi or is it connected to a powered usb hub?
In case of the direct connection there may be some issues with the power supply for the camera. That could cause the problem you occure.

from tiscamera.

teawizardry avatar teawizardry commented on August 16, 2024

It is connected directly to the Pi. Is there a way to see if power supply issues are the problem? And if so, how much power does it need?

from tiscamera.

TIS-Kevin avatar TIS-Kevin commented on August 16, 2024

Hello teawizardry,
well there can be issues caused by the power supply to the Pi but typically are power saving mechanisms.
You may check this Website which provides already many informations about power supply problems with a Pi:
https://pimylifeup.com/raspberry-pi-low-voltage-warning/

However, as i can see you are using tiscamera 1.1 and the udev rules should disable the power saving mechanisms for our cameras.

To be on the sure site i suggest to connect the camera to a powered usb hub and check if the camera works fine then.

How is it about your logging results?
Is there any output you may provide to us?

Best Regards
Kevin

from tiscamera.

TIS-Stefan avatar TIS-Stefan commented on August 16, 2024

Hello

And then for starting and stopping the camera I go from Ready => Paused => Playing then Playing => Paused => Ready.

Going into pause state explicitly is not necessary in this situation, therefore, you may remove that from your code.

If the camera is in trigger mode, it can happen, that starting the pipeline fails, because all modules may need a frame to prepare themself. Thus a state change to playing is never achieved. I suggest to disable trigger mode, start the stream and if the stream is in state playing, enable the trigger mode. Same goes for stopping the stream. Disable the trigger mode, then stop the stream. I see, you did that for starting the stream already.

I do not think, it is a power issue. If so, you saw a four color icon in the upper right corner on the screen.

Stefan

from tiscamera.

teawizardry avatar teawizardry commented on August 16, 2024

I will try that and see if it fixes the issue. I'm unsure why but the gst log is not actually logging anything.

from tiscamera.

TIS-Stefan avatar TIS-Stefan commented on August 16, 2024

Did you run
export GST_DEBUG=:3,tcam:5
before starting your script? In the same terminal?
Stefan

from tiscamera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.