├── README.md ├── extrinsic_calibrator ├── CMakeLists.txt └── package.xml ├── extrinsic_calibrator_core ├── CMakeLists.txt ├── README.md ├── config │ ├── aruco_parameters.yaml │ └── camera_topics_parameters.yaml ├── extrinsic_calibrator_core │ ├── __init__.py │ └── src │ │ ├── aruco_generator_class.py │ │ └── extrinsic_calibrator_class.py ├── launch │ └── __init__.py ├── license.md ├── package.xml └── scripts │ ├── __init__.py │ ├── extrinsic_calibrator_node.py │ └── generator_aruco_node.py ├── extrinsic_calibrator_examples ├── CMakeLists.txt ├── README.md ├── config │ ├── d435.yaml │ ├── d435_intrinsics.yaml │ ├── l515.yaml │ └── l515_intrinsics.yaml ├── extrinsic_calibrator_examples │ └── __init__.py ├── launch │ ├── launch_extrinsic_calibrator.launch.py │ ├── launch_rviz.launch.py │ └── launch_usb_cameras.launch.py ├── license.md ├── package.xml ├── rviz │ └── extrinsic.rviz └── scripts │ └── __init__.py └── license.md /README.md: -------------------------------------------------------------------------------- 1 | # extrinsic_calibrator 2 | 3 |
4 | setup_paint 5 |
6 | 7 | 8 | 9 | `extrinsic_calibrator` is a ROS2 package designed to extrinsically calibrate a set of cameras distributed throughout a room. The calibration is performed using ArUco markers "randomly" scattered through the environment. Each camera detects one or several ArUco markers within its field of view and the algorithm reconstructs the positions of the markers to create a global map. The positions of the cameras are then computed and incorporated into this aforementioned map. 10 | 11 | This package is composed of two submodules: 12 | 1. [extrinsic_calibrator_core](./extrinsic_calibrator_core) with the extrinsic calibrator itself and an ArUco generator to simplify the usage. 13 | 2. [extrinsic_calibrator_examples](./extrinsic_calibrator_examples) with some useful launch files to easily set up your cameras as well as a rviz visualizer node. 14 | 15 | ## Installation 16 | 17 | 18 | To clone and install the package, navigate into your workspace and run the following commands: 19 | ```sh 20 | # clone the repository 21 | cd ./src 22 | git clone https://github.com/Ikerlan-KER/extrinsic_calibrator.git --branch humble 23 | cd .. 24 | # update libraries 25 | sudo apt-get update 26 | # install ros dependencies 27 | rosdep update 28 | rosdep install --from-paths src --ignore-src -r -y 29 | # build de workspace 30 | colcon build 31 | ``` 32 | 33 | 34 | ## Author Information 35 | 36 | **Authors:** 37 | - [Josep Rueda Collell](mailto:rueda_999@hotmail.com) 38 | - [Ander Gonzalez](mailto:ander.gonzalez@ikelan.es) 39 | 40 | **Created:** October 2024 41 | 42 | **Affiliation:** [IKERLAN](https://www.ikerlan.es) 43 | 44 | setup_paint 45 | 46 | ### Citation 47 | If you use this code, please cite: 48 | **Josep Rueda Collell**. "ROS2 Extrinsic Camera Calibrator using ArUco Markers". (2024). 49 | 50 | --- 51 | 52 | Developed as part of **AI-PRISM** project. 53 | 54 | 55 | 56 | 57 | 58 | *AI Powered human-centred Robot Interactions for Smart Manufacturing* 59 | 60 | 61 | 62 | 63 | 64 | Horizon Europe – Grant Agreement number [101058589](https://cordis.europa.eu/project/id/101058589) 65 | 66 | *Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union. The European Union cannot be held responsible for them. Neither the European Union nor the granting authority can be held responsible for them.* 67 | 68 | ## License 69 | 70 | This software is provided under a dual license system. You may choose between: 71 | 72 | - **GNU Affero General Public License v3**: For open-source development, subject to the conditions of this license. 73 | - **Commercial License**: For proprietary use. For more details on the commercial license, please contact us at [info@ikerlan.es](mailto:info@ikerlan.es). 74 | 75 | Please see the [LICENSE](./license.md) file for the complete terms and conditions of each license option. -------------------------------------------------------------------------------- /extrinsic_calibrator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(extrinsic_calibrator) 3 | 4 | find_package(ament_cmake REQUIRED) 5 | ament_package() -------------------------------------------------------------------------------- /extrinsic_calibrator/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | extrinsic_calibrator 5 | 0.1.0 6 | ROS2 package designed to extrinsically calibrate a set of cameras distributed throughout a room. 7 | Josep Rueda Collell 8 | AGPL-3.0-only 9 | 10 | ament_cmake 11 | ament_cmake_python 12 | 13 | extrinsic_calibrator_core 14 | extrinsic_calibrator_examples 15 | 16 | rosidl_default_generators 17 | 18 | rosidl_default_runtime 19 | 20 | rosidl_interface_packages 21 | 22 | ament_lint_auto 23 | ament_lint_common 24 | 25 | 26 | ament_cmake 27 | 28 | 29 | -------------------------------------------------------------------------------- /extrinsic_calibrator_core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(extrinsic_calibrator_core) 3 | 4 | if(NOT CMAKE_CXX_STANDARD) 5 | set(CMAKE_CXX_STANDARD 14) 6 | endif() 7 | 8 | # DEPENDENCIES 9 | 10 | # Find packages 11 | find_package(ament_cmake REQUIRED) 12 | find_package(ament_cmake_python REQUIRED) 13 | find_package(rclcpp REQUIRED) 14 | find_package(rclpy REQUIRED) 15 | find_package(cv_bridge REQUIRED) 16 | find_package(sensor_msgs REQUIRED) 17 | find_package(std_msgs REQUIRED) 18 | find_package(tf2_ros REQUIRED) 19 | 20 | find_package(ament_cmake_auto REQUIRED) 21 | ament_auto_find_build_dependencies() 22 | 23 | # find_package(generate_parameter_library REQUIRED) 24 | # generate_parameter_library( 25 | # cpp_camera_topics_parameters # cmake target name for the parameter library 26 | # config/camera_topics_parameters.yaml # path to input yaml file 27 | # ) 28 | 29 | generate_parameter_module( python_aruco_parameters # cmake target name for the parameter library 30 | config/aruco_parameters.yaml # path to input yaml file 31 | ) 32 | 33 | generate_parameter_module( python_camera_topics_parameters # cmake target name for the parameter library 34 | config/camera_topics_parameters.yaml # path to input yaml file 35 | ) 36 | 37 | # PYTHON 38 | # Install Python modules 39 | ament_python_install_package(${PROJECT_NAME}) 40 | # Install Python executables 41 | install(PROGRAMS 42 | scripts/extrinsic_calibrator_node.py 43 | scripts/generator_aruco_node.py 44 | DESTINATION lib/${PROJECT_NAME} 45 | ) 46 | 47 | 48 | # COPY A PARTICULAR FOLDER TO THE INSTALL DIRECTORY 49 | # Install config dependencies 50 | install( 51 | DIRECTORY 52 | config 53 | DESTINATION 54 | share/${PROJECT_NAME} 55 | ) 56 | 57 | 58 | # LAUNCH 59 | # Install launchfile 60 | ament_auto_package(INSTALL_TO_SHARE launch) -------------------------------------------------------------------------------- /extrinsic_calibrator_core/README.md: -------------------------------------------------------------------------------- 1 | # extrinsic_calibrator_core 2 | 3 | ## Overview 4 | 5 | `extrinsic_calibrator_core` is a ROS2 package designed to calibrate a set of cameras distributed throughout a room. The calibration is performed using ArUco markers scattered randomly in the environment. Each camera detects one or several ArUco markers within its field of view, and the algorithm reconstructs the positions of the markers to create a global map. The positions of the cameras are then computed and incorporated into this aforementioned map map. 6 | 7 | The algorithm utilizes the OpenCV library to detect the markers and performs matrix transformations to compute the positions of both markers and cameras relative to each other. 8 | 9 | ## Features 10 | 11 | - Extrinsically calibrate any number of cameras simultaneously. 12 | - Automatically build a global ArUco map using marker detection from multiple viewpoints. 13 | - Configurable ArUco marker properties and camera topics. 14 | - Includes an utility for generating printable ArUco markers. 15 | 16 | ## Configuration 17 | 18 | The package provides configuration options through YAML files. 19 | 20 | ### ArUco Marker Parameters 21 | 22 | You can customize the ArUco markers used in the calibration process by modifying the `aruco_parameters.yaml` file. 23 | 24 | ```yaml 25 | aruco_params: 26 | aruco_dict: # OpenCV marker dictionary 27 | type: string 28 | default_value: "DICT_6X6_250" 29 | marker_length: # Length of the marker side in meters 30 | type: double 31 | default_value: 0.26 32 | ``` 33 | 34 | ### Camera Topics Parameters 35 | 36 | You can specify the topics for each camera in the `camera_topics_parameters.yaml` file. This setup is scalable to handle as many cameras as needed. 37 | ```yaml 38 | cameras_params: 39 | cam1: 40 | image_topic: 41 | type: string 42 | default_value: "/camera_1/image_raw" 43 | camera_info_topic: 44 | type: string 45 | default_value: "/camera_1/camera_info" 46 | cam2: 47 | image_topic: 48 | type: string 49 | default_value: "/camera_2/image_raw" 50 | camera_info_topic: 51 | type: string 52 | default_value: "/camera_2/camera_info" 53 | # cam3: 54 | # image_topic: 55 | # type: string 56 | # default_value: "/camera_3/image_raw" 57 | # camera_info_topic: 58 | # type: string 59 | # default_value: "/camera_3/camera_info" 60 | ``` 61 | 62 | ## Usage 63 | 64 | 1. Place the ArUco marker with ID 0 where any camera can see it. This marker will serve as the reference point. The system will consider this marker's position as the origin (0,0,0) of the global coordinate system, called `map`. 65 | 66 | setup_paint 67 | 68 | 2. Distribute the remaining ArUco markers around the room, ensuring they're visible to different cameras. 69 | 70 | For best results: 71 | 72 | - Try to have each camera see multiple markers. 73 | - Aim for overlap, where multiple cameras can see the same markers. 74 | - The more markers a camera can detect, and the more cameras that can see the same markers, the more accurate your calibration will be. 75 | 76 | Remember, the system first builds a map of marker positions, then determines camera positions based on this map. So, having markers visible to multiple cameras helps create a more accurate and interconnected calibration. 77 | 78 | cameras_paint 80 | 81 | 3. Initiate the calibration process by running the `extrinsic_calibrator_node`. 82 | 83 | calibration_cameras_paint 84 | 85 | 4. Wait for the algorithm to gather the transform of each marker from each camera. The algorithm will iteratively tell the user which marker transforms are finally reliable and which ones are still being verified. 86 | 87 | calibration_debug 88 | 89 | 5. The calibrator will provide tables with useful information, while the calibration is taking place. 90 | 91 | markers_per_cam 92 | 93 | marker_per_marker 94 | 95 | 6. Finally, once the calibration is done, the frame of each marker and camera will be published in tf2. 96 | 97 | tf_map 98 | 99 | 100 | ### Launching the Calibrator 101 | 102 | To run the extrinsic calibrator node, use the following command: 103 | ```sh 104 | ros2 run extrinsic_calibrator_core extrinsic_calibrator_node.py 105 | ``` 106 | 107 | ### ArUco Marker Generator 108 | 109 | This package also provides a utility to generate printable ArUco markers. To generate a set of markers, run: 110 | ``` sh 111 | ros2 run extrinsic_calibrator_core generator_aruco_node.py 112 | ``` 113 | Make sure to manually adjust the size of the printed ArUco markers before printing them. The length of the side of each ArUco marker has to match the marker_length parameter defined in aruco_parameters.yaml. 114 | 115 | ## Dependencies 116 | 117 | The package relies on the following libraries and ROS2 packages: 118 | 119 | - numpy for numerical operations 120 | - OpenCV for ArUco marker detection 121 | - PrettyTable to easily print the calibration status 122 | - tf2_ros for handling transformations 123 | - tf_transformations for matrix transformations 124 | 125 | To install the necessary dependencies, ensure you run: 126 | ```sh 127 | # update libraries 128 | sudo apt-get update 129 | # install ros dependencies 130 | rosdep update 131 | rosdep install --from-paths src --ignore-src -r -y 132 | ``` 133 | 134 | ## Author Information 135 | 136 | **Authors:** 137 | - [Josep Rueda Collell](mailto:rueda_999@hotmail.com) 138 | - [Ander Gonzalez](mailto:ander.gonzalez@ikelan.es) 139 | 140 | **Created:** October 2024 141 | 142 | **Affiliation:** [IKERLAN](https://www.ikerlan.es) 143 | 144 | setup_paint 145 | 146 | ### Citation 147 | If you use this code, please cite: 148 | **Josep Rueda Collell**. "ROS2 Extrinsic Camera Calibrator using ArUco Markers". (2024). 149 | 150 | --- 151 | 152 | Developed as part of **AI-PRISM** project. 153 | 154 | 155 | 156 | 157 | 158 | *AI Powered human-centred Robot Interactions for Smart Manufacturing* 159 | 160 | 161 | 162 | 163 | 164 | Horizon Europe – Grant Agreement number [101058589](https://cordis.europa.eu/project/id/101058589) 165 | 166 | *Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union. The European Union cannot be held responsible for them. Neither the European Union nor the granting authority can be held responsible for them.* 167 | 168 | ## License 169 | 170 | This software is provided under a dual license system. You may choose between: 171 | 172 | - **GNU Affero General Public License v3**: For open-source development, subject to the conditions of this license. 173 | - **Commercial License**: For proprietary use. For more details on the commercial license, please contact us at [info@ikerlan.es](mailto:info@ikerlan.es). 174 | 175 | Please see the [LICENSE](./license.md) file for the complete terms and conditions of each license option. 176 | -------------------------------------------------------------------------------- /extrinsic_calibrator_core/config/aruco_parameters.yaml: -------------------------------------------------------------------------------- 1 | aruco_params: 2 | aruco_dict: 3 | type: string 4 | default_value: "DICT_6X6_250" 5 | marker_length: 6 | type: double 7 | default_value: 0.26 -------------------------------------------------------------------------------- /extrinsic_calibrator_core/config/camera_topics_parameters.yaml: -------------------------------------------------------------------------------- 1 | cameras_params: 2 | cam1: 3 | image_topic: 4 | type: string 5 | default_value: "/camera_1/image_raw" 6 | camera_info_topic: 7 | type: string 8 | default_value: "/camera_1/camera_info" 9 | cam2: 10 | image_topic: 11 | type: string 12 | default_value: "/camera_2/image_raw" 13 | camera_info_topic: 14 | type: string 15 | default_value: "/camera_2/camera_info" 16 | # cam3: 17 | # image_topic: 18 | # type: string 19 | # default_value: "/camera_3/image_raw" 20 | # camera_info_topic: 21 | # type: string 22 | # default_value: "/camera_3/camera_info" 23 | 24 | -------------------------------------------------------------------------------- /extrinsic_calibrator_core/extrinsic_calibrator_core/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ikerlan-KER/extrinsic_calibrator/b616219dba9cf19e74d55e8d334ad09eb0aa153e/extrinsic_calibrator_core/extrinsic_calibrator_core/__init__.py -------------------------------------------------------------------------------- /extrinsic_calibrator_core/extrinsic_calibrator_core/src/aruco_generator_class.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # This file is part of **extrinsic-calibrator: 3 | # October 2024 4 | # Copyright 2024 IKERLAN. All Rights Reserved. 5 | # 6 | # 7 | # LICENSE NOTICE 8 | # 9 | # This software is available under a dual license system. Choose between: 10 | # - GNU Affero General Public License v3.0 for open-source usage, or 11 | # - A commercial license for proprietary development. 12 | # For commercial license details, contact us at info@ikerlan.es. 13 | # 14 | # GNU Affero General Public License v3.0 15 | # Version 3, 19 November 2007 16 | # © 2007 Free Software Foundation, Inc. 17 | # 18 | # Licensed under a dual license system: 19 | # 1. Open-source usage under the GNU Affero General Public License v3.0 20 | # (AGPL-3.0), allowing you to freely use, modify, and distribute the 21 | # software for open-source projects. You can find a copy of the AGPL-3.0 22 | # license at https://www.gnu.org/licenses/agpl-3.0.html. 23 | # 2. For commercial/proprietary use, a separate commercial license is required. 24 | # Please contact us at info@ikerlan.es for inquiries about our commercial 25 | # licensing options. 26 | # 27 | # This program is free software: you can redistribute it and/or modify 28 | # it under the terms of the GNU Affero General Public License as published by 29 | # the Free Software Foundation, either version 3 of the License, or 30 | # (at your option) any later version. 31 | # 32 | # This program is distributed in the hope that it will be useful, 33 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | # GNU Affero General Public License for more details. 36 | # 37 | # You should have received a copy of the GNU Affero General Public License 38 | # along with this program. If not, see . 39 | # 40 | # Author Information: 41 | # Author: Josep Rueda Collell 42 | # Created: October 2024 43 | # Affiliation: IKERLAN (https://www.ikerlan.es) 44 | # ------------------------------------------------------------------------------ 45 | 46 | # Standard libraries 47 | import os 48 | 49 | # Well-known libraries 50 | import cv2 51 | 52 | # ROS-specific imports 53 | import rclpy 54 | from rclpy.node import Node 55 | 56 | # Custom parameters 57 | from extrinsic_calibrator_core.python_aruco_parameters import aruco_params 58 | from extrinsic_calibrator_core.src.extrinsic_calibrator_class import ArucoParams 59 | 60 | 61 | 62 | class ArucoMarkerGenerator(Node): 63 | def __init__(self): 64 | super().__init__('aruco_marker_generator') 65 | self.get_logger().info("Aruco Marker Generator Node has started.") 66 | 67 | aruco_params_listener = aruco_params.ParamListener(self) 68 | imported_aruco_params = aruco_params_listener.get_params() 69 | self.real_aruco_params = ArucoParams(self,imported_aruco_params) 70 | 71 | # Parameters for marker generation 72 | self.declare_parameter('marker_size', 200) 73 | self.declare_parameter('output_directory', '~/markers') 74 | 75 | marker_size = self.get_parameter('marker_size').value 76 | output_directory = os.path.expanduser(self.get_parameter('output_directory').value) 77 | 78 | # Check if output directory exists, create if it doesn't 79 | if not os.path.exists(output_directory): 80 | os.makedirs(output_directory) 81 | self.get_logger().info(f"Created output directory: {output_directory}") 82 | else: 83 | self.get_logger().info(f"Output directory: {output_directory} already exists") 84 | 85 | # Generate all markers from aruco_dict 86 | num_markers = len(self.real_aruco_params.aruco_dict.bytesList) 87 | for marker_id in range(0, num_markers): 88 | if not self.generate_marker(marker_id, marker_size, output_directory, self.real_aruco_params): 89 | self.get_logger().info("ArUco generation failed") 90 | return False 91 | 92 | self.get_logger().info("ArUco generation finished successfully. Hit Ctrl+C to exit") 93 | 94 | while(1): 95 | pass 96 | 97 | self.destroy_node() 98 | rclpy.shutdown() 99 | 100 | 101 | def generate_marker(self, marker_id, marker_size, output_directory, aruco_params:ArucoParams): 102 | # Generate the marker image 103 | marker_image = cv2.aruco.generateImageMarker(aruco_params.aruco_dict, marker_id, marker_size) 104 | 105 | # Rotate the image 180 degrees 106 | rotated_marker = cv2.rotate(marker_image, cv2.ROTATE_180) 107 | 108 | # Save the rotated marker image to the specified directory 109 | output_path = os.path.join(output_directory, f'aruco_marker_{marker_id}.png') 110 | cv2.imwrite(output_path, rotated_marker) 111 | # self.get_logger().info(f'Marker with ID {marker_id} generated and saved to {output_path}') 112 | return True 113 | 114 | 115 | -------------------------------------------------------------------------------- /extrinsic_calibrator_core/extrinsic_calibrator_core/src/extrinsic_calibrator_class.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # This file is part of **extrinsic-calibrator: 3 | # October 2024 4 | # Copyright 2024 IKERLAN. All Rights Reserved. 5 | # 6 | # 7 | # LICENSE NOTICE 8 | # 9 | # This software is available under a dual license system. Choose between: 10 | # - GNU Affero General Public License v3.0 for open-source usage, or 11 | # - A commercial license for proprietary development. 12 | # For commercial license details, contact us at info@ikerlan.es. 13 | # 14 | # GNU Affero General Public License v3.0 15 | # Version 3, 19 November 2007 16 | # © 2007 Free Software Foundation, Inc. 17 | # 18 | # Licensed under a dual license system: 19 | # 1. Open-source usage under the GNU Affero General Public License v3.0 20 | # (AGPL-3.0), allowing you to freely use, modify, and distribute the 21 | # software for open-source projects. You can find a copy of the AGPL-3.0 22 | # license at https://www.gnu.org/licenses/agpl-3.0.html. 23 | # 2. For commercial/proprietary use, a separate commercial license is required. 24 | # Please contact us at info@ikerlan.es for inquiries about our commercial 25 | # licensing options. 26 | # 27 | # This program is free software: you can redistribute it and/or modify 28 | # it under the terms of the GNU Affero General Public License as published by 29 | # the Free Software Foundation, either version 3 of the License, or 30 | # (at your option) any later version. 31 | # 32 | # This program is distributed in the hope that it will be useful, 33 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | # GNU Affero General Public License for more details. 36 | # 37 | # You should have received a copy of the GNU Affero General Public License 38 | # along with this program. If not, see . 39 | # 40 | # Author Information: 41 | # Author: Josep Rueda Collell 42 | # Created: October 2024 43 | # Affiliation: IKERLAN (https://www.ikerlan.es) 44 | # ------------------------------------------------------------------------------ 45 | 46 | # Standard libraries 47 | import copy 48 | import random 49 | from collections import deque 50 | 51 | # Well-known libraries 52 | import cv2 53 | import numpy as np 54 | from prettytable import PrettyTable 55 | 56 | # ROS-specific imports 57 | from cv_bridge import CvBridge 58 | from geometry_msgs.msg import TransformStamped 59 | from rclpy.node import Node 60 | from sensor_msgs.msg import CameraInfo, Image 61 | import tf2_ros 62 | import tf_transformations 63 | 64 | # Custom parameters 65 | from extrinsic_calibrator_core.python_aruco_parameters import aruco_params 66 | from extrinsic_calibrator_core.python_camera_topics_parameters import cameras_params 67 | 68 | 69 | 70 | class ExtrinsicCalibrator(Node): 71 | def __init__(self): 72 | super().__init__('detector_aruco_node') 73 | 74 | # TF broadcaster 75 | self.tf_broadcaster = tf2_ros.StaticTransformBroadcaster(self) 76 | 77 | # OpenCV bridge for converting ROS Image to OpenCV image 78 | self.bridge = CvBridge() 79 | 80 | aruco_params_listener = aruco_params.ParamListener(self) 81 | imported_aruco_params = aruco_params_listener.get_params() 82 | self.real_aruco_params = ArucoParams(self,imported_aruco_params) 83 | 84 | cameras_param_listener = cameras_params.ParamListener(self) 85 | self.imported_cameras_params = cameras_param_listener.get_params() 86 | 87 | # Get all cameras, filtering out those that start or end with '_' 88 | cam_attributes = [attr for attr in dir(self.imported_cameras_params) if not (attr.startswith('_') or attr.endswith('_'))] 89 | 90 | # construct the cameras 91 | self.array_of_cameras = [] 92 | 93 | for camera_counter, attr_name in enumerate(cam_attributes): 94 | attr_value = getattr(self.imported_cameras_params, attr_name) 95 | 96 | # Check if the attribute has the 'image_topic' attribute before accessing it 97 | if not (hasattr(attr_value, 'image_topic') and hasattr(attr_value, 'image_topic')): 98 | self.get_logger().error(f"Skipping attribute '{attr_name}' due to missing 'image_topic' attribute.") 99 | else: 100 | self.array_of_cameras.append(Camera(self, attr_name, camera_counter, attr_value.image_topic, attr_value.camera_info_topic, self.bridge, self.tf_broadcaster, self.real_aruco_params)) 101 | 102 | # periodically check if all cameras are calibrated 103 | self.timer = self.create_timer(2.0, self.check_camera_transforms_callback) 104 | 105 | 106 | def check_camera_transforms_callback(self): 107 | if all([camera.are_all_transforms_precise() for camera in self.array_of_cameras]): 108 | self.get_logger().info(f"All marker transforms gathered successfully") 109 | for camera in self.array_of_cameras: 110 | camera:Camera 111 | self.get_logger().info(f"Camera {camera.camera_name} has received all marker transforms") 112 | camera.image_sub.destroy() 113 | camera.camera_info_sub.destroy() 114 | self.timer.cancel() 115 | self.initiate_calibration_routine() 116 | return True 117 | else: 118 | for camera in self.array_of_cameras: 119 | camera:Camera 120 | if camera.camera_matrix is None or camera.dist_coeffs is None: 121 | self.get_logger().warn(f"Camera {camera.camera_name} parameters not yet received. Is the camera_info topic correct?") 122 | self.get_logger().warn(f"Not all marker transforms gathered successfully") 123 | return False 124 | 125 | 126 | def initiate_calibration_routine(self): 127 | # Routine to be executed command by command unless something goes wrong 128 | if not self.generate_is_marker_visible_from_camera_table(): 129 | return False 130 | if not self.find_central_marker(): 131 | return False 132 | if not self.generate_transform_between_markers_table(): 133 | return False 134 | if not self.generate_path_between_markers_table(): 135 | return False 136 | if not self.generate_reliable_transform_between_markers_table(): 137 | return False 138 | if not self.generate_camera_to_marker_transform_table(): 139 | return False 140 | if not self.generate_world_to_cameras_transform_table(): 141 | return False 142 | if not self.broadcast_cameras_and_markers_to_world(): 143 | return False 144 | self.get_logger().info("Extrinsic calibration finished successfully.") 145 | self.get_logger().info("The transforms will remain alive while this Node remains too. Hit Ctrl+C to exit") 146 | 147 | # To keep the Transforms alive 148 | while(1): 149 | pass 150 | 151 | 152 | def generate_is_marker_visible_from_camera_table(self): 153 | # Build a 2D array where we can see which markers are visible by each camera is_marker_visible_from_camera_table[camera_id][marker_id] 154 | self.largest_marker = max([max(camera.reliable_marker_transforms.keys()) for camera in self.array_of_cameras]) 155 | self.is_marker_visible_from_camera_table = [[False for _ in range(len(self.array_of_cameras))] for _ in range(self.largest_marker + 1)] 156 | 157 | # Get array of all seen markers 158 | seen_markers = [] 159 | for camera in self.array_of_cameras: 160 | for marker_id in camera.reliable_marker_transforms.keys(): 161 | seen_markers.append(marker_id) 162 | 163 | # Fill is_marker_visible_from_camera_table 164 | for camera in self.array_of_cameras: 165 | for marker_id in seen_markers: 166 | if marker_id in camera.reliable_marker_transforms: 167 | self.is_marker_visible_from_camera_table[marker_id][camera.camera_id] = True 168 | 169 | # Display the is_marker_visible_from_camera_table 170 | self.display_camera_to_marker_table("Which markers does each camera see:", self.is_marker_visible_from_camera_table) 171 | 172 | # Check for exceptional cases 173 | for camera in self.array_of_cameras: 174 | # Check if a camera is not seeing any marker 175 | if all([not self.is_marker_visible_from_camera_table[marker_id][camera.camera_id] for marker_id in range(self.largest_marker + 1)]): 176 | self.get_logger().error(f"Camera {self.array_of_cameras[camera.camera_id].camera_name} doesn't see any marker") 177 | # Check if a camera is only seeing one marker 178 | elif sum(self.is_marker_visible_from_camera_table[marker_id][camera.camera_id] for marker_id in range(self.largest_marker + 1)) == 1: 179 | if (self.is_marker_visible_from_camera_table[marker_id][camera.camera_id] for marker_id in range(self.largest_marker + 1)): 180 | self.get_logger().warn(f"Camera {camera.camera_name} is only seeing one marker (Marker {marker_id})") 181 | 182 | # Check if any row has all False values 183 | for marker_id in range(self.largest_marker + 1): 184 | # Check if a marker is not seen by any camera 185 | if all([not self.is_marker_visible_from_camera_table[marker_id][camera.camera_id] for camera in self.array_of_cameras]): 186 | # self.get_logger().warn(f"Marker {marker_id} is not seen by any camera") 187 | pass 188 | # Check if a marker is olny seen by one camera 189 | elif sum(self.is_marker_visible_from_camera_table[marker_id][camera.camera_id] for camera in self.array_of_cameras) == 1: 190 | if (self.is_marker_visible_from_camera_table[marker_id][camera.camera_id] for camera in self.array_of_cameras): 191 | self.get_logger().warn(f"Marker {marker_id} is only seen by one camera (Camera {camera.camera_name})") 192 | 193 | # Check if specifically marker 0 is seen by any camera 194 | if not any(self.is_marker_visible_from_camera_table[0][camera.camera_id] for camera in self.array_of_cameras): 195 | self.get_logger().error(f"Marker 0 is not seen by any camera") 196 | return False 197 | 198 | else: 199 | return True 200 | 201 | 202 | def find_central_marker(self): 203 | # Table with the camera scores 204 | cameras_table = [[None for _ in range(len(self.array_of_cameras))] for _ in range(self.largest_marker + 1)] 205 | # Table with the marker scores 206 | markers_table = [[None for _ in range(len(self.array_of_cameras))] for _ in range(self.largest_marker + 1)] 207 | self.scores_table = [[None for _ in range(len(self.array_of_cameras))] for _ in range(self.largest_marker + 1)] 208 | 209 | # For each cell in the table, provide two tables, one indicating how many other markers are seen byt the same camera, and another indicating how many cameras sees one individual camera 210 | for camera in self.array_of_cameras: 211 | camera:Camera 212 | for marker_id in range(self.largest_marker + 1): 213 | camera_counter = 0 214 | marker_counter = 0 215 | for i in range(len(self.is_marker_visible_from_camera_table[marker_id])): 216 | if self.is_marker_visible_from_camera_table[marker_id][i]: 217 | camera_counter += 1 218 | for i in range(len(self.is_marker_visible_from_camera_table)): 219 | if self.is_marker_visible_from_camera_table[i][camera.camera_id]: 220 | marker_counter += 1 221 | if self.is_marker_visible_from_camera_table[marker_id][camera.camera_id]: 222 | cameras_table[marker_id][camera.camera_id] = marker_counter-1 223 | markers_table[marker_id][camera.camera_id] = camera_counter-1 224 | 225 | # The total result will be the addition of the two tables 226 | for camera in self.array_of_cameras: 227 | camera:Camera 228 | for marker_id in range(self.largest_marker + 1): 229 | if self.is_marker_visible_from_camera_table[marker_id][camera.camera_id]: 230 | self.scores_table[marker_id][camera.camera_id] = cameras_table[marker_id][camera.camera_id] + markers_table[marker_id][camera.camera_id] 231 | else: 232 | self.scores_table[marker_id][camera.camera_id] = None 233 | 234 | # Display the scores_table 235 | self.display_camera_to_marker_table("Scores of each camera-marker couple:", self.scores_table) 236 | 237 | # Check which marker has better punctuation by checking the maximum value of the table and returning its indices 238 | self.center_marker = self.find_random_max_index(self.scores_table) 239 | self.get_logger().info(f"Our central marker is Marker {self.center_marker}") 240 | 241 | return True 242 | 243 | 244 | def find_random_max_index(self, scores_table): 245 | max_value = float('-inf') 246 | max_indices = [] 247 | 248 | # Loop over the table to find the max value and its indices 249 | for marker_id in range(self.largest_marker + 1): 250 | for camera in self.array_of_cameras: 251 | camera:Camera 252 | if scores_table[marker_id][camera.camera_id] is not None: 253 | value = scores_table[marker_id][camera.camera_id] 254 | if value > max_value: 255 | max_value = value 256 | max_indices = [(marker_id, camera.camera_id)] # Reset list if new max is found 257 | elif value == max_value: 258 | max_indices.append((marker_id, camera.camera_id)) # Add to list if value equals current max 259 | 260 | # Randomly select one of the max indices 261 | max_marker_id, max_camera_id = random.choice(max_indices) 262 | if scores_table[max_marker_id][max_camera_id] == 0: 263 | self.get_logger().error(f"The center marker has no links between cameras nor markers") 264 | return max_marker_id 265 | 266 | 267 | def generate_transform_between_markers_table(self): 268 | # Table with all the transforms we know between markers due to the camera transforms 269 | 270 | # Create one table connected markers by a single camera 271 | for camera in self.array_of_cameras: 272 | camera:Camera 273 | camera.can_camera_connect_two_markers_table = [[False for _ in range(self.largest_marker + 1)] for _ in range(self.largest_marker + 1)] 274 | for origin_marker_id in range(self.largest_marker + 1): 275 | for destination_marker_id in range(self.largest_marker + 1): 276 | if origin_marker_id != destination_marker_id: 277 | if self.is_marker_visible_from_camera_table[origin_marker_id][camera.camera_id] and self.is_marker_visible_from_camera_table[destination_marker_id][camera.camera_id]: 278 | camera.can_camera_connect_two_markers_table[origin_marker_id][destination_marker_id] = True 279 | 280 | # Merge the previous table into a huge table to check which markers can be connected at all 281 | self.does_transform_exist_between_markers_table = [[False for _ in range(self.largest_marker + 1)] for _ in range(self.largest_marker + 1)] 282 | for camera in self.array_of_cameras: 283 | camera:Camera 284 | for origin_marker_id in range(self.largest_marker + 1): 285 | for destination_marker_id in range(self.largest_marker + 1): 286 | if camera.can_camera_connect_two_markers_table[origin_marker_id][destination_marker_id] == True: 287 | self.does_transform_exist_between_markers_table[origin_marker_id][destination_marker_id] = True 288 | 289 | # Print the does_transform_exist_between_markers_table 290 | self.display_marker_to_marker_table(f"Does exist a Transform between two markers through a camera:", self.does_transform_exist_between_markers_table) 291 | 292 | return True 293 | 294 | 295 | def generate_path_between_markers_table(self): 296 | # Table with all the different combination of paths to go from one marker to another 297 | self.path_between_markers_table = [[None for _ in range(self.largest_marker + 1)] for _ in range(self.largest_marker + 1)] 298 | for origin_marker_id in range(self.largest_marker + 1): 299 | for destination_marker_id in range(self.largest_marker + 1): 300 | self.path_between_markers_table[origin_marker_id][destination_marker_id] = self.explore_paths_between_markers(origin_marker_id, destination_marker_id) 301 | 302 | # Print the path_between_markers_table 303 | # self.display_marker_to_marker_table(f"Path between markers:", self.path_between_markers_table) 304 | 305 | # Generate the even more expanded table of paths 306 | self.path_between_markers_with_cameras_table = [[ [] for _ in range(self.largest_marker + 1)] for _ in range(self.largest_marker + 1)] 307 | for origin_marker_id in range(self.largest_marker + 1): 308 | for destination_marker_id in range(self.largest_marker + 1): 309 | if self.path_between_markers_table[origin_marker_id][destination_marker_id] is not None: 310 | for path in self.path_between_markers_table[origin_marker_id][destination_marker_id]: 311 | new_paths = self.return_the_cameras_between_markers_in_path(path) 312 | if new_paths is not None: 313 | for path in new_paths: 314 | self.path_between_markers_with_cameras_table[origin_marker_id][destination_marker_id].append(path) 315 | else: 316 | self.path_between_markers_with_cameras_table[origin_marker_id][destination_marker_id] = None 317 | 318 | # Print the path_between_markers_with_cameras_table 319 | # self.display_marker_to_marker_table(f"Path between markers including cameras:", self.path_between_markers_with_cameras_table) 320 | 321 | return True 322 | # Check that all markers are connected with marker 0 323 | # TODO 324 | 325 | 326 | def explore_paths_between_markers(self, origin_marker_id, destination_marker_id): 327 | # Function to retrieve all the paths between markers 328 | if origin_marker_id == destination_marker_id: 329 | return None 330 | else: 331 | # Temporary starting path with the origin_marker_id 332 | array_of_paths = [] 333 | current_path = [] 334 | current_path.append(origin_marker_id) 335 | array_of_paths.append(current_path) 336 | return self.evaluate_paths(origin_marker_id, destination_marker_id, array_of_paths) 337 | 338 | 339 | def evaluate_paths(self, origin_marker_id, destination_marker_id, current_array_of_paths): 340 | # Array of paths that successfully go from origin_marker_id to destination_marker_id 341 | array_of_successful_paths = [] 342 | # Temporary array of paths that are still candidates to be added to the array_of_successful_paths 343 | array_of_paths = [] 344 | array_of_paths = copy.deepcopy(current_array_of_paths) 345 | # For each path in the array of paths, find the children of the last element of the path. For each child, duplicate the path, adding the child at the end 346 | temp_array_of_paths = [] 347 | for path in array_of_paths: 348 | children = self.return_children(path[-1]) 349 | for child in children: 350 | new_path = copy.deepcopy(path) 351 | new_path.append(child) 352 | temp_array_of_paths.append(new_path) 353 | # Temporary array of paths that are still candidates to be added to the array_of_successful_paths, now with the children added 354 | array_of_paths = copy.deepcopy(temp_array_of_paths) 355 | 356 | # Check if any of the paths can be added to the array of finished paths 357 | temp_array_of_paths = copy.deepcopy(array_of_paths) 358 | for path in temp_array_of_paths: 359 | # if the newly added child is the origin, pop the path out of the candidates array 360 | if path[-1] == origin_marker_id: 361 | array_of_paths.remove(path) 362 | # if the newly added child was already in the path, pop the path out the candidates array 363 | elif path[-1] in path[:-1]: 364 | array_of_paths.remove(path) 365 | # if the newly added child is the destination, add it to the array_of_successful_paths 366 | elif destination_marker_id == path[-1]: 367 | if path not in array_of_successful_paths: 368 | array_of_successful_paths.append(path) 369 | array_of_paths.remove(path) 370 | 371 | # If there are still candidates in the array_of_paths iterate recursively on those 372 | if len(array_of_paths) > 0: 373 | new_good_paths = self.evaluate_paths(origin_marker_id, destination_marker_id, array_of_paths) 374 | if new_good_paths is not None: 375 | for new_path in new_good_paths: 376 | if new_path not in array_of_successful_paths: 377 | array_of_successful_paths.append(new_path) 378 | 379 | # If no path was found return None 380 | if array_of_successful_paths is None: 381 | return None 382 | elif len(array_of_successful_paths) == 0: 383 | return None 384 | else: 385 | return array_of_successful_paths 386 | 387 | 388 | def return_children(self, origin_marker): 389 | # Function to simply obtain the children of a marker, meaning the markers that can be reached from the origin_marker 390 | can_transform = [] 391 | for child_marker in range(self.largest_marker + 1): 392 | if self.does_transform_exist_between_markers_table[origin_marker][child_marker]: 393 | can_transform.append(child_marker) 394 | return can_transform 395 | 396 | 397 | def return_the_cameras_between_markers_in_path(self,path): 398 | # Function to insert the cameras in the paths, needed to transform from anoe to another 399 | final_array_of_paths = [] 400 | 401 | paths_to_evaluate = [] 402 | temp_path = copy.deepcopy(path) 403 | paths_to_evaluate.append(temp_path) 404 | 405 | for path_being_evaluated in paths_to_evaluate: 406 | # Check if the path has been evaluated by checking if the last element is a number, and the previous a string 407 | if type(path_being_evaluated[-2]) is str and type(path_being_evaluated[-1]) is int: 408 | # If it is, then the path has been evaluated 409 | if path_being_evaluated not in final_array_of_paths: 410 | final_array_of_paths.append(path_being_evaluated) 411 | paths_to_evaluate.pop(paths_to_evaluate.index(path_being_evaluated)) 412 | else: 413 | # If it is not, then the path has not been evaluated 414 | # Find the first element in the path which next element is not a string 415 | for marker_id_index in range(len(path_being_evaluated)-1): 416 | if type(path_being_evaluated[marker_id_index]) is int and type(path_being_evaluated[marker_id_index + 1]) is not str: 417 | for camera in self.array_of_cameras: 418 | camera:Camera 419 | if self.is_marker_visible_from_camera_table[path_being_evaluated[marker_id_index]][camera.camera_id] and self.is_marker_visible_from_camera_table[path_being_evaluated[marker_id_index + 1]][camera.camera_id]: 420 | new_path = copy.deepcopy(path_being_evaluated) 421 | new_path.insert(marker_id_index + 1, camera.camera_name) 422 | paths_to_evaluate.append(new_path) 423 | 424 | break 425 | else: 426 | continue 427 | 428 | if len(final_array_of_paths) > 0: 429 | return final_array_of_paths 430 | else: 431 | return None 432 | 433 | 434 | def generate_reliable_transform_between_markers_table(self): 435 | # Table with all the reliable transforms between markers. It tries to use as many transforms as possible in order to reduce the error 436 | self.reliable_transform_between_markers_table = [[None for _ in range(self.largest_marker + 1)] for _ in range(self.largest_marker + 1)] 437 | for origin_marker_id in range(self.largest_marker + 1): 438 | for destination_marker_id in range(self.largest_marker + 1): 439 | if self.path_between_markers_with_cameras_table[origin_marker_id][destination_marker_id] == None: 440 | self.reliable_transform_between_markers_table[origin_marker_id][destination_marker_id] = None 441 | else: 442 | self.reliable_transform_between_markers_table[origin_marker_id][destination_marker_id] = self.compose_marker_to_marker_transform(self.path_between_markers_with_cameras_table[origin_marker_id][destination_marker_id]) 443 | 444 | # Print the reliable_transform_between_markers_table 445 | # self.display_marker_to_marker_table(f"Reliable transform between markers:", self.reliable_transform_between_markers_table) 446 | 447 | return True 448 | 449 | 450 | def compose_marker_to_marker_transform(self, paths): 451 | # Function to provide us with the reliable transform between two markers, trying to use as many different paths as possible in order to reduce the error 452 | all_paths_transforms = [] 453 | for path in paths: 454 | # reverse de path 455 | # We are, instead, getting the reverse path so we can sue the super magic powers of the pseudoinverse later 456 | path.reverse() 457 | path_transform = np.eye(4) 458 | for element_index in range(len(path) - 2): 459 | # the elements are intercalated, between cameras and markers so we will iterate accordingly 460 | # check if the element_index is even (meaning it corresponds to a marker) 461 | if element_index % 2 == 0: 462 | origin_marker_id = path[element_index] 463 | camera_name = path[element_index+1] 464 | destination_marker_id = path[element_index + 2] 465 | for camera in self.array_of_cameras: 466 | if camera.camera_name == camera_name: 467 | camera:Camera 468 | if camera.can_camera_connect_two_markers_table[origin_marker_id][destination_marker_id]: 469 | transform = np.dot(np.linalg.inv(camera.reliable_marker_transforms[origin_marker_id]), camera.reliable_marker_transforms[destination_marker_id]) 470 | path_transform = np.dot(path_transform, transform) 471 | else: 472 | self.get_logger().error(f"The table camera.can_camera_connect_two_markers_table of the camera {camera.camera_name} has a mistake") 473 | else: 474 | continue 475 | all_paths_transforms.append(path_transform) 476 | stacked_transform = np.hstack(all_paths_transforms) 477 | 478 | # Calculate the number of 4x4 blocks in stacked_transform 479 | num_blocks = stacked_transform.shape[1] // 4 480 | stacked_identity = np.hstack([np.eye(4) for _ in range(num_blocks)]) 481 | 482 | # Compute pseudoinverse and perform final multiplication 483 | pseudoinverse_result = np.linalg.pinv(stacked_transform) 484 | reliable_marker_to_marker_transform = np.dot(stacked_identity, pseudoinverse_result) 485 | return reliable_marker_to_marker_transform 486 | 487 | 488 | def generate_camera_to_marker_transform_table(self): 489 | # Create a table with the transforms between the cameras and the markers 490 | self.camera_to_marker_transform_table = [[None for _ in range(len(self.array_of_cameras))] for _ in range(self.largest_marker + 1)] 491 | for camera in self.array_of_cameras: 492 | camera:Camera 493 | for marker_id in range(self.largest_marker + 1): 494 | if self.is_marker_visible_from_camera_table[marker_id][camera.camera_id]: 495 | self.camera_to_marker_transform_table[marker_id][camera.camera_id] = camera.reliable_marker_transforms[marker_id] 496 | else: 497 | self.camera_to_marker_transform_table[marker_id][camera.camera_id] = None 498 | 499 | return True 500 | 501 | 502 | def generate_world_to_cameras_transform_table(self): 503 | # Create a table with the transforms between "map" and the cameras 504 | self.map_to_cameras_transform_table = [None for _ in range(len(self.array_of_cameras))] 505 | for camera in self.array_of_cameras: 506 | camera:Camera 507 | # check if the self.does_transform_exist_between_markers_table[camera_id]: has any True marker 508 | for marker_id in range(self.largest_marker + 1): 509 | if self.is_marker_visible_from_camera_table[marker_id][camera.camera_id]: 510 | self.map_to_cameras_transform_table[camera.camera_id] = self.compose_world_to_camera_transform(camera.camera_id) 511 | break 512 | else: 513 | self.map_to_cameras_transform_table[camera.camera_id] = None 514 | 515 | return True 516 | 517 | 518 | def compose_world_to_camera_transform(self, camera_id): 519 | # Computes the transform between "map" and the camera trying to use as many camera transforms as possible 520 | array_of_camera_to_world_transforms = [] 521 | for marker_id in range(self.largest_marker + 1): 522 | if self.is_marker_visible_from_camera_table[marker_id][camera_id]: 523 | if marker_id == 0: 524 | marker_to_world_transform = np.eye(4) 525 | elif self.does_transform_exist_between_markers_table[marker_id][0]: 526 | marker_to_world_transform = self.reliable_transform_between_markers_table[marker_id][0] 527 | else: 528 | continue 529 | camera_to_marker_transform = self.camera_to_marker_transform_table[marker_id][camera_id] 530 | camera_to_world_transform = np.dot(camera_to_marker_transform,marker_to_world_transform) 531 | 532 | array_of_camera_to_world_transforms.append(camera_to_world_transform) 533 | 534 | stacked_transform = np.hstack(array_of_camera_to_world_transforms) 535 | # Calculate the number of 4x4 blocks in stacked_transform 536 | num_blocks = stacked_transform.shape[1] // 4 537 | stacked_identity = np.hstack([np.eye(4) for _ in range(num_blocks)]) 538 | 539 | # Compute pseudoinverse and perform final multiplication 540 | pseudoinverse_result = np.linalg.pinv(stacked_transform) 541 | reliable_camera_transform = np.dot(stacked_identity, pseudoinverse_result) 542 | 543 | return reliable_camera_transform 544 | 545 | 546 | def broadcast_cameras_and_markers_to_world(self): 547 | # Create an array of transforms to be broadcasted 548 | transforms = [] 549 | 550 | # Broadcast the transform between "marker_0" and "map" 551 | origin_transform = np.eye(4) 552 | 553 | t = TransformStamped() 554 | 555 | t.header.stamp = self.get_clock().now().to_msg() 556 | t.header.frame_id = "marker_0" 557 | t.child_frame_id = "map" 558 | 559 | translation = tf_transformations.translation_from_matrix(origin_transform) 560 | quaternion = tf_transformations.quaternion_from_matrix(origin_transform) 561 | 562 | t.transform.translation.x = translation[0] 563 | t.transform.translation.y = translation[1] 564 | t.transform.translation.z = translation[2] 565 | 566 | t.transform.rotation.x = quaternion[0] 567 | t.transform.rotation.y = quaternion[1] 568 | t.transform.rotation.z = quaternion[2] 569 | t.transform.rotation.w = quaternion[3] 570 | 571 | transforms.append(t) 572 | 573 | # Add all the transforms between the center_marker and the rest of the markers to the array 574 | for destination_marker_id in range(self.largest_marker + 1): 575 | if self.reliable_transform_between_markers_table[self.center_marker][destination_marker_id] is not None: 576 | t = TransformStamped() 577 | t.header.stamp = self.get_clock().now().to_msg() 578 | t.header.frame_id = f"marker_{self.center_marker}" 579 | t.child_frame_id = f"marker_{destination_marker_id}" 580 | 581 | transform = self.reliable_transform_between_markers_table[self.center_marker][destination_marker_id] 582 | translation = tf_transformations.translation_from_matrix(transform) 583 | quaternion = tf_transformations.quaternion_from_matrix(transform) 584 | 585 | t.transform.translation.x = translation[0] 586 | t.transform.translation.y = translation[1] 587 | t.transform.translation.z = translation[2] 588 | 589 | t.transform.rotation.x = quaternion[0] 590 | t.transform.rotation.y = quaternion[1] 591 | t.transform.rotation.z = quaternion[2] 592 | t.transform.rotation.w = quaternion[3] 593 | 594 | transforms.append(t) 595 | 596 | 597 | # Add all the camera transforms 598 | for camera in self.array_of_cameras: 599 | camera:Camera 600 | if self.map_to_cameras_transform_table[camera.camera_id] is not None: 601 | t = TransformStamped() 602 | t.header.stamp = self.get_clock().now().to_msg() 603 | t.header.frame_id = "map" 604 | t.child_frame_id = camera.camera_name 605 | 606 | transform = self.map_to_cameras_transform_table[camera.camera_id] 607 | translation = tf_transformations.translation_from_matrix(transform) 608 | quaternion = tf_transformations.quaternion_from_matrix(transform) 609 | 610 | t.transform.translation.x = translation[0] 611 | t.transform.translation.y = translation[1] 612 | t.transform.translation.z = translation[2] 613 | t.transform.rotation.x = quaternion[0] 614 | t.transform.rotation.y = quaternion[1] 615 | t.transform.rotation.z = quaternion[2] 616 | t.transform.rotation.w = quaternion[3] 617 | 618 | transforms.append(t) 619 | 620 | # Broadcast all transforms at once 621 | if transforms: 622 | self.tf_broadcaster.sendTransform(transforms) 623 | return True 624 | 625 | 626 | def display_camera_to_marker_table(self, title, table_data): 627 | table = PrettyTable() 628 | table.field_names = ["Marker ID"] + [f"Camera {i}" for i in range(len(self.array_of_cameras))] 629 | if type(table_data[0][0]) is bool: 630 | for marker_id, row in enumerate(table_data): 631 | table.add_row([marker_id] + ['✓' if cell else '✗' for cell in row]) 632 | else: 633 | for marker_id, row in enumerate(table_data): 634 | table.add_row([marker_id] + [cell for cell in row]) 635 | self.get_logger().info(f"{title}\n" + table.get_string()) 636 | 637 | 638 | def display_marker_to_marker_table(self, title, table_data): 639 | table = PrettyTable() 640 | table.field_names = ["Marker ID"] + [f"Marker {i}" for i in range(self.largest_marker + 1)] 641 | if type(table_data[0][0]) is bool: 642 | for marker_id, row in enumerate(table_data): 643 | table.add_row([marker_id] + ['✓' if cell else '✗' for cell in row]) 644 | else: 645 | for marker_id, row in enumerate(table_data): 646 | table.add_row([marker_id] + [cell for cell in row]) 647 | self.get_logger().info(f"{title}\n" + table.get_string()) 648 | 649 | 650 | 651 | class ArucoParams(): 652 | def __init__(self, node:Node, aruco_params): 653 | if hasattr(cv2.aruco, aruco_params.aruco_dict): 654 | self.aruco_dict = cv2.aruco.getPredefinedDictionary(getattr(cv2.aruco, aruco_params.aruco_dict)) 655 | else: 656 | node.get_logger().error(f"cv2.aruco doesn't have a dictionary with the name '{aruco_params.aruco_dict}'") 657 | self.marker_length = aruco_params.marker_length 658 | 659 | 660 | 661 | class Camera(): 662 | def __init__(self, node:Node, camera_name:str, camera_id:int, image_topic:str, camera_info_topic:str, bridge:CvBridge, broadcaster:tf2_ros.TransformBroadcaster, aruco_params:ArucoParams): 663 | 664 | self.node = node 665 | self.camera_name = camera_name 666 | self.camera_id = camera_id 667 | self.image_topic = image_topic 668 | self.camera_info_topic = camera_info_topic 669 | self.bridge = bridge 670 | self.tf_broadcaster = broadcaster 671 | 672 | self.node.get_logger().info(f"Camera {self.camera_name} created.") 673 | 674 | self.camera_matrix = None 675 | self.dist_coeffs = None 676 | 677 | # Define Aruco marker properties 678 | self.aruco_dict = aruco_params.aruco_dict 679 | self.parameters = cv2.aruco.DetectorParameters() 680 | self.detector = cv2.aruco.ArucoDetector(self.aruco_dict, self.parameters) 681 | self.marker_length = aruco_params.marker_length # length of the marker side in meters (adjust as needed) 682 | 683 | # Subscribe to the camera image topic and camera info 684 | self.image_sub = self.node.create_subscription(Image, image_topic, self.image_callback, 1) 685 | self.camera_info_sub = self.node.create_subscription(CameraInfo, camera_info_topic, self.camera_info_callback, 1) 686 | self.cv2_image_publisher = self.node.create_publisher(Image, f"{image_topic}/detected_markers", 10) 687 | 688 | self.marker_transforms = {} 689 | self.reliable_marker_transforms = {} 690 | 691 | 692 | def camera_info_callback(self, msg): 693 | if self.camera_matrix is None: 694 | self.camera_matrix = np.array(msg.k).reshape((3, 3)) 695 | self.dist_coeffs = np.array(msg.d) 696 | self.node.get_logger().info(f"Camera {self.camera_name} parameters received.") 697 | 698 | 699 | def image_callback(self, msg): 700 | if self.camera_matrix is None or self.dist_coeffs is None: 701 | self.node.get_logger().warn(f"Camera {self.camera_name} parameters not yet received.") 702 | return 703 | 704 | cv_image = self.bridge.imgmsg_to_cv2(msg, "bgr8") 705 | 706 | # For ArUco detection, you can use the filtered_image directly 707 | corners, ids, rejected_img_points = self.detector.detectMarkers(cv_image) 708 | detected_ids = set() 709 | if ids is not None: 710 | for i, id in enumerate(ids): 711 | marker_id = id[0] 712 | detected_ids.add(marker_id) 713 | 714 | if marker_id not in self.marker_transforms and marker_id not in self.reliable_marker_transforms: 715 | self.marker_transforms[marker_id] = deque(maxlen=30) 716 | 717 | objPoints = np.array([ [-self.marker_length/2, self.marker_length/2, 0], 718 | [self.marker_length/2, self.marker_length/2, 0], 719 | [self.marker_length/2, -self.marker_length/2, 0], 720 | [-self.marker_length/2,-self.marker_length/2, 0]], dtype=np.float32) 721 | 722 | success, rvec, tvec = cv2.solvePnP(objPoints, corners[i], self.camera_matrix, self.dist_coeffs) 723 | if success: 724 | rot_matrix, _ = cv2.Rodrigues(rvec) 725 | translation_matrix = np.eye(4) 726 | translation_matrix[:3, :3] = rot_matrix 727 | translation_matrix[:3, 3] = tvec.flatten() 728 | 729 | # Draw the transform 730 | cv2.aruco.drawDetectedMarkers(cv_image, corners, ids) 731 | cv2.drawFrameAxes(cv_image, self.camera_matrix, self.dist_coeffs, rvec, tvec, self.marker_length/2) 732 | ros_image = self.bridge.cv2_to_imgmsg(cv_image, "bgr8") 733 | self.cv2_image_publisher.publish(ros_image) 734 | 735 | # Filter out the already reliable markers 736 | if marker_id in self.reliable_marker_transforms: 737 | continue 738 | else: 739 | self.marker_transforms[marker_id].append(translation_matrix) 740 | 741 | # Add None for markers not detected in this frame 742 | for marker_id in self.marker_transforms: 743 | if marker_id not in detected_ids: 744 | # Restart the precision of the marker if not seen 745 | # self.marker_transforms[marker_id].append(None) 746 | pass 747 | 748 | # iterate through each marker of the marker_transforms dictionary 749 | for marker_id, transforms in self.marker_transforms.items(): 750 | if len(transforms) == 30: 751 | self.check_precision(marker_id, transforms) 752 | 753 | # delete all the transforms from the marker_transforms dictionary 754 | for marker_id, transform in self.reliable_marker_transforms.items(): 755 | if marker_id in self.marker_transforms: 756 | del self.marker_transforms[marker_id] 757 | 758 | 759 | def check_precision(self, marker_id, transform): 760 | if self.is_precise(transform): 761 | self.node.get_logger().info(f"Camera {self.camera_name}: Marker {marker_id} is reliable") 762 | # add the last transform of the array in the dictionary as reliable marker transform 763 | self.reliable_marker_transforms[marker_id] = transform[-1] 764 | 765 | 766 | def is_precise(self, transforms): 767 | if all(transform is not None for transform in transforms): 768 | positions = np.array([t[:3, 3] for t in transforms]) 769 | rotations = np.array([tf_transformations.euler_from_matrix(t) for t in transforms]) 770 | 771 | position_range = np.ptp(positions, axis=0) 772 | rotation_range = np.ptp(rotations, axis=0) 773 | 774 | return np.all(position_range < 0.02) and np.all(rotation_range < np.radians(10)) 775 | else: 776 | return False 777 | 778 | 779 | def are_all_transforms_precise(self): 780 | if len(self.reliable_marker_transforms) > 0 and len(self.marker_transforms) == 0: 781 | self.node.get_logger().info(f"Camera {self.camera_name}: All markers are reliable") 782 | return True 783 | else: 784 | for marker_id, transform in self.marker_transforms.items(): 785 | if marker_id not in self.reliable_marker_transforms.keys(): 786 | self.node.get_logger().warn(f"Camera {self.camera_name}: Marker {marker_id} is not reliable, yet") 787 | return False 788 | 789 | 790 | -------------------------------------------------------------------------------- /extrinsic_calibrator_core/launch/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ikerlan-KER/extrinsic_calibrator/b616219dba9cf19e74d55e8d334ad09eb0aa153e/extrinsic_calibrator_core/launch/__init__.py -------------------------------------------------------------------------------- /extrinsic_calibrator_core/license.md: -------------------------------------------------------------------------------- 1 | # IKERLAN, S. COOP 2 | This file is part of **extrinsic-calibrator: humble** 3 | October 2024 4 | 5 | # LICENSE NOTICE 6 | 7 | This software has been liberated under a dual license system, on which you can choose between the open-source GNU Affero General Public License v3 in the case you are interested in using this software for an open-source development, or a commercial license in the case you are interested in using this software for a privative development. If you want to know more about our commercial license, please contact us in info@ikerlan.es. 8 | 9 | # GNU AFFERO GENERAL PUBLIC LICENSE 10 | Version 3, 19 November 2007 11 | Copyright © 2007 Free Software Foundation, Inc. 12 | Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 13 | Preamble 14 | The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. 15 | The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. 16 | When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. 17 | Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. 18 | A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. 19 | The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. 20 | An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. 21 | The precise terms and conditions for copying, distribution and modification follow. 22 | TERMS AND CONDITIONS 23 | 0. Definitions. 24 | "This License" refers to version 3 of the GNU Affero General Public License. 25 | "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. 26 | "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. 27 | To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. 28 | A "covered work" means either the unmodified Program or a work based on the Program. 29 | To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. 30 | To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. 31 | An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 32 | 1. Source Code. 33 | The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. 34 | A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. 35 | The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. 36 | The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. 37 | The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. 38 | The Corresponding Source for a work in source code form is that same work. 39 | 2. Basic Permissions. 40 | All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. 41 | You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. 42 | Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 43 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 44 | No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. 45 | When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 46 | 4. Conveying Verbatim Copies. 47 | You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. 48 | You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 49 | 5. Conveying Modified Source Versions. 50 | You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: 51 | • a) The work must carry prominent notices stating that you modified it, and giving a relevant date. 52 | • b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". 53 | • c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. 54 | • d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. 55 | A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 56 | 6. Conveying Non-Source Forms. 57 | You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: 58 | • a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. 59 | • b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. 60 | • c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. 61 | • d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. 62 | • e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. 63 | A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. 64 | A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. 65 | "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. 66 | If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). 67 | The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. 68 | Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 69 | 7. Additional Terms. 70 | "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. 71 | When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. 72 | Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: 73 | • a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or 74 | • b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or 75 | • c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or 76 | • d) Limiting the use for publicity purposes of names of licensors or authors of the material; or 77 | • e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or 78 | • f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. 79 | All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. 80 | If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. 81 | Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 82 | 8. Termination. 83 | You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). 84 | However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. 85 | Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. 86 | Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 87 | 9. Acceptance Not Required for Having Copies. 88 | You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 89 | 10. Automatic Licensing of Downstream Recipients. 90 | Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. 91 | An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. 92 | You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 93 | 11. Patents. 94 | A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". 95 | A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. 96 | Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. 97 | In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. 98 | If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. 99 | If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. 100 | A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. 101 | Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 102 | 12. No Surrender of Others' Freedom. 103 | If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 104 | 13. Remote Network Interaction; Use with the GNU General Public License. 105 | Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. 106 | Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 107 | 14. Revised Versions of this License. 108 | The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. 109 | Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. 110 | If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. 111 | Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 112 | 15. Disclaimer of Warranty. 113 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 114 | 16. Limitation of Liability. 115 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 116 | 17. Interpretation of Sections 15 and 16. 117 | If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. 118 | END OF TERMS AND CONDITIONS 119 | How to Apply These Terms to Your New Programs 120 | If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. 121 | To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. 122 | 123 | Copyright (C) 124 | 125 | This program is free software: you can redistribute it and/or modify 126 | it under the terms of the GNU Affero General Public License as 127 | published by the Free Software Foundation, either version 3 of the 128 | License, or (at your option) any later version. 129 | 130 | This program is distributed in the hope that it will be useful, 131 | but WITHOUT ANY WARRANTY; without even the implied warranty of 132 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 133 | GNU Affero General Public License for more details. 134 | 135 | You should have received a copy of the GNU Affero General Public License 136 | along with this program. If not, see . 137 | Also add information on how to contact you by electronic and paper mail. 138 | If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. 139 | You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . 140 | 141 | -------------------------------------------------------------------------------- /extrinsic_calibrator_core/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | extrinsic_calibrator_core 5 | 0.1.0 6 | ROS2 package designed to calibrate a set of cameras distributed throughout a room. The calibration is performed using ArUco markers scattered randomly in the environment. Each camera detects one or several ArUco markers within its field of view, and the algorithm reconstructs the positions of the markers to create a global map. 7 | Josep Rueda Collell 8 | AGPL-3.0-only 9 | 10 | ament_cmake 11 | ament_cmake_python 12 | 13 | rclcpp 14 | rclpy 15 | cv_bridge 16 | generate_parameter_library 17 | sensor_msgs 18 | std_msgs 19 | tf2_ros 20 | tf_transformations 21 | 22 | rosidl_default_generators 23 | 24 | rosidl_default_runtime 25 | python3-opencv 26 | python-opencv-contrib-pip 27 | python3-pip 28 | python3-numpy 29 | python3-prettytable 30 | 31 | rosidl_interface_packages 32 | 33 | ament_lint_auto 34 | ament_lint_common 35 | 36 | 37 | ament_cmake 38 | 39 | 40 | -------------------------------------------------------------------------------- /extrinsic_calibrator_core/scripts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ikerlan-KER/extrinsic_calibrator/b616219dba9cf19e74d55e8d334ad09eb0aa153e/extrinsic_calibrator_core/scripts/__init__.py -------------------------------------------------------------------------------- /extrinsic_calibrator_core/scripts/extrinsic_calibrator_node.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # ------------------------------------------------------------------------------ 4 | # This file is part of **extrinsic-calibrator: 5 | # October 2024 6 | # Copyright 2024 IKERLAN. All Rights Reserved. 7 | # 8 | # 9 | # LICENSE NOTICE 10 | # 11 | # This software is available under a dual license system. Choose between: 12 | # - GNU Affero General Public License v3.0 for open-source usage, or 13 | # - A commercial license for proprietary development. 14 | # For commercial license details, contact us at info@ikerlan.es. 15 | # 16 | # GNU Affero General Public License v3.0 17 | # Version 3, 19 November 2007 18 | # © 2007 Free Software Foundation, Inc. 19 | # 20 | # Licensed under a dual license system: 21 | # 1. Open-source usage under the GNU Affero General Public License v3.0 22 | # (AGPL-3.0), allowing you to freely use, modify, and distribute the 23 | # software for open-source projects. You can find a copy of the AGPL-3.0 24 | # license at https://www.gnu.org/licenses/agpl-3.0.html. 25 | # 2. For commercial/proprietary use, a separate commercial license is required. 26 | # Please contact us at info@ikerlan.es for inquiries about our commercial 27 | # licensing options. 28 | # 29 | # This program is free software: you can redistribute it and/or modify 30 | # it under the terms of the GNU Affero General Public License as published by 31 | # the Free Software Foundation, either version 3 of the License, or 32 | # (at your option) any later version. 33 | # 34 | # This program is distributed in the hope that it will be useful, 35 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 36 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 37 | # GNU Affero General Public License for more details. 38 | # 39 | # You should have received a copy of the GNU Affero General Public License 40 | # along with this program. If not, see . 41 | # 42 | # Author Information: 43 | # Author: Josep Rueda Collell 44 | # Created: October 2024 45 | # Affiliation: IKERLAN (https://www.ikerlan.es) 46 | # ------------------------------------------------------------------------------ 47 | 48 | # ROS-specific imports 49 | import rclpy 50 | from rclpy.executors import MultiThreadedExecutor 51 | 52 | # Custom parameters 53 | from extrinsic_calibrator_core.src.extrinsic_calibrator_class import ExtrinsicCalibrator 54 | 55 | 56 | def main(args=None): 57 | rclpy.init(args=args) 58 | 59 | # Create nodes 60 | extrinsic_calibrator_node = ExtrinsicCalibrator() 61 | 62 | # Create executor and add nodes 63 | executor = MultiThreadedExecutor() 64 | executor.add_node(extrinsic_calibrator_node) 65 | 66 | try: 67 | # Run the nodes within the executor 68 | executor.spin() 69 | except KeyboardInterrupt: 70 | pass 71 | finally: 72 | # Cleanup 73 | executor.shutdown() 74 | extrinsic_calibrator_node.destroy_node() 75 | rclpy.shutdown() 76 | 77 | if __name__ == '__main__': 78 | main() -------------------------------------------------------------------------------- /extrinsic_calibrator_core/scripts/generator_aruco_node.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # ------------------------------------------------------------------------------ 4 | # This file is part of **extrinsic-calibrator: 5 | # October 2024 6 | # Copyright 2024 IKERLAN. All Rights Reserved. 7 | # 8 | # 9 | # LICENSE NOTICE 10 | # 11 | # This software is available under a dual license system. Choose between: 12 | # - GNU Affero General Public License v3.0 for open-source usage, or 13 | # - A commercial license for proprietary development. 14 | # For commercial license details, contact us at info@ikerlan.es. 15 | # 16 | # GNU Affero General Public License v3.0 17 | # Version 3, 19 November 2007 18 | # © 2007 Free Software Foundation, Inc. 19 | # 20 | # Licensed under a dual license system: 21 | # 1. Open-source usage under the GNU Affero General Public License v3.0 22 | # (AGPL-3.0), allowing you to freely use, modify, and distribute the 23 | # software for open-source projects. You can find a copy of the AGPL-3.0 24 | # license at https://www.gnu.org/licenses/agpl-3.0.html. 25 | # 2. For commercial/proprietary use, a separate commercial license is required. 26 | # Please contact us at info@ikerlan.es for inquiries about our commercial 27 | # licensing options. 28 | # 29 | # This program is free software: you can redistribute it and/or modify 30 | # it under the terms of the GNU Affero General Public License as published by 31 | # the Free Software Foundation, either version 3 of the License, or 32 | # (at your option) any later version. 33 | # 34 | # This program is distributed in the hope that it will be useful, 35 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 36 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 37 | # GNU Affero General Public License for more details. 38 | # 39 | # You should have received a copy of the GNU Affero General Public License 40 | # along with this program. If not, see . 41 | # 42 | # Author Information: 43 | # Author: Josep Rueda Collell 44 | # Created: October 2024 45 | # Affiliation: IKERLAN (https://www.ikerlan.es) 46 | # ------------------------------------------------------------------------------ 47 | 48 | # ROS-specific imports 49 | import rclpy 50 | from rclpy.executors import MultiThreadedExecutor 51 | 52 | # Custom parameters 53 | from extrinsic_calibrator_core.src.aruco_generator_class import ArucoMarkerGenerator 54 | 55 | 56 | def main(args=None): 57 | rclpy.init(args=args) 58 | 59 | # Create nodes 60 | generator_node = ArucoMarkerGenerator() 61 | 62 | # Create executor and add nodes 63 | executor = MultiThreadedExecutor() 64 | executor.add_node(generator_node) 65 | 66 | try: 67 | # Run the nodes within the executor 68 | executor.spin() 69 | except KeyboardInterrupt: 70 | pass 71 | finally: 72 | # Cleanup 73 | executor.shutdown() 74 | generator_node.destroy_node() 75 | rclpy.shutdown() 76 | 77 | if __name__ == '__main__': 78 | main() -------------------------------------------------------------------------------- /extrinsic_calibrator_examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(extrinsic_calibrator_examples) 3 | 4 | if(NOT CMAKE_CXX_STANDARD) 5 | set(CMAKE_CXX_STANDARD 14) 6 | endif() 7 | 8 | # DEPENDENCIES 9 | 10 | # Find packages 11 | find_package(ament_cmake REQUIRED) 12 | find_package(ament_cmake_python REQUIRED) 13 | find_package(rclcpp REQUIRED) 14 | find_package(rclpy REQUIRED) 15 | find_package(cv_bridge REQUIRED) 16 | find_package(extrinsic_calibrator_core REQUIRED) 17 | find_package(rviz2 REQUIRED) 18 | find_package(sensor_msgs REQUIRED) 19 | find_package(std_msgs REQUIRED) 20 | find_package(tf2_ros REQUIRED) 21 | 22 | find_package(ament_cmake_auto REQUIRED) 23 | ament_auto_find_build_dependencies() 24 | 25 | # COPY A PARTICULAR FOLDER TO THE INSTALL DIRECTORY 26 | # Install config dependencies 27 | install( 28 | DIRECTORY 29 | config 30 | rviz 31 | DESTINATION 32 | share/${PROJECT_NAME} 33 | ) 34 | 35 | 36 | # LAUNCH 37 | # Install launchfile 38 | ament_auto_package(INSTALL_TO_SHARE launch) -------------------------------------------------------------------------------- /extrinsic_calibrator_examples/README.md: -------------------------------------------------------------------------------- 1 | # extrinsic_calibrator_examples 2 | 3 | ## Overview 4 | 5 | `extrinsic_calibrator_examples` is a ROS2 package designed to provide examples on how to use the `extrinsic_calibrator_core` package as well as useful ros2 launch files to launch the cameras, the calibrator, as well as a demonstration rviz file. 6 | 7 | ## Features 8 | 9 | - Launch file to launch a set of cameras using the `usb_camera` package as well as the corresponding set of config files to configure the cameras. 10 | - Laucnh file to launch the rviz file to visualize the markers and the camera frames as well as the rviz file to configure it. 11 | - Launch file to launch all the previous, as well as the calibrator, them being the set of cameras, the rviz visualizer and the calibrator itself. 12 | 13 | ## Configuration 14 | 15 | The package provides configuration options through YAML files. 16 | 17 | ### Camera configuration 18 | 19 | Here you have an example configuration file `l515.yaml` file to configure the camera according to the `usb_camera` package, as well as the corresponding intrinsic calibration file. 20 | 21 | ```yaml 22 | /**: 23 | ros__parameters: 24 | video_device: "/dev/video12" # "ffplay /dev/video12" to test 25 | framerate: 6.0 26 | io_method: "mmap" 27 | frame_id: "cam2_frame" 28 | pixel_format: "yuyv" # see usb_cam/supported_formats for list of supported formats 29 | av_device_format: "YUV422P" 30 | image_width: 640 31 | image_height: 480 32 | camera_name: "cam2" 33 | camera_info_url: "package://extrinsic_calibrator_examples/config/l515_intrinsics.yaml" 34 | brightness: -1 35 | contrast: -1 36 | saturation: -1 37 | sharpness: -1 38 | gain: -1 39 | auto_white_balance: true 40 | white_balance: 4000 41 | autoexposure: true 42 | exposure: 100 43 | autofocus: false 44 | focus: -1 45 | ``` 46 | 47 | Don't forget to modify the parameter `camera_info_url` to properly link the camera configuration to the intrinsic calibration file. 48 | 49 | ```yaml 50 | image_width: 640 51 | image_height: 480 52 | camera_name: "cam2" 53 | camera_matrix: 54 | rows: 3 55 | cols: 3 56 | data: [607.4058837890625, 0.0, 325.59991455078125, 0.0, 607.5341186523438, 247.25904846191406, 0.0, 0.0, 1.0] 57 | distortion_model: "plumb_bob" 58 | distortion_coefficients: 59 | rows: 1 60 | cols: 5 61 | data: [0.19551624357700348, -0.5865326523780823, -0.002620677463710308, 0.0008374004391953349, 0.5133219957351685] 62 | rectification_matrix: 63 | rows: 3 64 | cols: 3 65 | data: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0] 66 | projection_matrix: 67 | rows: 3 68 | cols: 4 69 | data: [607.4058837890625, 0.0, 325.59991455078125, 0.0, 0.0, 607.5341186523438, 247.25904846191406, 0.0, 0.0, 0.0, 1.0, 0.0] 70 | 71 | ``` 72 | 73 | In case you want to launch more cameras with the same launch file, simply add them as additional nodes in the launch file `launch_usb_cameras.launch.py`: 74 | 75 | ```py 76 | d435_config = os.path.join(config_dir, 'd435.yaml') 77 | l515_config = os.path.join(config_dir, 'l515.yaml') 78 | # d457_config = os.path.join(config_dir, 'd457.yaml') 79 | 80 | return LaunchDescription([ 81 | Node( 82 | package='usb_cam', 83 | executable='usb_cam_node_exe', 84 | name='d435_camera', 85 | namespace='camera_1', 86 | parameters=[d435_config], 87 | output='screen' 88 | ), 89 | Node( 90 | package='usb_cam', 91 | executable='usb_cam_node_exe', 92 | name='l515_camera', 93 | namespace='camera_2', 94 | parameters=[l515_config], 95 | output='screen' 96 | ), 97 | # Node( 98 | # package='usb_cam', 99 | # executable='usb_cam_node_exe', 100 | # name='d457_camera', 101 | # namespace='camera_3', 102 | # parameters=[d457_config], 103 | # output='screen' 104 | # ), 105 | ]) 106 | 107 | ``` 108 | 109 | ## Usage 110 | 111 | ### Launching the Cameras 112 | 113 | Using the `usb_cam` package for your camera streams,you can launch the set of all cameras using: 114 | ```sh 115 | ros2 launch extrinsic_calibrator_examples launch_usb_cameras.launch.py 116 | ``` 117 | 118 | ### Launching the rviz visualizer 119 | 120 | An example rviz config file is provided which includes displays for the `/camera_1/image_raw/detected_markers` topic and the `/camera_2/image_raw/detected_markers` topic as well as the tf2 display of the found markers and cameras. To launch it, use: 121 | ```sh 122 | ros2 launch extrinsic_calibrator_examples launch_rviz.launch.py 123 | ``` 124 | 125 | ### Launching Both Cameras and the Calibrator 126 | 127 | To simultaneously launch the cameras, the rviz visualizer and the extrinsic calibrator, use: 128 | ```sh 129 | ros2 launch extrinsic_calibrator_examples launch_extrinsic_calibrator.launch.py 130 | ``` 131 | 132 | 133 | ## Dependencies 134 | 135 | The package relies on the following libraries and ROS2 packages: 136 | 137 | - `extrinsic_calibrator_core` for the core functionality 138 | - `usb_cam` package for camera streaming 139 | - `rviz2` for visualization 140 | 141 | 142 | To install the necessary dependencies, ensure you run: 143 | ```sh 144 | # update libraries 145 | sudo apt-get update 146 | # install ros dependencies 147 | rosdep update 148 | ``` 149 | 150 | ## Author Information 151 | 152 | **Authors:** 153 | - [Josep Rueda Collell](mailto:rueda_999@hotmail.com) 154 | - [Ander Gonzalez](mailto:ander.gonzalez@ikelan.es) 155 | 156 | **Created:** October 2024 157 | 158 | **Affiliation:** [IKERLAN](https://www.ikerlan.es) 159 | 160 | setup_paint 161 | 162 | ### Citation 163 | If you use this code, please cite: 164 | **Josep Rueda Collell**. "ROS2 Extrinsic Camera Calibrator using ArUco Markers". (2024). 165 | 166 | --- 167 | 168 | Developed as part of **AI-PRISM** project. 169 | 170 | 171 | 172 | 173 | 174 | *AI Powered human-centred Robot Interactions for Smart Manufacturing* 175 | 176 | 177 | 178 | 179 | 180 | Horizon Europe – Grant Agreement number [101058589](https://cordis.europa.eu/project/id/101058589) 181 | 182 | *Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union. The European Union cannot be held responsible for them. Neither the European Union nor the granting authority can be held responsible for them.* 183 | 184 | ## License 185 | 186 | This software is provided under a dual license system. You may choose between: 187 | 188 | - **GNU Affero General Public License v3**: For open-source development, subject to the conditions of this license. 189 | - **Commercial License**: For proprietary use. For more details on the commercial license, please contact us at [info@ikerlan.es](mailto:info@ikerlan.es). 190 | 191 | Please see the [LICENSE](./license.md) file for the complete terms and conditions of each license option. -------------------------------------------------------------------------------- /extrinsic_calibrator_examples/config/d435.yaml: -------------------------------------------------------------------------------- 1 | /**: 2 | ros__parameters: 3 | video_device: "/dev/video4" # "ffplay /dev/video4" to test 4 | framerate: 6.0 5 | io_method: "mmap" 6 | frame_id: "cam1_frame" 7 | pixel_format: "yuyv" # see usb_cam/supported_formats for list of supported formats 8 | av_device_format: "YUV422P" 9 | image_width: 640 10 | image_height: 480 11 | camera_name: "cam1" 12 | camera_info_url: "package://extrinsic_calibrator_examples/config/d435_intrinsics.yaml" 13 | brightness: -1 14 | contrast: -1 15 | saturation: -1 16 | sharpness: -1 17 | gain: -1 18 | auto_white_balance: true 19 | white_balance: 4000 20 | autoexposure: true 21 | exposure: 100 22 | autofocus: false 23 | focus: -1 -------------------------------------------------------------------------------- /extrinsic_calibrator_examples/config/d435_intrinsics.yaml: -------------------------------------------------------------------------------- 1 | image_width: 640 2 | image_height: 480 3 | camera_name: "cam1" 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [604.122802734375, 0.0, 327.40875244140625, 0.0, 603.847900390625, 244.95323181152344, 0.0, 0.0, 1.0] 8 | distortion_model: "plumb_bob" 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 5 12 | data: [0.0, 0.0, 0.0, 0.0, 0.0] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [604.122802734375, 0.0, 327.40875244140625, 0.0, 0.0, 603.847900390625, 244.95323181152344, 0.0, 0.0, 0.0, 1.0, 0.0] 21 | -------------------------------------------------------------------------------- /extrinsic_calibrator_examples/config/l515.yaml: -------------------------------------------------------------------------------- 1 | /**: 2 | ros__parameters: 3 | video_device: "/dev/video12" # "ffplay /dev/video12" to test 4 | framerate: 6.0 5 | io_method: "mmap" 6 | frame_id: "cam2_frame" 7 | pixel_format: "yuyv" # see usb_cam/supported_formats for list of supported formats 8 | av_device_format: "YUV422P" 9 | image_width: 640 10 | image_height: 480 11 | camera_name: "cam2" 12 | camera_info_url: "package://extrinsic_calibrator_examples/config/l515_intrinsics.yaml" 13 | brightness: -1 14 | contrast: -1 15 | saturation: -1 16 | sharpness: -1 17 | gain: -1 18 | auto_white_balance: true 19 | white_balance: 4000 20 | autoexposure: true 21 | exposure: 100 22 | autofocus: false 23 | focus: -1 -------------------------------------------------------------------------------- /extrinsic_calibrator_examples/config/l515_intrinsics.yaml: -------------------------------------------------------------------------------- 1 | image_width: 640 2 | image_height: 480 3 | camera_name: "cam2" 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [607.4058837890625, 0.0, 325.59991455078125, 0.0, 607.5341186523438, 247.25904846191406, 0.0, 0.0, 1.0] 8 | distortion_model: "plumb_bob" 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 5 12 | data: [0.19551624357700348, -0.5865326523780823, -0.002620677463710308, 0.0008374004391953349, 0.5133219957351685] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [607.4058837890625, 0.0, 325.59991455078125, 0.0, 0.0, 607.5341186523438, 247.25904846191406, 0.0, 0.0, 0.0, 1.0, 0.0] 21 | -------------------------------------------------------------------------------- /extrinsic_calibrator_examples/extrinsic_calibrator_examples/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ikerlan-KER/extrinsic_calibrator/b616219dba9cf19e74d55e8d334ad09eb0aa153e/extrinsic_calibrator_examples/extrinsic_calibrator_examples/__init__.py -------------------------------------------------------------------------------- /extrinsic_calibrator_examples/launch/launch_extrinsic_calibrator.launch.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # This file is part of **extrinsic-calibrator: 3 | # October 2024 4 | # Copyright 2024 IKERLAN. All Rights Reserved. 5 | # 6 | # 7 | # LICENSE NOTICE 8 | # 9 | # This software is available under a dual license system. Choose between: 10 | # - GNU Affero General Public License v3.0 for open-source usage, or 11 | # - A commercial license for proprietary development. 12 | # For commercial license details, contact us at info@ikerlan.es. 13 | # 14 | # GNU Affero General Public License v3.0 15 | # Version 3, 19 November 2007 16 | # © 2007 Free Software Foundation, Inc. 17 | # 18 | # Licensed under a dual license system: 19 | # 1. Open-source usage under the GNU Affero General Public License v3.0 20 | # (AGPL-3.0), allowing you to freely use, modify, and distribute the 21 | # software for open-source projects. You can find a copy of the AGPL-3.0 22 | # license at https://www.gnu.org/licenses/agpl-3.0.html. 23 | # 2. For commercial/proprietary use, a separate commercial license is required. 24 | # Please contact us at info@ikerlan.es for inquiries about our commercial 25 | # licensing options. 26 | # 27 | # This program is free software: you can redistribute it and/or modify 28 | # it under the terms of the GNU Affero General Public License as published by 29 | # the Free Software Foundation, either version 3 of the License, or 30 | # (at your option) any later version. 31 | # 32 | # This program is distributed in the hope that it will be useful, 33 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | # GNU Affero General Public License for more details. 36 | # 37 | # You should have received a copy of the GNU Affero General Public License 38 | # along with this program. If not, see . 39 | # 40 | # Author Information: 41 | # Author: Josep Rueda Collell 42 | # Created: October 2024 43 | # Affiliation: IKERLAN (https://www.ikerlan.es) 44 | # ------------------------------------------------------------------------------ 45 | 46 | from launch import LaunchDescription 47 | from launch.actions import IncludeLaunchDescription 48 | from launch.launch_description_sources import PythonLaunchDescriptionSource 49 | from launch_ros.actions import Node 50 | from launch_ros.substitutions import FindPackageShare 51 | from launch.substitutions import PathJoinSubstitution 52 | from launch.substitutions import PathJoinSubstitution 53 | 54 | 55 | def generate_launch_description(): 56 | return LaunchDescription([ 57 | # Launch the extrinsic calibrator node. The config file is in the config folder and is passed to the node using the generate_parameter_library 58 | Node( 59 | package='extrinsic_calibrator_core', 60 | executable='extrinsic_calibrator_node.py', 61 | name='extrinsic_calibrator_node', 62 | output='screen', 63 | ), 64 | 65 | # Laucnh the set of usb-cameras with their own config_files 66 | IncludeLaunchDescription( 67 | PythonLaunchDescriptionSource(PathJoinSubstitution([ 68 | FindPackageShare("extrinsic_calibrator_examples"), 69 | "launch", 70 | "launch_usb_cameras.launch.py"])) 71 | ), 72 | 73 | # Laucnh the rviz visualizer with the TF of the map and the cameras 74 | IncludeLaunchDescription( 75 | PythonLaunchDescriptionSource(PathJoinSubstitution([ 76 | FindPackageShare("extrinsic_calibrator_examples"), 77 | "launch", 78 | "launch_rviz.launch.py"])) 79 | ), 80 | ]) 81 | -------------------------------------------------------------------------------- /extrinsic_calibrator_examples/launch/launch_rviz.launch.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # This file is part of **extrinsic-calibrator: 3 | # October 2024 4 | # Copyright 2024 IKERLAN. All Rights Reserved. 5 | # 6 | # 7 | # LICENSE NOTICE 8 | # 9 | # This software is available under a dual license system. Choose between: 10 | # - GNU Affero General Public License v3.0 for open-source usage, or 11 | # - A commercial license for proprietary development. 12 | # For commercial license details, contact us at info@ikerlan.es. 13 | # 14 | # GNU Affero General Public License v3.0 15 | # Version 3, 19 November 2007 16 | # © 2007 Free Software Foundation, Inc. 17 | # 18 | # Licensed under a dual license system: 19 | # 1. Open-source usage under the GNU Affero General Public License v3.0 20 | # (AGPL-3.0), allowing you to freely use, modify, and distribute the 21 | # software for open-source projects. You can find a copy of the AGPL-3.0 22 | # license at https://www.gnu.org/licenses/agpl-3.0.html. 23 | # 2. For commercial/proprietary use, a separate commercial license is required. 24 | # Please contact us at info@ikerlan.es for inquiries about our commercial 25 | # licensing options. 26 | # 27 | # This program is free software: you can redistribute it and/or modify 28 | # it under the terms of the GNU Affero General Public License as published by 29 | # the Free Software Foundation, either version 3 of the License, or 30 | # (at your option) any later version. 31 | # 32 | # This program is distributed in the hope that it will be useful, 33 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | # GNU Affero General Public License for more details. 36 | # 37 | # You should have received a copy of the GNU Affero General Public License 38 | # along with this program. If not, see . 39 | # 40 | # Author Information: 41 | # Author: Josep Rueda Collell 42 | # Created: October 2024 43 | # Affiliation: IKERLAN (https://www.ikerlan.es) 44 | # ------------------------------------------------------------------------------ 45 | 46 | import os 47 | from ament_index_python.packages import get_package_share_directory 48 | from launch import LaunchDescription 49 | from launch_ros.actions import Node 50 | 51 | 52 | def generate_launch_description(): 53 | package_name = 'extrinsic_calibrator_examples' 54 | rviz_dir = os.path.join(get_package_share_directory(package_name), 'rviz') 55 | 56 | rviz_config = os.path.join(rviz_dir, 'extrinsic.rviz') 57 | 58 | return LaunchDescription([ 59 | Node( 60 | package='rviz2', 61 | executable='rviz2', 62 | name='rviz2', 63 | arguments=['-d', rviz_config], 64 | output='screen' 65 | ), 66 | 67 | ]) 68 | -------------------------------------------------------------------------------- /extrinsic_calibrator_examples/launch/launch_usb_cameras.launch.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # This file is part of **extrinsic-calibrator: 3 | # October 2024 4 | # Copyright 2024 IKERLAN. All Rights Reserved. 5 | # 6 | # 7 | # LICENSE NOTICE 8 | # 9 | # This software is available under a dual license system. Choose between: 10 | # - GNU Affero General Public License v3.0 for open-source usage, or 11 | # - A commercial license for proprietary development. 12 | # For commercial license details, contact us at info@ikerlan.es. 13 | # 14 | # GNU Affero General Public License v3.0 15 | # Version 3, 19 November 2007 16 | # © 2007 Free Software Foundation, Inc. 17 | # 18 | # Licensed under a dual license system: 19 | # 1. Open-source usage under the GNU Affero General Public License v3.0 20 | # (AGPL-3.0), allowing you to freely use, modify, and distribute the 21 | # software for open-source projects. You can find a copy of the AGPL-3.0 22 | # license at https://www.gnu.org/licenses/agpl-3.0.html. 23 | # 2. For commercial/proprietary use, a separate commercial license is required. 24 | # Please contact us at info@ikerlan.es for inquiries about our commercial 25 | # licensing options. 26 | # 27 | # This program is free software: you can redistribute it and/or modify 28 | # it under the terms of the GNU Affero General Public License as published by 29 | # the Free Software Foundation, either version 3 of the License, or 30 | # (at your option) any later version. 31 | # 32 | # This program is distributed in the hope that it will be useful, 33 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | # GNU Affero General Public License for more details. 36 | # 37 | # You should have received a copy of the GNU Affero General Public License 38 | # along with this program. If not, see . 39 | # 40 | # Author Information: 41 | # Author: Josep Rueda Collell 42 | # Created: October 2024 43 | # Affiliation: IKERLAN (https://www.ikerlan.es) 44 | # ------------------------------------------------------------------------------ 45 | 46 | import os 47 | from ament_index_python.packages import get_package_share_directory 48 | from launch import LaunchDescription 49 | from launch_ros.actions import Node 50 | 51 | 52 | def generate_launch_description(): 53 | package_name = 'extrinsic_calibrator_examples' 54 | config_dir = os.path.join(get_package_share_directory(package_name), 'config') 55 | 56 | d435_config = os.path.join(config_dir, 'd435.yaml') 57 | l515_config = os.path.join(config_dir, 'l515.yaml') 58 | 59 | return LaunchDescription([ 60 | Node( 61 | package='usb_cam', 62 | executable='usb_cam_node_exe', 63 | name='d435_camera', 64 | namespace='camera_1', 65 | parameters=[d435_config], 66 | output='screen' 67 | ), 68 | Node( 69 | package='usb_cam', 70 | executable='usb_cam_node_exe', 71 | name='l515_camera', 72 | namespace='camera_2', 73 | parameters=[l515_config], 74 | output='screen' 75 | ) 76 | ]) 77 | -------------------------------------------------------------------------------- /extrinsic_calibrator_examples/license.md: -------------------------------------------------------------------------------- 1 | # IKERLAN, S. COOP 2 | This file is part of **extrinsic-calibrator: humble** 3 | October 2024 4 | 5 | # LICENSE NOTICE 6 | 7 | This software has been liberated under a dual license system, on which you can choose between the open-source GNU Affero General Public License v3 in the case you are interested in using this software for an open-source development, or a commercial license in the case you are interested in using this software for a privative development. If you want to know more about our commercial license, please contact us in info@ikerlan.es. 8 | 9 | # GNU AFFERO GENERAL PUBLIC LICENSE 10 | Version 3, 19 November 2007 11 | Copyright © 2007 Free Software Foundation, Inc. 12 | Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 13 | Preamble 14 | The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. 15 | The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. 16 | When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. 17 | Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. 18 | A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. 19 | The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. 20 | An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. 21 | The precise terms and conditions for copying, distribution and modification follow. 22 | TERMS AND CONDITIONS 23 | 0. Definitions. 24 | "This License" refers to version 3 of the GNU Affero General Public License. 25 | "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. 26 | "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. 27 | To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. 28 | A "covered work" means either the unmodified Program or a work based on the Program. 29 | To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. 30 | To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. 31 | An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 32 | 1. Source Code. 33 | The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. 34 | A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. 35 | The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. 36 | The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. 37 | The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. 38 | The Corresponding Source for a work in source code form is that same work. 39 | 2. Basic Permissions. 40 | All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. 41 | You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. 42 | Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 43 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 44 | No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. 45 | When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 46 | 4. Conveying Verbatim Copies. 47 | You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. 48 | You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 49 | 5. Conveying Modified Source Versions. 50 | You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: 51 | • a) The work must carry prominent notices stating that you modified it, and giving a relevant date. 52 | • b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". 53 | • c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. 54 | • d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. 55 | A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 56 | 6. Conveying Non-Source Forms. 57 | You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: 58 | • a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. 59 | • b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. 60 | • c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. 61 | • d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. 62 | • e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. 63 | A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. 64 | A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. 65 | "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. 66 | If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). 67 | The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. 68 | Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 69 | 7. Additional Terms. 70 | "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. 71 | When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. 72 | Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: 73 | • a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or 74 | • b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or 75 | • c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or 76 | • d) Limiting the use for publicity purposes of names of licensors or authors of the material; or 77 | • e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or 78 | • f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. 79 | All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. 80 | If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. 81 | Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 82 | 8. Termination. 83 | You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). 84 | However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. 85 | Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. 86 | Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 87 | 9. Acceptance Not Required for Having Copies. 88 | You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 89 | 10. Automatic Licensing of Downstream Recipients. 90 | Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. 91 | An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. 92 | You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 93 | 11. Patents. 94 | A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". 95 | A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. 96 | Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. 97 | In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. 98 | If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. 99 | If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. 100 | A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. 101 | Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 102 | 12. No Surrender of Others' Freedom. 103 | If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 104 | 13. Remote Network Interaction; Use with the GNU General Public License. 105 | Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. 106 | Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 107 | 14. Revised Versions of this License. 108 | The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. 109 | Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. 110 | If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. 111 | Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 112 | 15. Disclaimer of Warranty. 113 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 114 | 16. Limitation of Liability. 115 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 116 | 17. Interpretation of Sections 15 and 16. 117 | If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. 118 | END OF TERMS AND CONDITIONS 119 | How to Apply These Terms to Your New Programs 120 | If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. 121 | To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. 122 | 123 | Copyright (C) 124 | 125 | This program is free software: you can redistribute it and/or modify 126 | it under the terms of the GNU Affero General Public License as 127 | published by the Free Software Foundation, either version 3 of the 128 | License, or (at your option) any later version. 129 | 130 | This program is distributed in the hope that it will be useful, 131 | but WITHOUT ANY WARRANTY; without even the implied warranty of 132 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 133 | GNU Affero General Public License for more details. 134 | 135 | You should have received a copy of the GNU Affero General Public License 136 | along with this program. If not, see . 137 | Also add information on how to contact you by electronic and paper mail. 138 | If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. 139 | You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . 140 | 141 | -------------------------------------------------------------------------------- /extrinsic_calibrator_examples/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | extrinsic_calibrator_examples 5 | 0.1.0 6 | ROS2 package designed to provide examples on how to use the extrinsic_calibrator_core package as well as useful ros2 launch files to launch the cameras, the calibrator, as well as a demonstration rviz file. 7 | Josep Rueda Collell 8 | Ander Gonzalez 9 | AGPL-3.0-only 10 | 11 | ament_cmake 12 | ament_cmake_python 13 | 14 | rclcpp 15 | rclpy 16 | cv_bridge 17 | extrinsic_calibrator_core 18 | rviz2 19 | sensor_msgs 20 | std_msgs 21 | tf2_ros 22 | tf_transformations 23 | usb_cam 24 | 25 | rosidl_default_generators 26 | 27 | rosidl_default_runtime 28 | 29 | rosidl_interface_packages 30 | 31 | ament_lint_auto 32 | ament_lint_common 33 | 34 | 35 | ament_cmake 36 | 37 | 38 | -------------------------------------------------------------------------------- /extrinsic_calibrator_examples/rviz/extrinsic.rviz: -------------------------------------------------------------------------------- 1 | Panels: 2 | - Class: rviz_common/Displays 3 | Help Height: 78 4 | Name: Displays 5 | Property Tree Widget: 6 | Expanded: 7 | - /Global Options1 8 | - /Status1 9 | - /Image1 10 | - /Image2 11 | - /TF1 12 | - /TF1/Frames1 13 | - /TF1/Tree1 14 | Splitter Ratio: 0.6382352709770203 15 | Tree Height: 88 16 | - Class: rviz_common/Selection 17 | Name: Selection 18 | - Class: rviz_common/Tool Properties 19 | Expanded: 20 | - /2D Goal Pose1 21 | - /Publish Point1 22 | Name: Tool Properties 23 | Splitter Ratio: 0.5886790156364441 24 | - Class: rviz_common/Views 25 | Expanded: 26 | - /Current View1 27 | Name: Views 28 | Splitter Ratio: 0.5 29 | - Class: rviz_common/Time 30 | Experimental: false 31 | Name: Time 32 | SyncMode: 0 33 | SyncSource: "" 34 | Visualization Manager: 35 | Class: "" 36 | Displays: 37 | - Alpha: 0.5 38 | Cell Size: 1 39 | Class: rviz_default_plugins/Grid 40 | Color: 160; 160; 164 41 | Enabled: true 42 | Line Style: 43 | Line Width: 0.029999999329447746 44 | Value: Lines 45 | Name: Grid 46 | Normal Cell Count: 0 47 | Offset: 48 | X: 0 49 | Y: 0 50 | Z: 0 51 | Plane: XY 52 | Plane Cell Count: 10 53 | Reference Frame: 54 | Value: true 55 | - Class: rviz_default_plugins/Image 56 | Enabled: true 57 | Max Value: 1 58 | Median window: 5 59 | Min Value: 0 60 | Name: Image 61 | Normalize Range: true 62 | Topic: 63 | Depth: 5 64 | Durability Policy: Volatile 65 | History Policy: Keep Last 66 | Reliability Policy: Reliable 67 | Value: /camera_1/image_raw/detected_markers 68 | Value: true 69 | - Class: rviz_default_plugins/Image 70 | Enabled: true 71 | Max Value: 1 72 | Median window: 5 73 | Min Value: 0 74 | Name: Image 75 | Normalize Range: true 76 | Topic: 77 | Depth: 5 78 | Durability Policy: Volatile 79 | History Policy: Keep Last 80 | Reliability Policy: Reliable 81 | Value: /camera_2/image_raw/detected_markers 82 | Value: true 83 | - Class: rviz_default_plugins/TF 84 | Enabled: true 85 | Frame Timeout: 15 86 | Frames: 87 | All Enabled: false 88 | cam2: 89 | Value: true 90 | map: 91 | Value: true 92 | Marker Scale: 1 93 | Name: TF 94 | Show Arrows: true 95 | Show Axes: true 96 | Show Names: true 97 | Tree: 98 | map: 99 | cam2: 100 | {} 101 | Update Interval: 0 102 | Value: true 103 | Enabled: true 104 | Global Options: 105 | Background Color: 48; 48; 48 106 | Fixed Frame: map 107 | Frame Rate: 30 108 | Name: root 109 | Tools: 110 | - Class: rviz_default_plugins/Interact 111 | Hide Inactive Objects: true 112 | - Class: rviz_default_plugins/MoveCamera 113 | - Class: rviz_default_plugins/Select 114 | - Class: rviz_default_plugins/FocusCamera 115 | - Class: rviz_default_plugins/Measure 116 | Line color: 128; 128; 0 117 | - Class: rviz_default_plugins/SetInitialPose 118 | Covariance x: 0.25 119 | Covariance y: 0.25 120 | Covariance yaw: 0.06853891909122467 121 | Topic: 122 | Depth: 5 123 | Durability Policy: Volatile 124 | History Policy: Keep Last 125 | Reliability Policy: Reliable 126 | Value: /initialpose 127 | - Class: rviz_default_plugins/SetGoal 128 | Topic: 129 | Depth: 5 130 | Durability Policy: Volatile 131 | History Policy: Keep Last 132 | Reliability Policy: Reliable 133 | Value: /goal_pose 134 | - Class: rviz_default_plugins/PublishPoint 135 | Single click: true 136 | Topic: 137 | Depth: 5 138 | Durability Policy: Volatile 139 | History Policy: Keep Last 140 | Reliability Policy: Reliable 141 | Value: /clicked_point 142 | Transformation: 143 | Current: 144 | Class: rviz_default_plugins/TF 145 | Value: true 146 | Views: 147 | Current: 148 | Class: rviz_default_plugins/Orbit 149 | Distance: 4.191425800323486 150 | Enable Stereo Rendering: 151 | Stereo Eye Separation: 0.05999999865889549 152 | Stereo Focal Distance: 1 153 | Swap Stereo Eyes: false 154 | Value: false 155 | Focal Point: 156 | X: 0 157 | Y: 0 158 | Z: 0 159 | Focal Shape Fixed Size: true 160 | Focal Shape Size: 0.05000000074505806 161 | Invert Z Axis: false 162 | Name: Current View 163 | Near Clip Distance: 0.009999999776482582 164 | Pitch: 0.7203978896141052 165 | Target Frame: 166 | Value: Orbit (rviz) 167 | Yaw: 0.8403979539871216 168 | Saved: ~ 169 | Window Geometry: 170 | Displays: 171 | collapsed: false 172 | Height: 1007 173 | Hide Left Dock: false 174 | Hide Right Dock: false 175 | Image: 176 | collapsed: false 177 | QMainWindow State: 000000ff00000000fd00000004000000000000018300000355fc020000000cfb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b000000e1000000c700fffffffb0000000a0049006d00610067006501000001080000003b0000000000000000fb0000000a0049006d00610067006501000001490000001a0000000000000000fb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d0061006700650100000122000001330000002800fffffffb0000000a0049006d006100670065010000025b000001350000002800ffffff000000010000010f00000355fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003b00000355000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000007740000003efc0100000002fb0000000800540069006d00650100000000000007740000025300fffffffb0000000800540069006d00650100000000000004500000000000000000000004d60000035500000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 178 | Selection: 179 | collapsed: false 180 | Time: 181 | collapsed: false 182 | Tool Properties: 183 | collapsed: false 184 | Views: 185 | collapsed: false 186 | Width: 1908 187 | X: -32 188 | Y: -28 189 | -------------------------------------------------------------------------------- /extrinsic_calibrator_examples/scripts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ikerlan-KER/extrinsic_calibrator/b616219dba9cf19e74d55e8d334ad09eb0aa153e/extrinsic_calibrator_examples/scripts/__init__.py -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | # IKERLAN, S. COOP 2 | This file is part of **extrinsic-calibrator: humble** 3 | October 2024 4 | 5 | # LICENSE NOTICE 6 | 7 | This software has been liberated under a dual license system, on which you can choose between the open-source GNU Affero General Public License v3 in the case you are interested in using this software for an open-source development, or a commercial license in the case you are interested in using this software for a privative development. If you want to know more about our commercial license, please contact us in info@ikerlan.es. 8 | 9 | # GNU AFFERO GENERAL PUBLIC LICENSE 10 | Version 3, 19 November 2007 11 | Copyright © 2007 Free Software Foundation, Inc. 12 | Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 13 | Preamble 14 | The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. 15 | The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. 16 | When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. 17 | Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. 18 | A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. 19 | The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. 20 | An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. 21 | The precise terms and conditions for copying, distribution and modification follow. 22 | TERMS AND CONDITIONS 23 | 0. Definitions. 24 | "This License" refers to version 3 of the GNU Affero General Public License. 25 | "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. 26 | "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. 27 | To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. 28 | A "covered work" means either the unmodified Program or a work based on the Program. 29 | To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. 30 | To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. 31 | An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 32 | 1. Source Code. 33 | The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. 34 | A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. 35 | The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. 36 | The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. 37 | The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. 38 | The Corresponding Source for a work in source code form is that same work. 39 | 2. Basic Permissions. 40 | All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. 41 | You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. 42 | Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 43 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 44 | No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. 45 | When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 46 | 4. Conveying Verbatim Copies. 47 | You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. 48 | You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 49 | 5. Conveying Modified Source Versions. 50 | You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: 51 | • a) The work must carry prominent notices stating that you modified it, and giving a relevant date. 52 | • b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". 53 | • c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. 54 | • d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. 55 | A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 56 | 6. Conveying Non-Source Forms. 57 | You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: 58 | • a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. 59 | • b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. 60 | • c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. 61 | • d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. 62 | • e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. 63 | A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. 64 | A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. 65 | "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. 66 | If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). 67 | The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. 68 | Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 69 | 7. Additional Terms. 70 | "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. 71 | When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. 72 | Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: 73 | • a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or 74 | • b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or 75 | • c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or 76 | • d) Limiting the use for publicity purposes of names of licensors or authors of the material; or 77 | • e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or 78 | • f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. 79 | All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. 80 | If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. 81 | Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 82 | 8. Termination. 83 | You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). 84 | However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. 85 | Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. 86 | Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 87 | 9. Acceptance Not Required for Having Copies. 88 | You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 89 | 10. Automatic Licensing of Downstream Recipients. 90 | Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. 91 | An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. 92 | You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 93 | 11. Patents. 94 | A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". 95 | A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. 96 | Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. 97 | In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. 98 | If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. 99 | If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. 100 | A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. 101 | Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 102 | 12. No Surrender of Others' Freedom. 103 | If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 104 | 13. Remote Network Interaction; Use with the GNU General Public License. 105 | Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. 106 | Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 107 | 14. Revised Versions of this License. 108 | The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. 109 | Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. 110 | If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. 111 | Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 112 | 15. Disclaimer of Warranty. 113 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 114 | 16. Limitation of Liability. 115 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 116 | 17. Interpretation of Sections 15 and 16. 117 | If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. 118 | END OF TERMS AND CONDITIONS 119 | How to Apply These Terms to Your New Programs 120 | If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. 121 | To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. 122 | 123 | Copyright (C) 124 | 125 | This program is free software: you can redistribute it and/or modify 126 | it under the terms of the GNU Affero General Public License as 127 | published by the Free Software Foundation, either version 3 of the 128 | License, or (at your option) any later version. 129 | 130 | This program is distributed in the hope that it will be useful, 131 | but WITHOUT ANY WARRANTY; without even the implied warranty of 132 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 133 | GNU Affero General Public License for more details. 134 | 135 | You should have received a copy of the GNU Affero General Public License 136 | along with this program. If not, see . 137 | Also add information on how to contact you by electronic and paper mail. 138 | If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. 139 | You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . 140 | 141 | --------------------------------------------------------------------------------