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

Use ipm distortion instead of image rectification #361

Merged
merged 24 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,9 @@ RUN apt-get install -y \
ros-iron-camera-calibration \
ros-iron-desktop \
ros-iron-joint-state-publisher-gui \
# ros-iron-plotjuggler-ros containing plotjuggler ros plugins
# build currently fails and is not available as a package so we
# have to manually install plotjuggler and plotjuggler-msgs
# https://github.com/PlotJuggler/plotjuggler-ros-plugins/issues/59
ros-iron-plotjuggler \
ros-iron-plotjuggler-msgs \
ros-iron-plotjuggler-ros \
ros-iron-rmw-cyclonedds-cpp \
ros-iron-rqt-robot-monitor \
ros-iron-soccer-vision-3d-rviz-markers
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ jobs:
. /opt/ros/iron/setup.sh
. install/setup.sh
# Run tests for all packages
colcon test --packages-skip-regex pylon --event-handlers console_direct+ --return-code-on-test-failure --parallel-workers 1
colcon test --event-handlers console_direct+ --return-code-on-test-failure --parallel-workers 1
working-directory: /colcon_ws
3 changes: 2 additions & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"/root/colcon_ws/build/**/rosidl_generator_cpp/**",
"${workspaceFolder}/**/include/**",
"/opt/ros/${env:ROS_DISTRO}/include/**",
"/usr/include/**"
"/usr/include/**",
"/opt/pylon/include/**"
],
"name": "ROS",
"intelliSenseMode": "gcc-x64",
Expand Down
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@
"typeindex": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp"
"variant": "cpp",
"regex": "cpp",
"future": "cpp"
},
// Tell the ROS extension where to find the setup.bash
// This also utilizes the COLCON_WS environment variable, which needs to be set
Expand Down
41 changes: 40 additions & 1 deletion bitbots_misc/bitbots_basler_camera/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,50 @@
cmake_minimum_required(VERSION 3.5)
project(bitbots_basler_camera)

find_package(bitbots_docs REQUIRED)
# Add support for C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()

find_package(ament_cmake REQUIRED)
find_package(backward_ros REQUIRED)
find_package(bitbots_docs REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(image_transport REQUIRED)
find_package(OpenCV REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(pylon 7.1.0 REQUIRED)
find_package(camera_info_manager REQUIRED)
find_package(generate_parameter_library REQUIRED)

add_compile_options(-Wall -Werror -Wno-unused)

generate_parameter_library(
pylon_camera_parameters # cmake target name for the parameter library
config/camera_settings.yaml)

add_executable(basler_camera src/basler_camera.cpp)

target_link_libraries(basler_camera ${OpenCV_LIBRARIES} pylon::pylon
pylon_camera_parameters)

ament_target_dependencies(
basler_camera
ament_cmake
bitbots_docs
cv_bridge
image_transport
rclcpp
sensor_msgs
camera_info_manager
generate_parameter_library
OpenCV)

enable_bitbots_docs()

install(TARGETS basler_camera DESTINATION lib/${PROJECT_NAME})

install(DIRECTORY config DESTINATION share/${PROJECT_NAME})

install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
Expand Down
3 changes: 0 additions & 3 deletions bitbots_misc/bitbots_basler_camera/config/binning.yaml

This file was deleted.

181 changes: 69 additions & 112 deletions bitbots_misc/bitbots_basler_camera/config/camera_settings.yaml
Original file line number Diff line number Diff line change
@@ -1,112 +1,69 @@
pylon_camera_node:
ros__parameters:
# The tf frame under which the images were published
camera_frame: camera_optical_frame

# 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: 4
# binning_y: 4

# 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: 10.0

# 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: 3000.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.55

# 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: 1.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: true

# 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: true

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

# 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.
# 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 RaspberryPI)
# gige:
gige/mtu_size: 8000

# 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 RaspberryPI this value should be set to 11772.
# gige:
gige/inter_pkg_delay: 4000

rectification_active: false
pylon_camera_parameters:
exposure:
type: double
default_value: 3000.0
description: "The exposure time in microseconds to be set after opening the camera."
validation:
bounds<>: [0.0, 1000000.0]
gain:
type: int
default_value: 200
description: "The target raw gain of the camera sensor (similar to ISO)."
validation:
bounds<>: [0, 360]
fps:
type: double
default_value: 10.0
read_only: true
description: "Target frame rate of the camera / publisher."
validation:
bounds<>: [0.0, 30.0]
binning_factor_x:
type: int
default_value: 4
read_only: true
description: "Binning factor to get downsampled images in x direction."
validation:
gt_eq<>: [1]
binning_factor_y:
type: int
default_value: 4
read_only: true
description: "Binning factor to get downsampled images in y direction."
validation:
gt_eq<>: [1]
camera_info_url:
type: string
default_value: ""
read_only: true
description: "The URL of the camera calibration file."
validation:
not_empty<>: []
device_user_id:
type: string
default_value: ""
read_only: true
description: "The name of the camera (used to discover the camera). The name can be set in the pylon viewer."
validation:
not_empty<>: []
camera_frame_id:
type: string
default_value: "camera_optical_frame"
read_only: true
description: "The tf frame at which the camera's optical center is located."
validation:
not_empty<>: []
gige:
mtu_size:
type: int
default_value: 9000
description: "The MTU size for GigE cameras."
read_only: true

inter_pkg_delay:
type: int
default_value: 1000
description: "The inter-package delay in 'ticks' for GigE cameras."
read_only: true
validation:
bounds<>: [0, 10000]
Loading
Loading