basler / pylon-ros-camera

The official pylon ROS driver for Basler GigE Vision and USB3 Vision cameras:
http://www.baslerweb.com
Other
147 stars 149 forks source link

Frame rate not adjusting with new ROI #197

Open J-C-Haley opened 10 months ago

J-C-Haley commented 10 months ago

Hello, I'm trying to use the SetROI service to reduce data load, and my expectation was that frame rate would rise to the maximum (as a function of exposure, allowed bandwidth, and set frame rate), as it does in the pylonviewer GUI. However, current behavior is to limit the frame rate on startup (here), based on the startup settings (ROI/exp/framrate), and this overrides the frame_rate ROS parameter, even if the SetROI (here) were to attempt to reset the frame rate the original parameter has been destroyed, so further dynamic changes have no rate increase effect.

So, my question is, shall we either:

I'd prefer the latter, it's a quick fix I can contribute, but I'd like to hear input on if this would break anything.

Thank you!

J-C-Haley commented 10 months ago

Ah, I see this is a bigger problem than I assumed, frame rate gets baked into the main ros::Rate spin on startup, which is not adjustable from within the pylon_camera_node. Either of these fixes would require transferring ownership of the rate into the node, so it can be adjusted...

FrancoisPicardDTI commented 9 months ago

Hello @J-C-Haley I just added a section in the documentation. There are several issues, and several solutions, to increase the frame rate. If the camera image acquistion is triggered by sofware trigger (default setting), then it is not possible to get the maximum frame rate, because the image acquisition is sequentially triggered, which is not overlapping then. Several possible solutions are mentionned and tested in issue #21, #28, #29, #81, #116, #147, and #200. Please refer to them for more information and hopefully find a solution for your use case.

amohiud2 commented 4 months ago

few things that helped me with getting better frame rate were:

  1. In one computer there was a USB port issue. Everything gets half the speed.
  2. Disable the parameter publishing in the launch file.
  3. Disable software trigger (that doubles the frame rate)
  4. In my case I needed less exposure time, so when I used minimum exposure time, I was able to get better frame rate. It actually does check how much you can get based on your frame rate settings in the config file. If it cannot it will say that we can only get a particular frame rate.
  5. There is also a parameter "fast mode" or "slow mode", it works with pylon viewer and gets me speeds up to 750 fps, vs 554 fps. However when I use the service call to set this set_sensor_mode param to 1, it does not work. It says node is not writable etc.