Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: <Please write a comprehensive title after the 'BUG: ' prefix> #254

Open
roboticshard opened this issue Nov 8, 2024 · 0 comments
Open

Comments

@roboticshard
Copy link

roboticshard commented Nov 8, 2024

Issue description

ROS2 Frame rate is not same with Pylon Viewer for USB Basler Camera. As a default I can get max frame rate within Pylon Viewer. When I use ROS2 , I could not grab max frame rate. Which parameter should I arrange for achieve max frame rate?

Code example about how to reproduce the issue

Camera parameters

/**:
ros__parameters:

#  The tf frame under which the images were published
camera_frame: pylon_camera

#  The DeviceUserID of the camera. If empty, the first camera found in the
#  device list will be used
device_user_id: ""

#  The CameraInfo URL (Uniform Resource Locator) where the optional intrinsic
#  camera calibration parameters are stored. This URL string will be parsed
#  from the ROS-CameraInfoManager:
camera_info_url: ""

#  The encoding of the pixels -- channel meaning, ordering, size
#  taken from the list of strings in include/sensor_msgs/image_encodings.h
#  The supported encodings are 'mono8', 'bgr8', 'rgb8', 'bayer_bggr8',
#  'bayer_gbrg8' and 'bayer_rggb8'
#  Default values are 'mono8' and 'rgb8'
image_encoding: "bayer_rggb8"

#  Binning factor to get downsampled images. It refers here to any camera
#  setting which combines rectangular neighborhoods of pixels into larger
#  "super-pixels." It reduces the resolution of the output image to
#  (width / binning_x) x (height / binning_y).
#  The default values binning_x = binning_y = 0 are considered the same
#  as binning_x = binning_y = 1 (no subsampling).
# binning_x: 1
# binning_y: 1

#  The desired publisher frame rate if listening to the topics.
#  This parameter can only be set once at startup
#  Calling the GrabImages-Action can result in a higher framerate
frame_rate: 20.0
trigger_timeout: 10  # in ms
grab_timeout: 200  # in ms
grab_strategy : 2
#white_balance_auto : 2

#  Mode of camera's shutter.
#  The supported modes are "rolling", "global" and "global_reset"
#  Default value is "" (empty) means default_shutter_mode
shutter_mode: "global"

##########################################################################
######################## Image Intensity Settings ########################
##########################################################################
# The following settings do *NOT* have to be set. Each camera has default
# values which provide an automatic image adjustment resulting in valid
# images
##########################################################################

#  The exposure time in microseconds to be set after opening the camera.
exposure: 100000.0

#  The target gain in percent of the maximal value the camera supports
#  For USB cameras, the gain is in dB, for GigE cameras it is given in so
#  called 'device specific units'.
# gain: 0.0

#  Gamma correction of pixel intensity.
#  Adjusts the brightness of the pixel values output by the camera's sensor
#  to account for a non-linearity in the human perception of brightness or
#  of the display system (such as CRT).
# gamma: 0.0

#  The average intensity value of the images. It depends the exposure time
#  as well as the gain setting. If 'exposure' is provided, the interface will
#  try to reach the desired brightness by only varying the gain. (What may
#  often fail, because the range of possible exposure vaules is many
#  times higher than the gain range). If 'gain' is provided, the interface will
#  try to reach the desired brightness by only varying the exposure time. If
#  gain AND exposure are given, it is not possible to reach the brightness,
#  because both are assumed to be fix.
brightness: 100

#  Only relevant, if 'brightness' is set:
#  The brightness_continuous flag controls the auto brightness function.
#  If it is set to false, the brightness will only be reached once.
#  Hence changing light conditions lead to changing brightness values.
#  If it is set to true, the given brightness will be reached continuously,
#  trying to adapt to changing light conditions. This is only possible for
#  values in the possible auto range of the pylon API which is e.g., [50 - 205]
#  for acA2500-14um and acA1920-40gm
brightness_continuous: false

#  Only relevant, if 'brightness' is set:
#  If the camera should try to reach and / or keep the brightness, hence
#  adapting to changing light conditions, at least one of the following flags
#  must be set.
#  If both are set, the interface will use the profile that tries to keep the
#  gain at minimum to reduce white noise.
#  The exposure_auto flag indicates, that the desired brightness will be
#  reached by adapting the exposure time.
#  The gain_auto flag indicates, that the desired brightness will be
#  reached by adapting the gain.
exposure_auto: true
gain_auto: false

##########################################################################

#  The timeout while searching the exposure which is connected to the
#  desired brightness. For slow system this has to be increased.
# exposure_search_timeout: 5.0

#  The exposure search can be limited with an upper bound. This is to prevent
#  very high exposure times and resulting timeouts.
#  A typical value for this upper bound is ~2000000us.
#  Beware that this upper limit is only set if `startup_user_set` is set to `Default`.
# auto_exposure_upper_limit: 2000000.0

#  The MTU size. Only used for GigE cameras.
#  To prevent lost frames configure the camera has to be configured
#  with the MTU size the network card supports. A value greater 3000
#  should be good (1500 for single-board computer)
# gige:
#  mtu_size: 3000

#  Only used for GigE cameras.
#  The inter-package delay in ticks to prevent lost frames.
#  For most of GigE cameras, a value of 1000 is reasonable.
#  For cameras used on a single-board computer this value should be set to 11772.
# gige:
#  inter_pkg_delay: 1000

#  Only used for GigE cameras.
#  The frame transmission delay in ticks.
#  In most cases, this parameter should be set to 0.
#  However, if your network hardware can't handle spikes in network traffic
#  (e.g., if you are triggering multiple camera simultaneously),
#  you can use the frame transmission delay parameter to stagger the
#  start of image data transmissions from each camera.
# gige:
#  frame_transmission_delay: 0

Error message

[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [pylon_ros2_camera_wrapper-1]: process started with pid [198702]
[pylon_ros2_camera_wrapper-1] 1731062155.644910113 [basler.pylon.ros2.pylon_ros2_camera_parameter] [INFO] Autoflash: 0, line2: 1, line3: 1
[pylon_ros2_camera_wrapper-1] 1731062155.644997841 [basler.pylon.ros2.pylon_ros2_camera_parameter] [INFO] No Device User ID set -> Will connect the first available camera device
[pylon_ros2_camera_wrapper-1] 1731062157.425938633 [basler.pylon.ros2.pylon_ros2_camera] [INFO] Found camera device! Device Model: a2A5320-23ucBAS with Device User Id: 
[pylon_ros2_camera_wrapper-1] 1731062157.856110144 [basler.pylon.ros2.pylon_ros2_camera_node] [INFO] No user id for the camera has been set
[pylon_ros2_camera_wrapper-1] 1731062157.928216417 [basler.pylon.ros2.pylon_ros2_usb_camera] [INFO] Startup user profile set to ""
[pylon_ros2_camera_wrapper-1] 1731062157.928246749 [basler.pylon.ros2.pylon_ros2_usb_camera] [WARN] Unsupported startup user profile "", ignoring
[pylon_ros2_camera_wrapper-1] 1731062157.928266376 [basler.pylon.ros2.pylon_ros2_usb_camera] [INFO] CurrentSetting loaded
[pylon_ros2_camera_wrapper-1] 1731062158.153981251 [basler.pylon.ros2.pylon_ros2_camera_node] [WARN] [] name not valid for camera_info_manager
[pylon_ros2_camera_wrapper-1] 1731062158.154101603 [basler.pylon.ros2.pylon_ros2_camera_node] [INFO] CameraInfoURL needed for rectification! ROS2-Param: '/my_camera/camera_info_url' = '' is invalid!
[pylon_ros2_camera_wrapper-1] 1731062158.154107108 [basler.pylon.ros2.pylon_ros2_camera_node] [DEBUG] CameraInfoURL should have following style: 'file:///full/path/to/local/file.yaml' or 'package://<package_name>/relative/path/to/file.yaml'
[pylon_ros2_camera_wrapper-1] 1731062158.154109985 [basler.pylon.ros2.pylon_ros2_camera_node] [WARN] Will only provide distorted /image_raw images!
[pylon_ros2_camera_wrapper-1] 1731062158.154114672 [basler.pylon.ros2.pylon_ros2_camera_base] [WARN] Camera does not support binning (X). Will keep the current settings.
[pylon_ros2_camera_wrapper-1] 1731062158.154175101 [basler.pylon.ros2.pylon_ros2_camera_node] [INFO] Setting horizontal binning_x to 1
[pylon_ros2_camera_wrapper-1] 1731062158.154193942 [basler.pylon.ros2.pylon_ros2_camera_base] [WARN] Camera does not support binning (Y). Will keep the current settings.
[pylon_ros2_camera_wrapper-1] 1731062158.154240629 [basler.pylon.ros2.pylon_ros2_camera_node] [INFO] Setting vertical binning_y to 1
[pylon_ros2_camera_wrapper-1] 1731062158.156663562 [basler.pylon.ros2.pylon_ros2_camera_node] [INFO] Attempted to set exposure to 100000, reached: 100000
[pylon_ros2_camera_wrapper-1] 1731062158.307642849 [basler.pylon.ros2.pylon_ros2_camera_node] [DEBUG] New brightness request for target brightness 100, current brightness = 2.92796
[pylon_ros2_camera_wrapper-1] 1731062163.519944926 [basler.pylon.ros2.pylon_ros2_camera_node] [WARN] Did not reach the target brightness before timeout of 5 sec! Stuck at brightness 2.96527 and exposure 100000µs
[pylon_ros2_camera_wrapper-1] 1731062163.520025358 [basler.pylon.ros2.pylon_ros2_camera_node] [INFO] Attempted to set brightness to: 100, reached: 2
[pylon_ros2_camera_wrapper-1] 1731062163.522799996 [basler.pylon.ros2.pylon_ros2_camera_node] [INFO] Startup settings: encoding = 'bayer_rggb8', binning = [1, 1], exposure = 100000, gain = 0.5, gamma = 1, shutter mode = global
[pylon_ros2_camera_wrapper-1] 1731062163.523509303 [basler.pylon.ros2.pylon_ros2_camera_node] [INFO] Desired framerate 20.00 is higher than max possible. Will limit framerate to: 9.98 Hz
[pylon_ros2_camera_wrapper-1] 1731062163.523875765 [basler.pylon.ros2.pylon_ros2_camera_node] [INFO] Start image grabbing if node connects to topic with a spinning rate of: 9.98213 Hz
[pylon_ros2_camera_wrapper-1] 1731062163.624401800 [basler.pylon.ros2.pylon_ros2_camera_node] [INFO] Camera not calibrated

Hardware setup description

CPU x86
Linux
ROS2

Runtime information

Unfourtanely, I didnt get max frame rate by using ROS2.

Is your camera operational with the Basler pylon Viewer on your platform?

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant