├── imu_pipeline ├── CMakeLists.txt ├── package.xml └── CHANGELOG.rst ├── README.md ├── imu_transformer ├── launch │ └── ned_to_enu.launch.xml ├── package.xml ├── include │ └── imu_transformer │ │ ├── imu_transformer.hpp │ │ └── tf2_sensor_msgs.h ├── test │ ├── test_imu_transforms.launch.xml │ ├── test_imu_transforms.rviz │ └── test_imu_transforms.cpp ├── CMakeLists.txt ├── CHANGELOG.rst ├── src │ └── imu_transformer.cpp └── LICENSE └── imu_processors ├── package.xml ├── LICENSE ├── CMakeLists.txt ├── CHANGELOG.rst └── src ├── imu_integrator.cpp └── imu_bias_remover.cpp /imu_pipeline/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | project(imu_pipeline) 3 | 4 | find_package(ament_cmake REQUIRED) 5 | 6 | ament_package() 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | IMU Pipeline metapackage includes tools for processing and pre-processing IMU messages for easier use by later subscribers. 2 | 3 | Branches 4 | ======== 5 | 6 | * ``ros2`` - main branch, for ROS 2 Kilted and later 7 | * ``jazzy`` - supports ROS 2 Humble to Jazzy 8 | 9 | imu_transformer 10 | =============== 11 | 12 | Transforms sensor_msgs/Imu and sensor_msgs/MagneticField messages into new coordinate frames using tf2 13 | 14 | imu_processors 15 | ============== 16 | 17 | Includes misc preprocessors for IMU data: 18 | * imu_integrator: Simple planar imu integration tool. 19 | * imu_bias_remover: Tool to recalibrate imu bias based on /cmd_vel or /odom 20 | -------------------------------------------------------------------------------- /imu_transformer/launch/ned_to_enu.launch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /imu_pipeline/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | imu_pipeline 5 | 0.6.1 6 | imu_pipeline 7 | 8 | BSD 9 | GPL 10 | 11 | http://ros.org/wiki/imu_pipeline 12 | https://github.com/ros-perception/imu_pipeline/issues 13 | https://github.com/ros-perception/imu_pipeline 14 | 15 | Chad Rockey 16 | Paul Bovbel 17 | Tony Baltovski 18 | 19 | ament_cmake 20 | 21 | imu_processors 22 | imu_transformer 23 | 24 | 25 | ament_cmake 26 | 27 | 28 | -------------------------------------------------------------------------------- /imu_processors/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | imu_processors 4 | 0.6.1 5 | Processors for sensor_msgs::Imu data 6 | 7 | BSD 8 | 9 | http://ros.org/wiki/imu_processors 10 | https://github.com/ros-perception/imu_processors/issues 11 | https://github.com/ros-perception/imu_processors 12 | 13 | Chad Rockey 14 | Paul Bovbel 15 | Tony Baltovski 16 | Michael Ferguson 17 | 18 | ament_cmake 19 | 20 | geometry_msgs 21 | nav_msgs 22 | rclcpp 23 | rclcpp_components 24 | sensor_msgs 25 | tf2_ros 26 | 27 | ament_cmake_cpplint 28 | 29 | 30 | ament_cmake 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /imu_transformer/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | imu_transformer 4 | 0.6.1 5 | Node/components to transform sensor_msgs::Imu data from one frame into another. 6 | 7 | GPL 8 | 9 | http://ros.org/wiki/imu_transformer 10 | https://github.com/ros-perception/imu_transformer/issues 11 | https://github.com/ros-perception/imu_transformer 12 | 13 | Paul Bovbel 14 | Paul Bovbel 15 | Tony Baltovski 16 | Michael Ferguson 17 | 18 | ament_cmake 19 | 20 | message_filters 21 | rclcpp 22 | rclcpp_components 23 | sensor_msgs 24 | tf2_ros 25 | tf2_sensor_msgs 26 | 27 | geometry_msgs 28 | tf2_geometry_msgs 29 | ament_cmake_gtest 30 | 31 | 32 | ament_cmake 33 | 34 | 35 | -------------------------------------------------------------------------------- /imu_processors/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2013 Willow Garage 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /imu_pipeline/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package imu_pipeline 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 0.6.1 (2025-06-02) 6 | ------------------ 7 | 8 | 0.6.0 (2025-05-22) 9 | ------------------ 10 | 11 | 0.5.1 (2024-12-27) 12 | ------------------ 13 | 14 | 0.5.0 (2024-02-08) 15 | ------------------ 16 | 17 | 0.4.1 (2024-01-05) 18 | ------------------ 19 | 20 | 0.4.0 (2024-01-03) 21 | ------------------ 22 | * Initial ROS 2 release 23 | * Contributors: Michael Ferguson, Paul Auerbach, Tony Baltovski 24 | 25 | 0.3.1 (2022-11-22) 26 | ------------------ 27 | 28 | 0.3.0 (2020-06-04) 29 | ------------------ 30 | * Bump CMake version to avoid CMP0048 warning. 31 | * Updated to package.xml format 2. 32 | * Contributors: Tony Baltovski 33 | 34 | 0.2.3 (2019-01-30) 35 | ------------------ 36 | * Updated maintainers. 37 | * Contributors: Tony Baltovski 38 | 39 | 0.2.2 (2017-01-25) 40 | ------------------ 41 | 42 | 0.2.1 (2015-02-04) 43 | ------------------ 44 | 45 | 0.2.0 (2015-01-30) 46 | ------------------ 47 | * Remove Chad as a maintainer 48 | * Refactor imu_pipeline into a metapackage 49 | * Contributors: Paul Bovbel 50 | 51 | 0.1.3 (2014-03-30) 52 | ------------------ 53 | 54 | 0.1.1 (2013-07-29) 55 | ------------------ 56 | * Added tool to null out gyro bias based on cmd_vel or odom. 57 | * Merge branch 'hydro-devel' of https://github.com/ros-perception/imu_pipeline into hydro-devel 58 | * Added imu_integrator. 59 | * Merge pull request `#2 `_ from ros-perception/groovy-devel 60 | Updated packaged name to imu_pipeline 61 | * Updated packaged name to imu_pipeline 62 | * Catkinized, updated for Groovy. 63 | * Initial github commit 64 | * Initial commit 65 | -------------------------------------------------------------------------------- /imu_transformer/include/imu_transformer/imu_transformer.hpp: -------------------------------------------------------------------------------- 1 | #ifndef IMU_TRANSFORMER_IMU_TRANSFORMER_HPP 2 | #define IMU_TRANSFORMER_IMU_TRANSFORMER_HPP 3 | 4 | #include "rclcpp/rclcpp.hpp" 5 | #include "tf2_ros/buffer.h" 6 | #include "tf2_ros/create_timer_ros.h" 7 | #include "tf2_ros/transform_listener.h" 8 | #include "tf2_ros/message_filter.h" 9 | #include "sensor_msgs/msg/imu.hpp" 10 | #include "sensor_msgs/msg/magnetic_field.hpp" 11 | #include "message_filters/subscriber.hpp" 12 | 13 | #include 14 | 15 | namespace imu_transformer 16 | { 17 | typedef sensor_msgs::msg::Imu ImuMsg; 18 | typedef sensor_msgs::msg::MagneticField MagMsg; 19 | typedef message_filters::Subscriber ImuSubscriber; 20 | typedef message_filters::Subscriber MagSubscriber; 21 | typedef tf2_ros::MessageFilter ImuFilter; 22 | typedef tf2_ros::MessageFilter MagFilter; 23 | 24 | class ImuTransformer : public rclcpp::Node 25 | { 26 | 27 | public: 28 | explicit ImuTransformer(const rclcpp::NodeOptions &); 29 | ~ImuTransformer(); 30 | 31 | private: 32 | 33 | std::string target_frame_; 34 | 35 | std::unique_ptr tf2_buffer_; 36 | std::unique_ptr tf2_listener_; 37 | 38 | ImuSubscriber imu_sub_; 39 | MagSubscriber mag_sub_; 40 | 41 | std::shared_ptr imu_filter_; 42 | std::shared_ptr mag_filter_; 43 | 44 | rclcpp::Publisher::SharedPtr imu_pub_; 45 | rclcpp::Publisher::SharedPtr mag_pub_; 46 | 47 | void imuCallback(const ImuMsg::SharedPtr &imu_in); 48 | void magCallback(const MagMsg::SharedPtr &msg); 49 | void failureCb(tf2_ros::filter_failure_reasons::FilterFailureReason reason); 50 | 51 | }; 52 | 53 | } // namespace imu_transformer 54 | 55 | #endif // IMU_TRANSFORMER_IMU_TRANSFORMER_HPP 56 | -------------------------------------------------------------------------------- /imu_transformer/test/test_imu_transforms.launch.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /imu_processors/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | project(imu_processors) 3 | 4 | # Default to C++14 5 | if(NOT CMAKE_CXX_STANDARD) 6 | set(CMAKE_CXX_STANDARD 14) 7 | endif() 8 | 9 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") 10 | add_compile_options(-Wall -Wextra -Wpedantic) 11 | endif() 12 | 13 | find_package(ament_cmake REQUIRED) 14 | find_package(geometry_msgs REQUIRED) 15 | find_package(nav_msgs REQUIRED) 16 | find_package(rclcpp REQUIRED) 17 | find_package(rclcpp_components REQUIRED) 18 | find_package(sensor_msgs REQUIRED) 19 | find_package(tf2_ros REQUIRED) 20 | 21 | add_library(imu_integrator SHARED 22 | src/imu_integrator.cpp 23 | ) 24 | target_link_libraries(imu_integrator PUBLIC 25 | ${sensor_msgs_TARGETS} 26 | rclcpp::rclcpp 27 | rclcpp_components::component 28 | rclcpp_components::component_manager 29 | sensor_msgs::sensor_msgs_library 30 | ) 31 | rclcpp_components_register_node(imu_integrator 32 | PLUGIN "imu_processors::ImuIntegrator" 33 | EXECUTABLE imu_integrator_node 34 | ) 35 | 36 | add_library(imu_bias_remover SHARED 37 | src/imu_bias_remover.cpp 38 | ) 39 | target_link_libraries(imu_bias_remover PUBLIC 40 | ${geometry_msgs_TARGETS} 41 | ${nav_msgs_TARGETS} 42 | ${sensor_msgs_TARGETS} 43 | rclcpp::rclcpp 44 | rclcpp_components::component 45 | rclcpp_components::component_manager 46 | sensor_msgs::sensor_msgs_library 47 | ) 48 | rclcpp_components_register_node(imu_bias_remover 49 | PLUGIN "imu_processors::ImuBiasRemover" 50 | EXECUTABLE imu_bias_remover_node 51 | ) 52 | 53 | if (BUILD_TESTING) 54 | find_package(ament_cmake_cpplint) 55 | ament_cpplint() 56 | endif() 57 | 58 | install( 59 | TARGETS 60 | imu_bias_remover 61 | imu_integrator 62 | ARCHIVE DESTINATION lib 63 | LIBRARY DESTINATION lib 64 | RUNTIME DESTINATION lib/${PROJECT_NAME} 65 | ) 66 | 67 | ament_export_libraries( 68 | imu_bias_remover 69 | imu_integrator 70 | ) 71 | ament_package() 72 | -------------------------------------------------------------------------------- /imu_transformer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | project(imu_transformer) 3 | 4 | # Default to C++14 5 | if(NOT CMAKE_CXX_STANDARD) 6 | set(CMAKE_CXX_STANDARD 14) 7 | endif() 8 | 9 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") 10 | add_compile_options(-Wall -Wextra -Wpedantic) 11 | endif() 12 | 13 | find_package(ament_cmake REQUIRED) 14 | find_package(message_filters REQUIRED) 15 | find_package(rclcpp REQUIRED) 16 | find_package(rclcpp_components REQUIRED) 17 | find_package(sensor_msgs REQUIRED) 18 | find_package(tf2 REQUIRED) 19 | find_package(tf2_ros REQUIRED) 20 | find_package(tf2_sensor_msgs REQUIRED) 21 | 22 | include_directories( 23 | include 24 | ) 25 | 26 | add_library(imu_transformer SHARED 27 | src/imu_transformer.cpp 28 | ) 29 | target_link_libraries(imu_transformer PUBLIC 30 | ${sensor_msgs_TARGETS} 31 | message_filters::message_filters 32 | rclcpp::rclcpp 33 | rclcpp_components::component 34 | tf2::tf2 35 | tf2_ros::tf2_ros 36 | tf2_sensor_msgs::tf2_sensor_msgs 37 | ) 38 | rclcpp_components_register_node(imu_transformer 39 | PLUGIN "imu_transformer::ImuTransformer" 40 | EXECUTABLE imu_transformer_node 41 | ) 42 | 43 | if(BUILD_TESTING) 44 | find_package(geometry_msgs REQUIRED) 45 | find_package(tf2_geometry_msgs REQUIRED) 46 | find_package(ament_cmake_gtest REQUIRED) 47 | 48 | ament_add_gtest(test_imu_transforms test/test_imu_transforms.cpp) 49 | target_link_libraries(test_imu_transforms 50 | ${geometry_msgs_TARGETS} 51 | ${sensor_msgs_TARGETS} 52 | tf2::tf2 53 | tf2_ros::tf2_ros 54 | tf2_geometry_msgs::tf2_geometry_msgs 55 | tf2_sensor_msgs::tf2_sensor_msgs 56 | ) 57 | endif() 58 | 59 | install( 60 | TARGETS imu_transformer 61 | EXPORT ${PROJECT_NAME}_export 62 | LIBRARY DESTINATION lib 63 | RUNTIME DESTINATION lib/${PROJECT_NAME} 64 | ) 65 | 66 | install( 67 | DIRECTORY include/ 68 | DESTINATION include 69 | ) 70 | 71 | install( 72 | DIRECTORY launch 73 | DESTINATION share/${PROJECT_NAME} 74 | ) 75 | 76 | ament_export_targets(${PROJECT_NAME}_export HAS_LIBRARY_TARGET) 77 | ament_export_dependencies( 78 | message_filters 79 | rclcpp 80 | rclcpp_components 81 | sensor_msgs 82 | tf2 83 | tf2_ros 84 | tf2_sensor_msgs 85 | ) 86 | 87 | ament_package() 88 | -------------------------------------------------------------------------------- /imu_processors/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package imu_processors 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 0.6.1 (2025-06-02) 6 | ------------------ 7 | * set use_stamped to default true for kilted and later (`#32 `_) 8 | * Add use_stamped parameter to bias remover (`#30 `_) 9 | Adds `use_stamped` parameter (default is `false`) to bias remover node 10 | * Contributors: Michael Ferguson, Tatsuro Sakaguchi 11 | 12 | 0.6.0 (2025-05-22) 13 | ------------------ 14 | * [kilted] Update deprecated call to ament_target_dependencies (`#26 `_) 15 | As of the ROS 2 Kilted release [`ament_target_dependencies` is 16 | deprecated.](https://docs.ros.org/en/kilted/Releases/Release-Kilted-Kaiju.html#ament-target-dependencies-is-deprecated) 17 | This PR updates the syntax. Caution should be used to ensure that the 18 | target branch is not used for other ROS 2 distros. 19 | Note: This PR was generated by a bot script, but using the simple 20 | pattern matching of the 21 | [`ros_glint`](https://github.com/MetroRobots/ros_glint) library. No LLMs 22 | were used. 23 | * Contributors: David V. Lu!! 24 | 25 | 0.5.1 (2024-12-27) 26 | ------------------ 27 | 28 | 0.5.0 (2024-02-08) 29 | ------------------ 30 | 31 | 0.4.1 (2024-01-05) 32 | ------------------ 33 | * update dependency tf->tf2_ros (`#22 `_) 34 | found this when trying to do first release... 35 | * Contributors: Michael Ferguson 36 | 37 | 0.4.0 (2024-01-03) 38 | ------------------ 39 | * Initial ROS 2 release 40 | * Contributors: Michael Ferguson, Paul Auerbach, Tony Baltovski 41 | 42 | 0.3.1 (2022-11-22) 43 | ------------------ 44 | 45 | 0.3.0 (2020-06-04) 46 | ------------------ 47 | * Bump CMake version to avoid CMP0048 warning. 48 | * Updated to package.xml format 2. 49 | * Contributors: Tony Baltovski 50 | 51 | 0.2.3 (2019-01-30) 52 | ------------------ 53 | * Updated maintainers. 54 | * Contributors: Tony Baltovski 55 | 56 | 0.2.2 (2017-01-25) 57 | ------------------ 58 | 59 | 0.2.1 (2015-02-04) 60 | ------------------ 61 | 62 | 0.2.0 (2015-01-30) 63 | ------------------ 64 | * Move misc processors into imu_processors 65 | * Contributors: Paul Bovbel 66 | 67 | 0.1.1 (2013-07-29) 68 | ------------------ 69 | * Added tool to null out gyro bias based on cmd_vel or odom. 70 | * Merge branch 'hydro-devel' of https://github.com/ros-perception/imu_pipeline into hydro-devel 71 | * Added imu_integrator. 72 | * Merge pull request `#2 `_ from ros-perception/groovy-devel 73 | Updated packaged name to imu_pipeline 74 | * Updated packaged name to imu_pipeline 75 | * Catkinized, updated for Groovy. 76 | * Initial github commit 77 | * Initial commit 78 | -------------------------------------------------------------------------------- /imu_transformer/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package imu_transformer 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 0.6.1 (2025-06-02) 6 | ------------------ 7 | * add depend on ament_cmake_gtest (`#28 `_) 8 | Debian is building, but test job is still failing 9 | * Contributors: Michael Ferguson 10 | 11 | 0.6.0 (2025-05-22) 12 | ------------------ 13 | * handle deprecations on rolling (`#27 `_) 14 | * [kilted] Update deprecated call to ament_target_dependencies (`#26 `_) 15 | As of the ROS 2 Kilted release [`ament_target_dependencies` is 16 | deprecated.](https://docs.ros.org/en/kilted/Releases/Release-Kilted-Kaiju.html#ament-target-dependencies-is-deprecated) 17 | This PR updates the syntax. Caution should be used to ensure that the 18 | target branch is not used for other ROS 2 distros. 19 | Note: This PR was generated by a bot script, but using the simple 20 | pattern matching of the 21 | [`ros_glint`](https://github.com/MetroRobots/ros_glint) library. No LLMs 22 | were used. 23 | * Contributors: David V. Lu!!, Michael Ferguson 24 | 25 | 0.5.1 (2024-12-27) 26 | ------------------ 27 | * Deprecate c headers (`#25 `_) 28 | Related to this [pull 29 | request](https://github.com/ros2/geometry2/pull/720) in `geometry2` in 30 | which we deprecated the `.h` style headers in favor of `.hpp`. 31 | --------- 32 | * Contributors: Lucas Wendland 33 | 34 | 0.5.0 (2024-02-08) 35 | ------------------ 36 | * update header to remove deprecation warning (`#23 `_) 37 | * Contributors: Michael Ferguson 38 | 39 | 0.4.1 (2024-01-05) 40 | ------------------ 41 | 42 | 0.4.0 (2024-01-03) 43 | ------------------ 44 | * Initial ROS 2 release 45 | * Contributors: Michael Ferguson, Paul Auerbach, Tony Baltovski 46 | 47 | 0.3.1 (2022-11-22) 48 | ------------------ 49 | * imu_transformer: Fix transformation of the orientation of IMU. 50 | The previous computation was wrong. According to REP-145, IMU orientation should express attitude of the sensor frame in a world frame. imu_transformer changes the sensor frame, so it should just recompute the new attitude by transforming the old sensor frame into the new one. 51 | * Contributors: Martin Pecka 52 | 53 | 0.3.0 (2020-06-04) 54 | ------------------ 55 | * Bump CMake version to avoid CMP0048 warning. 56 | * Updated to package.xml format 2. 57 | * Contributors: Tony Baltovski 58 | 59 | 0.2.3 (2019-01-30) 60 | ------------------ 61 | * update to use non deprecated pluginlib macro 62 | * Updated maintainers. 63 | * Contributors: Mikael Arguedas, Tony Baltovski 64 | 65 | 0.2.2 (2017-01-25) 66 | ------------------ 67 | * imu_transformer: Fix build with CATKIN_ENABLE_TESTIING=OFF 68 | * Contributors: Alexis Ballier 69 | 70 | 0.2.1 (2015-02-04) 71 | ------------------ 72 | * Fix nodelet install 73 | * Contributors: Paul Bovbel 74 | 75 | 0.2.0 (2015-01-30) 76 | ------------------ 77 | * Add imu_transformer node/nodelet combination using tf2 78 | * Contributors: Paul Bovbel 79 | 80 | 0.1.3 (2014-03-30) 81 | ------------------ 82 | 83 | 0.1.2 (2013-08-21) 84 | ------------------ 85 | 86 | 0.1.1 (2013-07-29) 87 | ------------------ 88 | -------------------------------------------------------------------------------- /imu_transformer/src/imu_transformer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //#include "tf2_sensor_msgs/tf2_sensor_msgs.h" 4 | //Remove this header when https://github.com/ros/geometry_experimental/pull/78 is released 5 | #include "imu_transformer/tf2_sensor_msgs.h" 6 | 7 | namespace imu_transformer 8 | { 9 | 10 | ImuTransformer::ImuTransformer(const rclcpp::NodeOptions & options) 11 | : Node("imu_transformer", options){ 12 | 13 | tf2_buffer_ = std::make_unique(this->get_clock()); 14 | // Create the timer interface before call to waitForTransform, 15 | // to avoid a tf2_ros::CreateTimerInterfaceException exception 16 | auto timer_interface = std::make_shared( 17 | this->get_node_base_interface(), 18 | this->get_node_timers_interface()); 19 | tf2_buffer_->setCreateTimerInterface(timer_interface); 20 | tf2_listener_ = std::make_unique(*tf2_buffer_); 21 | 22 | target_frame_ = this->declare_parameter("target_frame", "base_link"); 23 | 24 | imu_pub_ = this->create_publisher("imu_out", 10); 25 | mag_pub_ = this->create_publisher("mag_out", 10); 26 | 27 | imu_sub_.subscribe(this, "imu_in", 10); 28 | 29 | std::chrono::duration buffer_timeout(1); 30 | 31 | imu_filter_ = std::make_shared(imu_sub_, *tf2_buffer_, target_frame_, 10, this->get_node_logging_interface(), this->get_node_clock_interface(), buffer_timeout); 32 | imu_filter_->registerCallback(&ImuTransformer::imuCallback, this); 33 | // function deactivated in foxy 34 | //imu_filter_->registerFailureCallback&ImuTransformer::failureCb, this); 35 | 36 | mag_sub_.subscribe(this, "mag_in", 10); 37 | mag_filter_ = std::make_shared(mag_sub_, *tf2_buffer_, target_frame_, 10, this->get_node_logging_interface(), this->get_node_clock_interface(), buffer_timeout); 38 | mag_filter_->registerCallback(&ImuTransformer::magCallback, this); 39 | // function deactivated in foxy 40 | //mag_filter_->registerFailureCallback&ImuTransformer::failureCb, this); 41 | } 42 | 43 | void ImuTransformer::imuCallback(const ImuMsg::SharedPtr &imu_in) 44 | { 45 | try 46 | { 47 | ImuMsg imu_out; 48 | tf2_buffer_->transform(*imu_in, imu_out, target_frame_); 49 | imu_pub_->publish(imu_out); 50 | } 51 | catch (const tf2::TransformException & ex) 52 | { 53 | RCLCPP_WARN( 54 | this->get_logger(), "IMU Transform failure %s\n", ex.what()); 55 | } 56 | } 57 | 58 | void ImuTransformer::magCallback(const MagMsg::SharedPtr &mag_in) 59 | { 60 | std::string error; 61 | try 62 | { 63 | MagMsg mag_out; 64 | tf2_buffer_->transform(*mag_in, mag_out, target_frame_); 65 | mag_pub_->publish(mag_out); 66 | return; 67 | } 68 | catch (const tf2::TransformException & ex) 69 | { 70 | RCLCPP_WARN( 71 | this->get_logger(), "IMU Transform failure %s\n", ex.what()); 72 | } 73 | 74 | } 75 | 76 | //void ImuTransformer::failureCb(tf2_ros::filter_failure_reasons::FilterFailureReason reason) 77 | //{ 78 | //RCLCPP_WARN( 79 | //this->get_logger(), "Can't transform incoming IMU data to " << target_frame_ << " " << 80 | //reason); 81 | //} 82 | 83 | ImuTransformer::~ImuTransformer() {} 84 | 85 | } 86 | 87 | #include 88 | RCLCPP_COMPONENTS_REGISTER_NODE(imu_transformer::ImuTransformer) 89 | -------------------------------------------------------------------------------- /imu_processors/src/imu_integrator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, Willow Garage, Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Willow Garage, Inc. nor the names of its 14 | * contributors may be used to endorse or promote products derived from 15 | * this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /* 31 | * Author: Chad Rockey 32 | */ 33 | 34 | #include 35 | #include 36 | 37 | namespace imu_processors 38 | { 39 | 40 | class ImuIntegrator : public rclcpp::Node 41 | { 42 | public: 43 | explicit ImuIntegrator(const rclcpp::NodeOptions & options) 44 | : rclcpp::Node("imu_integrator", options) 45 | { 46 | // Get parameters 47 | min_angular_velocity_ = this->declare_parameter("min_angular_velocity", 0.0); 48 | static_dt_ = this->declare_parameter("static_dt", 0.0); 49 | imu_.orientation.w = 1.0; 50 | 51 | // Create publisher 52 | pub_ = this->create_publisher("imu_integrated", 10); 53 | 54 | // Subscriber 55 | sub_ = this->create_subscription( 56 | "imu", rclcpp::SystemDefaultsQoS(), 57 | std::bind(&ImuIntegrator::callback, this, std::placeholders::_1)); 58 | } 59 | 60 | private: 61 | void callback(const sensor_msgs::msg::Imu::ConstSharedPtr & msg) 62 | { 63 | rclcpp::Time msg_time(msg->header.stamp); 64 | rclcpp::Time imu_time(imu_.header.stamp); 65 | double dt = msg_time.seconds() - imu_time.seconds(); 66 | if (imu_time.seconds() == 0) 67 | { 68 | dt = 0.0; 69 | } 70 | if (static_dt_ > 0.0001) 71 | { 72 | dt = static_dt_; 73 | } 74 | imu_.header = msg->header; 75 | imu_.angular_velocity = msg->angular_velocity; 76 | imu_.angular_velocity_covariance = msg->angular_velocity_covariance; 77 | imu_.linear_acceleration = msg->linear_acceleration; 78 | imu_.linear_acceleration_covariance = msg->linear_acceleration_covariance; 79 | 80 | double diff = pow(imu_.orientation.w, 2.0) - pow(imu_.orientation.z, 2.0); 81 | double mult = 2.0 * imu_.orientation.w * imu_.orientation.z; 82 | double theta = atan2(mult, diff); 83 | if (std::abs(imu_.angular_velocity.z) > min_angular_velocity_) 84 | { 85 | theta = theta + imu_.angular_velocity.z * dt; 86 | } 87 | 88 | // Fill in quaternion 89 | imu_.orientation.z = sin(theta / 2.0); 90 | imu_.orientation.w = cos(theta / 2.0); 91 | 92 | // Publish transformed message 93 | pub_->publish(imu_); 94 | } 95 | 96 | rclcpp::Publisher::SharedPtr pub_; 97 | rclcpp::Subscription::SharedPtr sub_; 98 | sensor_msgs::msg::Imu imu_; 99 | double min_angular_velocity_; 100 | double static_dt_; 101 | }; 102 | 103 | } // namespace imu_processors 104 | 105 | #include 106 | RCLCPP_COMPONENTS_REGISTER_NODE(imu_processors::ImuIntegrator) 107 | -------------------------------------------------------------------------------- /imu_transformer/test/test_imu_transforms.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 | - /TF1 10 | Splitter Ratio: 0.5 11 | Tree Height: 951 12 | - Class: rviz_common/Selection 13 | Name: Selection 14 | - Class: rviz_common/Tool Properties 15 | Expanded: 16 | - /2D Goal Pose1 17 | - /Publish Point1 18 | Name: Tool Properties 19 | Splitter Ratio: 0.5886790156364441 20 | - Class: rviz_common/Views 21 | Expanded: 22 | - /Current View1 23 | Name: Views 24 | Splitter Ratio: 0.5 25 | Visualization Manager: 26 | Class: "" 27 | Displays: 28 | - Alpha: 0.5 29 | Cell Size: 1 30 | Class: rviz_default_plugins/Grid 31 | Color: 160; 160; 164 32 | Enabled: true 33 | Line Style: 34 | Line Width: 0.029999999329447746 35 | Value: Lines 36 | Name: Grid 37 | Normal Cell Count: 0 38 | Offset: 39 | X: 0 40 | Y: 0 41 | Z: 0 42 | Plane: XY 43 | Plane Cell Count: 10 44 | Reference Frame: 45 | Value: true 46 | - Acceleration properties: 47 | Acc. vector alpha: 1 48 | Acc. vector color: 255; 0; 0 49 | Acc. vector scale: 1 50 | Derotate acceleration: true 51 | Enable acceleration: false 52 | Axes properties: 53 | Axes scale: 1 54 | Enable axes: true 55 | Box properties: 56 | Box alpha: 1 57 | Box color: 255; 0; 0 58 | Enable box: false 59 | x_scale: 1 60 | y_scale: 1 61 | z_scale: 1 62 | Class: rviz_imu_plugin/Imu 63 | Enabled: true 64 | Name: Imu In 65 | Topic: 66 | Depth: 5 67 | Durability Policy: Volatile 68 | History Policy: Keep Last 69 | Reliability Policy: Reliable 70 | Value: /imu_in 71 | Value: true 72 | fixed_frame_orientation: true 73 | - Acceleration properties: 74 | Acc. vector alpha: 1 75 | Acc. vector color: 255; 0; 0 76 | Acc. vector scale: 1 77 | Derotate acceleration: true 78 | Enable acceleration: false 79 | Axes properties: 80 | Axes scale: 1 81 | Enable axes: true 82 | Box properties: 83 | Box alpha: 1 84 | Box color: 255; 0; 0 85 | Enable box: false 86 | x_scale: 1 87 | y_scale: 1 88 | z_scale: 1 89 | Class: rviz_imu_plugin/Imu 90 | Enabled: true 91 | Name: Imu Out 92 | Topic: 93 | Depth: 5 94 | Durability Policy: Volatile 95 | History Policy: Keep Last 96 | Reliability Policy: Reliable 97 | Value: /imu_out 98 | Value: true 99 | fixed_frame_orientation: true 100 | - Class: rviz_default_plugins/TF 101 | Enabled: true 102 | Frame Timeout: 15 103 | Frames: 104 | All Enabled: true 105 | imu_link: 106 | Value: true 107 | imu_link_ned: 108 | Value: true 109 | world: 110 | Value: true 111 | Marker Scale: 1 112 | Name: TF 113 | Show Arrows: true 114 | Show Axes: true 115 | Show Names: true 116 | Tree: 117 | world: 118 | imu_link: 119 | imu_link_ned: 120 | {} 121 | Update Interval: 0 122 | Value: true 123 | Enabled: true 124 | Global Options: 125 | Background Color: 48; 48; 48 126 | Fixed Frame: world 127 | Frame Rate: 30 128 | Name: root 129 | Tools: 130 | - Class: rviz_default_plugins/Interact 131 | Hide Inactive Objects: true 132 | - Class: rviz_default_plugins/MoveCamera 133 | - Class: rviz_default_plugins/Select 134 | - Class: rviz_default_plugins/FocusCamera 135 | - Class: rviz_default_plugins/Measure 136 | Line color: 128; 128; 0 137 | - Class: rviz_default_plugins/SetInitialPose 138 | Topic: 139 | Depth: 5 140 | Durability Policy: Volatile 141 | History Policy: Keep Last 142 | Reliability Policy: Reliable 143 | Value: /initialpose 144 | - Class: rviz_default_plugins/SetGoal 145 | Topic: 146 | Depth: 5 147 | Durability Policy: Volatile 148 | History Policy: Keep Last 149 | Reliability Policy: Reliable 150 | Value: /goal_pose 151 | - Class: rviz_default_plugins/PublishPoint 152 | Single click: true 153 | Topic: 154 | Depth: 5 155 | Durability Policy: Volatile 156 | History Policy: Keep Last 157 | Reliability Policy: Reliable 158 | Value: /clicked_point 159 | Transformation: 160 | Current: 161 | Class: rviz_default_plugins/TF 162 | Value: true 163 | Views: 164 | Current: 165 | Class: rviz_default_plugins/Orbit 166 | Distance: 8.264771461486816 167 | Enable Stereo Rendering: 168 | Stereo Eye Separation: 0.05999999865889549 169 | Stereo Focal Distance: 1 170 | Swap Stereo Eyes: false 171 | Value: false 172 | Focal Point: 173 | X: 0.37976211309432983 174 | Y: 1.2636011838912964 175 | Z: -0.9953302145004272 176 | Focal Shape Fixed Size: true 177 | Focal Shape Size: 0.05000000074505806 178 | Invert Z Axis: false 179 | Name: Current View 180 | Near Clip Distance: 0.009999999776482582 181 | Pitch: 0.814797043800354 182 | Target Frame: 183 | Value: Orbit (rviz) 184 | Yaw: 4.324580669403076 185 | Saved: ~ 186 | Window Geometry: 187 | Displays: 188 | collapsed: false 189 | Height: 1180 190 | Hide Left Dock: false 191 | Hide Right Dock: true 192 | QMainWindow State: 000000ff00000000fd00000004000000000000018d00000442fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d00000442000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010000000442fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003d00000442000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d00650100000000000004500000000000000000000005e90000044200000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 193 | Selection: 194 | collapsed: false 195 | Tool Properties: 196 | collapsed: false 197 | Views: 198 | collapsed: true 199 | Width: 1916 200 | X: 2240 201 | Y: 140 202 | -------------------------------------------------------------------------------- /imu_transformer/include/imu_transformer/tf2_sensor_msgs.h: -------------------------------------------------------------------------------- 1 | //Remove this header when https://github.com/ros/geometry_experimental/pull/78 is released 2 | 3 | /* 4 | * Copyright (c) 2008, Willow Garage, Inc. 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of the Willow Garage, Inc. nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | #ifndef TF2_SENSOR_MSGS_H 33 | #define TF2_SENSOR_MSGS_H 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | namespace tf2 42 | { 43 | 44 | /**********/ 45 | /** IMU **/ 46 | /**********/ 47 | 48 | /** 49 | * method to extract timestamp from object 50 | */ 51 | template <> 52 | inline 53 | tf2::TimePoint getTimestamp(const sensor_msgs::msg::Imu& p) {return tf2_ros::fromMsg(p.header.stamp);} 54 | 55 | /** 56 | * method to extract frame id from object 57 | */ 58 | template <> 59 | inline 60 | std::string getFrameId(const sensor_msgs::msg::Imu &p) {return p.header.frame_id;} 61 | 62 | 63 | /** 64 | * Transforms a covariance array from one frame to another 65 | */ 66 | inline 67 | void transformCovariance(const std::array& in, std::array& out, Eigen::Quaternion r){ 68 | 69 | Eigen::Map > cov_in(in.data()); 70 | Eigen::Map > cov_out(out.data()); 71 | cov_out = r * cov_in * r.inverse(); 72 | 73 | } 74 | 75 | /** 76 | * Transforms sensor_msgs::Imu data from one frame to another 77 | */ 78 | template <> 79 | inline 80 | void doTransform(const sensor_msgs::msg::Imu &imu_in, sensor_msgs::msg::Imu &imu_out, const geometry_msgs::msg::TransformStamped& t_in) 81 | { 82 | 83 | imu_out.header = t_in.header; 84 | 85 | // Discard translation, only use orientation for IMU transform 86 | Eigen::Quaternion r( 87 | t_in.transform.rotation.w, t_in.transform.rotation.x, t_in.transform.rotation.y, t_in.transform.rotation.z); 88 | Eigen::Transform t(r); 89 | 90 | Eigen::Vector3d vel = t * Eigen::Vector3d( 91 | imu_in.angular_velocity.x, imu_in.angular_velocity.y, imu_in.angular_velocity.z); 92 | 93 | imu_out.angular_velocity.x = vel.x(); 94 | imu_out.angular_velocity.y = vel.y(); 95 | imu_out.angular_velocity.z = vel.z(); 96 | 97 | transformCovariance(imu_in.angular_velocity_covariance, imu_out.angular_velocity_covariance, r); 98 | 99 | Eigen::Vector3d accel = t * Eigen::Vector3d( 100 | imu_in.linear_acceleration.x, imu_in.linear_acceleration.y, imu_in.linear_acceleration.z); 101 | 102 | 103 | imu_out.linear_acceleration.x = accel.x(); 104 | imu_out.linear_acceleration.y = accel.y(); 105 | imu_out.linear_acceleration.z = accel.z(); 106 | 107 | transformCovariance(imu_in.linear_acceleration_covariance, imu_out.linear_acceleration_covariance, r); 108 | 109 | // Orientation expresses attitude of the new frame_id in a fixed world frame. This is why the transform here applies 110 | // in the opposite direction. 111 | Eigen::Quaternion orientation = Eigen::Quaternion( 112 | imu_in.orientation.w, imu_in.orientation.x, imu_in.orientation.y, imu_in.orientation.z) * r.inverse(); 113 | 114 | imu_out.orientation.w = orientation.w(); 115 | imu_out.orientation.x = orientation.x(); 116 | imu_out.orientation.y = orientation.y(); 117 | imu_out.orientation.z = orientation.z(); 118 | 119 | // Orientation is measured relative to the fixed world frame, so it doesn't change when applying a static 120 | // transform to the sensor frame. 121 | imu_out.orientation_covariance = imu_in.orientation_covariance; 122 | 123 | } 124 | 125 | inline 126 | sensor_msgs::msg::Imu toMsg(const sensor_msgs::msg::Imu &in) 127 | { 128 | return in; 129 | } 130 | 131 | inline 132 | void fromMsg(const sensor_msgs::msg::Imu &msg, sensor_msgs::msg::Imu &out) 133 | { 134 | out = msg; 135 | } 136 | 137 | /*********************/ 138 | /** Magnetic Field **/ 139 | /*********************/ 140 | 141 | /** 142 | * method to extract timestamp from object 143 | */ 144 | template <> 145 | inline 146 | tf2::TimePoint getTimestamp(const sensor_msgs::msg::MagneticField& p) {return tf2_ros::fromMsg(p.header.stamp);} 147 | 148 | /** 149 | * method to extract frame id from object 150 | */ 151 | template <> 152 | inline 153 | std::string getFrameId(const sensor_msgs::msg::MagneticField &p) {return p.header.frame_id;} 154 | 155 | /** 156 | * Transforms sensor_msgs::MagneticField data from one frame to another 157 | */ 158 | template <> 159 | inline 160 | void doTransform(const sensor_msgs::msg::MagneticField &mag_in, sensor_msgs::msg::MagneticField &mag_out, const geometry_msgs::msg::TransformStamped& t_in) 161 | { 162 | 163 | mag_out.header = t_in.header; 164 | 165 | // Discard translation, only use orientation for Magnetic Field transform 166 | Eigen::Quaternion r( 167 | t_in.transform.rotation.w, t_in.transform.rotation.x, t_in.transform.rotation.y, t_in.transform.rotation.z); 168 | Eigen::Transform t(r); 169 | 170 | Eigen::Vector3d mag = t * Eigen::Vector3d( 171 | mag_in.magnetic_field.x, mag_in.magnetic_field.y, mag_in.magnetic_field.z); 172 | 173 | mag_out.magnetic_field.x = mag.x(); 174 | mag_out.magnetic_field.y = mag.y(); 175 | mag_out.magnetic_field.z = mag.z(); 176 | 177 | transformCovariance(mag_in.magnetic_field_covariance, mag_out.magnetic_field_covariance, r); 178 | 179 | } 180 | 181 | inline 182 | sensor_msgs::msg::MagneticField toMsg(const sensor_msgs::msg::MagneticField &in) 183 | { 184 | return in; 185 | } 186 | 187 | inline 188 | void fromMsg(const sensor_msgs::msg::MagneticField &msg, sensor_msgs::msg::MagneticField &out) 189 | { 190 | out = msg; 191 | } 192 | 193 | } // namespace 194 | 195 | #endif // TF2_SENSOR_MSGS_IMU_H 196 | -------------------------------------------------------------------------------- /imu_processors/src/imu_bias_remover.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, Willow Garage, Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Willow Garage, Inc. nor the names of its 14 | * contributors may be used to endorse or promote products derived from 15 | * this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /* 31 | * Author: Chad Rockey 32 | */ 33 | 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | namespace imu_processors 43 | { 44 | 45 | // Returns true if |val1| < val2 46 | bool abslt(const double& val1, const double& val2) 47 | { 48 | return std::abs(val1) < val2; 49 | } 50 | 51 | double accumulator_update(const double& alpha, const double& avg, const double& meas) 52 | { 53 | return alpha * meas + (1.0 - alpha) * avg; 54 | } 55 | 56 | class ImuBiasRemover : public rclcpp::Node 57 | { 58 | public: 59 | explicit ImuBiasRemover(const rclcpp::NodeOptions & options) 60 | : rclcpp::Node("imu_bias_remover", options) 61 | { 62 | twist_is_zero_ = false; 63 | odom_is_zero_ = false; 64 | accumulator_.x = 0.0; 65 | accumulator_.y = 0.0; 66 | accumulator_.z = 0.0; 67 | 68 | // Get parameters 69 | use_cmd_vel_ = this->declare_parameter("use_cmd_vel", false); 70 | use_odom_ = this->declare_parameter("use_odom", false); 71 | alpha_ = this->declare_parameter("accumulator_alpha", 0.01); 72 | use_stamped_ = this->declare_parameter("use_stamped", true); 73 | 74 | if (use_cmd_vel_) 75 | { 76 | RCLCPP_INFO(rclcpp::get_logger("imu_bias_remover"), "Using cmd_vel"); 77 | if (use_stamped_) 78 | { 79 | cmd_stamped_sub_ = this->create_subscription( 80 | "cmd_vel", rclcpp::SystemDefaultsQoS(), 81 | std::bind(&ImuBiasRemover::cmd_vel_stamped_callback, this, std::placeholders::_1)); 82 | } else { 83 | cmd_sub_ = this->create_subscription( 84 | "cmd_vel", rclcpp::SystemDefaultsQoS(), 85 | std::bind(&ImuBiasRemover::cmd_vel_callback, this, std::placeholders::_1)); 86 | } 87 | } 88 | if (use_odom_) 89 | { 90 | RCLCPP_INFO(rclcpp::get_logger("imu_bias_remover"), "Using odom"); 91 | odom_sub_ = this->create_subscription( 92 | "odom", rclcpp::SystemDefaultsQoS(), 93 | std::bind(&ImuBiasRemover::odom_callback, this, std::placeholders::_1)); 94 | } 95 | 96 | cmd_vel_threshold_ = this->declare_parameter("cmd_vel_threshold", 0.001); 97 | odom_threshold_ = this->declare_parameter("odom_threshold", 0.001); 98 | 99 | // Create publisher 100 | pub_ = this->create_publisher("imu_biased", 10); 101 | bias_pub_ = this->create_publisher("bias", 10); 102 | 103 | // Imu Subscriber 104 | imu_sub_ = this->create_subscription( 105 | "imu", rclcpp::SystemDefaultsQoS(), 106 | std::bind(&ImuBiasRemover::imu_callback, this, std::placeholders::_1)); 107 | } 108 | 109 | private: 110 | void cmd_vel_callback(const geometry_msgs::msg::Twist::ConstSharedPtr & msg) 111 | { 112 | if (abslt(msg->linear.x, cmd_vel_threshold_) && 113 | abslt(msg->linear.y, cmd_vel_threshold_) && 114 | abslt(msg->linear.z, cmd_vel_threshold_) && 115 | abslt(msg->angular.x, cmd_vel_threshold_) && 116 | abslt(msg->angular.y, cmd_vel_threshold_) && 117 | abslt(msg->angular.z, cmd_vel_threshold_)) 118 | { 119 | twist_is_zero_ = true; 120 | return; 121 | } 122 | twist_is_zero_ = false; 123 | } 124 | 125 | void cmd_vel_stamped_callback(const geometry_msgs::msg::TwistStamped::ConstSharedPtr & msg) 126 | { 127 | if (abslt(msg->twist.linear.x, cmd_vel_threshold_) && 128 | abslt(msg->twist.linear.y, cmd_vel_threshold_) && 129 | abslt(msg->twist.linear.z, cmd_vel_threshold_) && 130 | abslt(msg->twist.angular.x, cmd_vel_threshold_) && 131 | abslt(msg->twist.angular.y, cmd_vel_threshold_) && 132 | abslt(msg->twist.angular.z, cmd_vel_threshold_)) 133 | { 134 | twist_is_zero_ = true; 135 | return; 136 | } 137 | twist_is_zero_ = false; 138 | } 139 | 140 | void odom_callback(const nav_msgs::msg::Odometry::ConstSharedPtr & msg) 141 | { 142 | if (abslt(msg->twist.twist.linear.x, odom_threshold_) && 143 | abslt(msg->twist.twist.linear.y, odom_threshold_) && 144 | abslt(msg->twist.twist.linear.z, odom_threshold_) && 145 | abslt(msg->twist.twist.angular.x, odom_threshold_) && 146 | abslt(msg->twist.twist.angular.y, odom_threshold_) && 147 | abslt(msg->twist.twist.angular.z, odom_threshold_)) 148 | { 149 | odom_is_zero_ = true; 150 | return; 151 | } 152 | odom_is_zero_ = false; 153 | } 154 | 155 | void imu_callback(const sensor_msgs::msg::Imu::ConstSharedPtr & msg) 156 | { 157 | sensor_msgs::msg::Imu imu(*msg); 158 | 159 | if (twist_is_zero_ || odom_is_zero_) 160 | { 161 | // Update bias, set outputs to 0 162 | accumulator_.x = accumulator_update(alpha_, accumulator_.x, msg->angular_velocity.x); 163 | accumulator_.y = accumulator_update(alpha_, accumulator_.y, msg->angular_velocity.y); 164 | accumulator_.z = accumulator_update(alpha_, accumulator_.z, msg->angular_velocity.z); 165 | imu.angular_velocity.x = 0.0; 166 | imu.angular_velocity.y = 0.0; 167 | imu.angular_velocity.z = 0.0; 168 | } else { 169 | // Modify outputs by bias 170 | imu.angular_velocity.x -= accumulator_.x; 171 | imu.angular_velocity.y -= accumulator_.y; 172 | imu.angular_velocity.z -= accumulator_.z; 173 | } 174 | 175 | // Publish transformed message 176 | pub_->publish(imu); 177 | 178 | // Publish bias information 179 | geometry_msgs::msg::Vector3Stamped bias; 180 | bias.header = imu.header; 181 | bias.vector = accumulator_; 182 | bias_pub_->publish(bias); 183 | } 184 | 185 | private: 186 | bool twist_is_zero_; 187 | bool odom_is_zero_; 188 | 189 | bool use_cmd_vel_; 190 | bool use_odom_; 191 | bool use_stamped_; 192 | 193 | double cmd_vel_threshold_; 194 | double odom_threshold_; 195 | 196 | // Implement an exponentially weighted moving average to calculate bias 197 | geometry_msgs::msg::Vector3 accumulator_; 198 | double alpha_; 199 | 200 | rclcpp::Publisher::SharedPtr pub_; 201 | rclcpp::Publisher::SharedPtr bias_pub_; 202 | rclcpp::Subscription::SharedPtr cmd_sub_; 203 | rclcpp::Subscription::SharedPtr cmd_stamped_sub_; 204 | rclcpp::Subscription::SharedPtr odom_sub_; 205 | rclcpp::Subscription::SharedPtr imu_sub_; 206 | }; 207 | 208 | } // namespace imu_processors 209 | 210 | #include 211 | RCLCPP_COMPONENTS_REGISTER_NODE(imu_processors::ImuBiasRemover) 212 | -------------------------------------------------------------------------------- /imu_transformer/test/test_imu_transforms.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * \brief 4 | * \author Martin Pecka 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | * SPDX-FileCopyrightText: Czech Technical University in Prague 7 | */ 8 | 9 | #include "gtest/gtest.h" 10 | 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | void compareCovariances(const std::array& c1, const std::array& c2) 21 | { 22 | for (size_t i = 0; i < 9; ++i) 23 | EXPECT_NEAR(c1[i], c2[i], 1e-6) << "Wrong value at position " << i; 24 | } 25 | 26 | TEST(Covariance, Transform) 27 | { 28 | std::array in = {1, 0, 0, 0, 2, 0, 0, 0, 3}; 29 | std::array expectedOut = {1, 0, 0, 0, 2, 0, 0, 0, 3}; 30 | std::array out{}; 31 | Eigen::Quaterniond q(1, 0, 0, 0); 32 | tf2::transformCovariance(in, out, q); 33 | compareCovariances(expectedOut, out); 34 | 35 | q = Eigen::Quaterniond(Eigen::AngleAxisd(M_PI_2, Eigen::Vector3d(0, 0, 1))); 36 | expectedOut = {2, 0, 0, 0, 1, 0, 0, 0, 3}; 37 | tf2::transformCovariance(in, out, q); 38 | compareCovariances(expectedOut, out); 39 | 40 | q = q.inverse(); 41 | tf2::transformCovariance(in, out, q); 42 | compareCovariances(expectedOut, out); 43 | 44 | q = Eigen::Quaterniond(Eigen::AngleAxisd(M_PI_2, Eigen::Vector3d(1, 0, 0))); 45 | expectedOut = {1, 0, 0, 0, 3, 0, 0, 0, 2}; 46 | tf2::transformCovariance(in, out, q); 47 | compareCovariances(expectedOut, out); 48 | 49 | q = q.inverse(); 50 | tf2::transformCovariance(in, out, q); 51 | compareCovariances(expectedOut, out); 52 | 53 | q = Eigen::Quaterniond(Eigen::AngleAxisd(M_PI_2, Eigen::Vector3d(0, 1, 0))); 54 | expectedOut = {3, 0, 0, 0, 2, 0, 0, 0, 1}; 55 | tf2::transformCovariance(in, out, q); 56 | compareCovariances(expectedOut, out); 57 | 58 | q = q.inverse(); 59 | tf2::transformCovariance(in, out, q); 60 | compareCovariances(expectedOut, out); 61 | 62 | q = Eigen::Quaterniond(Eigen::AngleAxisd(M_PI_2, Eigen::Vector3d(1, 1, 1))); 63 | expectedOut = {2.5, -0.5, 3, 1, 0, -1, -1.5, 2, 0.5}; 64 | tf2::transformCovariance(in, out, q); 65 | compareCovariances(expectedOut, out); 66 | 67 | q = q.inverse(); 68 | expectedOut = {1.5, -1, 1, 2, 2, -1.5, -0.5, 3, -0.5}; 69 | tf2::transformCovariance(in, out, q); 70 | compareCovariances(expectedOut, out); 71 | } 72 | 73 | TEST(Imu, GetTimestamp) 74 | { 75 | sensor_msgs::msg::Imu msg; 76 | msg.header.stamp.sec = 1; 77 | msg.header.stamp.nanosec = 2; 78 | 79 | EXPECT_EQ(tf2_ros::fromMsg(msg.header.stamp), tf2::getTimestamp(msg)); 80 | } 81 | 82 | TEST(Imu, GetFrameId) 83 | { 84 | sensor_msgs::msg::Imu msg; 85 | msg.header.frame_id = "test"; 86 | 87 | EXPECT_EQ(msg.header.frame_id, tf2::getFrameId(msg)); 88 | } 89 | 90 | void prepareImuMsg(sensor_msgs::msg::Imu& msg) 91 | { 92 | msg.header.frame_id = "test2"; 93 | msg.header.stamp.sec = 1; 94 | msg.angular_velocity.x = 1; 95 | msg.angular_velocity.y = 2; 96 | msg.angular_velocity.z = 3; 97 | msg.angular_velocity_covariance = {1, 0, 0, 0, 2, 0, 0, 0, 3}; 98 | msg.linear_acceleration.x = 1; 99 | msg.linear_acceleration.y = 2; 100 | msg.linear_acceleration.z = 3; 101 | msg.linear_acceleration_covariance = {1, 0, 0, 0, 2, 0, 0, 0, 3}; 102 | msg.orientation.w = 1; 103 | msg.orientation_covariance = {1, 0, 0, 0, 2, 0, 0, 0, 3}; 104 | } 105 | 106 | void prepareTf(geometry_msgs::msg::TransformStamped& tf) 107 | { 108 | tf.header.frame_id = "test"; 109 | tf.header.stamp.sec = 1; 110 | tf.child_frame_id = "test2"; 111 | tf.transform.translation.x = 1e6; 112 | tf.transform.translation.y = 2e6; 113 | tf.transform.translation.z = -3e6; 114 | tf.transform.rotation.w = 1; 115 | } 116 | 117 | TEST(Imu, DoTransformYaw) 118 | { 119 | // Q = +90 degrees yaw 120 | 121 | sensor_msgs::msg::Imu msg; 122 | prepareImuMsg(msg); 123 | 124 | geometry_msgs::msg::TransformStamped tf; 125 | prepareTf(tf); 126 | 127 | tf2::Quaternion q; 128 | q.setRPY(0, 0, M_PI_2); 129 | tf2::convert(q, tf.transform.rotation); 130 | 131 | sensor_msgs::msg::Imu out; 132 | tf2::doTransform(msg, out, tf); 133 | 134 | tf2::Quaternion rot; 135 | 136 | EXPECT_EQ("test", out.header.frame_id); 137 | EXPECT_EQ(msg.header.stamp, out.header.stamp); 138 | EXPECT_NEAR(-msg.angular_velocity.y, out.angular_velocity.x, 1e-6); 139 | EXPECT_NEAR(msg.angular_velocity.x, out.angular_velocity.y, 1e-6); 140 | EXPECT_NEAR(msg.angular_velocity.z, out.angular_velocity.z, 1e-6); 141 | EXPECT_NEAR(-msg.linear_acceleration.y, out.linear_acceleration.x, 1e-6); 142 | EXPECT_NEAR(msg.linear_acceleration.x, out.linear_acceleration.y, 1e-6); 143 | EXPECT_NEAR(msg.linear_acceleration.z, out.linear_acceleration.z, 1e-6); 144 | // Transforming orientation means expressing the attitude of the new frame in the same world frame (i.e. you have 145 | // data in imu frame and want to ask what is the world-referenced orientation of the base_link frame that is attached 146 | // to this IMU). This is why the orientation change goes the other way than the transform. 147 | tf2::convert(out.orientation, rot); 148 | EXPECT_NEAR(0, rot.angleShortestPath(q.inverse()), 1e-6); 149 | 150 | compareCovariances({2, 0, 0, 0, 1, 0, 0, 0, 3}, out.angular_velocity_covariance); 151 | compareCovariances({2, 0, 0, 0, 1, 0, 0, 0, 3}, out.linear_acceleration_covariance); 152 | // Orientation covariance stays as it is measured regarding the fixed world frame 153 | compareCovariances(msg.orientation_covariance, out.orientation_covariance); 154 | } 155 | 156 | TEST(Imu, DoTransformEnuNed) 157 | { 158 | // Q = ENU->NED transform 159 | 160 | sensor_msgs::msg::Imu msg; 161 | prepareImuMsg(msg); 162 | 163 | geometry_msgs::msg::TransformStamped tf; 164 | prepareTf(tf); 165 | 166 | tf2::Quaternion q; 167 | q.setRPY(M_PI, 0, M_PI_2); 168 | tf2::convert(q, tf.transform.rotation); 169 | 170 | sensor_msgs::msg::Imu out; 171 | tf2::doTransform(msg, out, tf); 172 | 173 | tf2::Quaternion rot; 174 | 175 | EXPECT_EQ("test", out.header.frame_id); 176 | EXPECT_EQ(msg.header.stamp, out.header.stamp); 177 | EXPECT_NEAR(msg.angular_velocity.y, out.angular_velocity.x, 1e-6); 178 | EXPECT_NEAR(msg.angular_velocity.x, out.angular_velocity.y, 1e-6); 179 | EXPECT_NEAR(-msg.angular_velocity.z, out.angular_velocity.z, 1e-6); 180 | EXPECT_NEAR(msg.linear_acceleration.y, out.linear_acceleration.x, 1e-6); 181 | EXPECT_NEAR(msg.linear_acceleration.x, out.linear_acceleration.y, 1e-6); 182 | EXPECT_NEAR(-msg.linear_acceleration.z, out.linear_acceleration.z, 1e-6); 183 | // Transforming orientation means expressing the attitude of the new frame in the same world frame (i.e. you have 184 | // data in imu frame and want to ask what is the world-referenced orientation of the base_link frame that is attached 185 | // to this IMU). This is why the orientation change goes the other way than the transform. 186 | tf2::convert(out.orientation, rot); 187 | EXPECT_NEAR(0, rot.angleShortestPath(q.inverse()), 1e-6); 188 | 189 | compareCovariances({2, 0, 0, 0, 1, 0, 0, 0, 3}, out.angular_velocity_covariance); 190 | compareCovariances({2, 0, 0, 0, 1, 0, 0, 0, 3}, out.linear_acceleration_covariance); 191 | // Orientation covariance stays as it is measured regarding the fixed world frame 192 | compareCovariances(msg.orientation_covariance, out.orientation_covariance); 193 | } 194 | 195 | TEST(Mag, GetTimestamp) 196 | { 197 | sensor_msgs::msg::MagneticField msg; 198 | msg.header.stamp.sec = 1; 199 | msg.header.stamp.nanosec = 2; 200 | 201 | EXPECT_EQ(tf2_ros::fromMsg(msg.header.stamp), tf2::getTimestamp(msg)); 202 | } 203 | 204 | TEST(Mag, GetFrameId) 205 | { 206 | sensor_msgs::msg::MagneticField msg; 207 | msg.header.frame_id = "test"; 208 | 209 | EXPECT_EQ(msg.header.frame_id, tf2::getFrameId(msg)); 210 | } 211 | 212 | void prepareMagMsg(sensor_msgs::msg::MagneticField& msg) 213 | { 214 | msg.header.frame_id = "test2"; 215 | msg.header.stamp.sec = 1; 216 | msg.magnetic_field.x = 1; 217 | msg.magnetic_field.y = 2; 218 | msg.magnetic_field.z = 3; 219 | msg.magnetic_field_covariance = {1, 0, 0, 0, 2, 0, 0, 0, 3}; 220 | } 221 | 222 | TEST(Mag, DoTransformYaw) 223 | { 224 | // Q = +90 degrees yaw 225 | 226 | sensor_msgs::msg::MagneticField msg; 227 | prepareMagMsg(msg); 228 | 229 | geometry_msgs::msg::TransformStamped tf; 230 | prepareTf(tf); 231 | 232 | tf2::Quaternion q; 233 | q.setRPY(0, 0, M_PI_2); 234 | tf2::convert(q, tf.transform.rotation); 235 | 236 | sensor_msgs::msg::MagneticField out; 237 | tf2::doTransform(msg, out, tf); 238 | 239 | EXPECT_EQ("test", out.header.frame_id); 240 | EXPECT_EQ(msg.header.stamp, out.header.stamp); 241 | EXPECT_NEAR(-msg.magnetic_field.y, out.magnetic_field.x, 1e-6); 242 | EXPECT_NEAR(msg.magnetic_field.x, out.magnetic_field.y, 1e-6); 243 | EXPECT_NEAR(msg.magnetic_field.z, out.magnetic_field.z, 1e-6); 244 | 245 | compareCovariances({2, 0, 0, 0, 1, 0, 0, 0, 3}, out.magnetic_field_covariance); 246 | } 247 | 248 | TEST(Mag, DoTransformEnuNed) 249 | { 250 | // Q = ENU->NED transform 251 | 252 | sensor_msgs::msg::MagneticField msg; 253 | prepareMagMsg(msg); 254 | 255 | geometry_msgs::msg::TransformStamped tf; 256 | prepareTf(tf); 257 | 258 | tf2::Quaternion q; 259 | q.setRPY(M_PI, 0, M_PI_2); 260 | tf2::convert(q, tf.transform.rotation); 261 | 262 | sensor_msgs::msg::MagneticField out; 263 | tf2::doTransform(msg, out, tf); 264 | 265 | EXPECT_EQ("test", out.header.frame_id); 266 | EXPECT_EQ(msg.header.stamp, out.header.stamp); 267 | EXPECT_NEAR(msg.magnetic_field.y, out.magnetic_field.x, 1e-6); 268 | EXPECT_NEAR(msg.magnetic_field.x, out.magnetic_field.y, 1e-6); 269 | EXPECT_NEAR(-msg.magnetic_field.z, out.magnetic_field.z, 1e-6); 270 | 271 | compareCovariances({2, 0, 0, 0, 1, 0, 0, 0, 3}, out.magnetic_field_covariance); 272 | } 273 | 274 | int main(int argc, char **argv) 275 | { 276 | testing::InitGoogleTest(&argc, argv); 277 | return RUN_ALL_TESTS(); 278 | } 279 | -------------------------------------------------------------------------------- /imu_transformer/LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------