-
Notifications
You must be signed in to change notification settings - Fork 7
[feat] ROS2 Node! #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
627d1a9
First go around at building
contagon 0f395bb
Clean up node code
contagon 8fac961
Clean up ros node stuff
contagon 90cb827
Nearly to a working ros node
contagon 9796588
finalize ROS2 node :)
contagon aa6e457
Apply suggestions from code review
contagon 7f56970
Clean up some parameters and point cloud creation
contagon 8d5e06a
A few more details in the README
contagon 6192791
Increase read-ahead-queue-size
contagon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # SCM syntax highlighting & preventing 3-way merges | ||
| pixi.lock merge=binary linguist-language=YAML linguist-generated=true -diff | ||
| uv.lock merge=binary linguist-language=TOML linguist-generated=true -diff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| cmake_minimum_required(VERSION 3.16...3.26) | ||
| project(form VERSION 0.1.0 LANGUAGES CXX) | ||
|
|
||
| set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
|
||
| # Build the core FORM library from the parent directory | ||
| # Need PIC since FORM (static) gets linked into a shared library (form_odometry_node) | ||
| set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
| add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/form_core) | ||
|
|
||
| find_package(ament_cmake REQUIRED) | ||
| find_package(geometry_msgs REQUIRED) | ||
| find_package(nav_msgs REQUIRED) | ||
| find_package(rclcpp REQUIRED) | ||
| find_package(rclcpp_components REQUIRED) | ||
| find_package(rcutils REQUIRED) | ||
| find_package(sensor_msgs REQUIRED) | ||
| find_package(std_msgs REQUIRED) | ||
| find_package(tf2_ros REQUIRED) | ||
|
|
||
| # ROS 2 node | ||
| add_library(form_odometry_node SHARED src/node.cpp) | ||
| target_compile_features(form_odometry_node PUBLIC cxx_std_17) | ||
| target_include_directories(form_odometry_node PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) | ||
| target_link_libraries(form_odometry_node FORM) | ||
| ament_target_dependencies( | ||
| form_odometry_node | ||
| geometry_msgs | ||
| nav_msgs | ||
| rclcpp | ||
| rclcpp_components | ||
| rcutils | ||
| sensor_msgs | ||
| std_msgs | ||
| tf2_ros) | ||
|
|
||
| rclcpp_components_register_node(form_odometry_node PLUGIN "form_ros::EstimatorNode" EXECUTABLE form_node) | ||
|
|
||
| install(TARGETS form_odometry_node LIBRARY DESTINATION lib RUNTIME DESTINATION lib/${PROJECT_NAME}) | ||
| install(DIRECTORY launch rviz DESTINATION share/${PROJECT_NAME}/) | ||
|
|
||
| ament_package() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2025 Easton Potokar, Taylor Pool, and Michael Kaess | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| # FORM ROS 2 Wrapper | ||
|
|
||
| This ROS 2 node is based on the [KISS-ICP](https://github.com/PRBonn/kiss-icp) ROS 2 wrapper. | ||
| Thanks to the KISS-ICP developers for their clean and well-structured ROS node implementation. | ||
|
|
||
| ### Building | ||
|
|
||
| You will need the same dependencies as FORM (most of which are available as ROS packages), | ||
| - [eigen3](https://libeigen.gitlab.io/eigen/docs-nightly/) | ||
| - [gtsam](https://github.com/borglab/gtsam/) | ||
| - [tbb](https://github.com/uxlfoundation/oneTBB) | ||
| - [tsl::robin_map](https://github.com/Tessil/robin-map) (will be pulled from source if not found) | ||
|
|
||
| Once those are installed, simply clone FORM to your workspace and build, | ||
|
|
||
| ```sh | ||
| git clone https://github.com/contagon/form | ||
| colcon build | ||
| source ./install/setup.bash | ||
| ``` | ||
|
|
||
| ### Running | ||
|
|
||
| The main launch file is `odometry.launch.py` which will launch the odometry node. FORM has three required inputs, **topic name**, **number of scanlines/rings/columns**, and **number of rows/circular count**. This last two are required for FORM's feature extraction. | ||
|
|
||
| To view all the available arguments, you can run: | ||
|
|
||
| ```sh | ||
| ros2 launch form odometry.launch.py --show-args | ||
| ``` | ||
| which will output the following: | ||
|
|
||
| | Parameter | Default | Description | | ||
| |--------------------|--------------|--------------------------------------| | ||
| | `topic` | `None` | Input point cloud topic | | ||
| | `num_columns` | `None` | LiDAR image width (columns) | | ||
| | `num_rows` | `None` | LiDAR image height (rows) | | ||
| | `min_range` | `1.0` | Minimum LiDAR range | | ||
| | `max_range` | `100.0` | Maximum LiDAR range | | ||
| | `visualize` | `true` | Launch RViz and publish point clouds | | ||
| | `bagfile` | `''` | Optional rosbag file/folder to play | | ||
| | `base_frame` | `''` | Base frame id | | ||
| | `lidar_odom_frame` | `odom_lidar` | Odometry frame id | | ||
| | `publish_odom_tf` | `True` | Publish odom->base TF | | ||
| | `invert_odom_tf` | `True` | Invert published odom TF | | ||
| | `use_sim_time` | `True` | Use simulation time | | ||
|
|
||
| If a bagfile is provided, the node will play the bagfile and process the point clouds. If not, it will just subscribe to the topic and process incoming point clouds in real-time. | ||
|
|
||
| Thus as an example | ||
|
|
||
| ```sh | ||
| ros2 launch form odometry.launch.py bagfile:=<path_to_rosbag> topic:=<topic_name> num_columns:=<num_columns> num_rows:=<num_rows> | ||
| ``` | ||
|
|
||
| ### Pointcloud Format | ||
|
|
||
| FORM requires point clouds to be in row-major order with no dropped points for its feature extraction method. It does it's best to infer the ordering and density of the point cloud using the following heuristics, | ||
|
|
||
| | Format | Heuristic to Infer | | ||
| |----------------|----------------------------------------------------------| | ||
| | all points | Point cloud size equaling `num_columns` * `num_rows` | | ||
| | dropped points | Point cloud size not equaling `num_columns` * `num_rows` | | ||
| | row-major | Stationary ring number for first few points | | ||
| | column-major | Increasing ring number for first few points | | ||
|
|
||
| IMPORTANT: If you're point cloud *does not* is not in row or column major format, FORM will crash! Please open an issue and we can add a flag to handle you're appropriate cloud formatting. (For example, I've seen some velodyne point clouds have ring order returned as 0, 8, 1, 9, 2, 10, ... This will break things) | ||
|
|
||
| NOTE: If your point cloud is row major and has dropped invalid points, there is usually no way to figure out where along the scan line the dropped points belong. FORM places all of them at the end. This may have an impact on feature extraction, but things generally *should* still work. | ||
|
|
||
|
|
||
| ### Development | ||
|
|
||
| We're not huge fans of installing ROS2 system wide, so this folder is setup to install all dependencies using [pixi](https://pixi.prefix.dev/latest/) and [robostack](https://robostack.github.io/index.html). | ||
|
|
||
| Install pixi, then building is all done in a single command from the `ros/` directory | ||
| ```sh | ||
| pixi run build | ||
| source install/setup.sh | ||
| ``` | ||
|
|
||
| If you need to utilize ROS2 commands, you can do either of the following, | ||
| ```sh | ||
| pixi run ros2 <your command> | ||
| # enter into a pixi shell | ||
| pixi shell | ||
| ros2 <your command> | ||
| ``` | ||
|
|
||
| If you have the oxford spires dataset installed using [evalio](https://github.com/contagon/evalio/tree/master), you can use the following commands to launch and run a trajectory from it, | ||
| ```sh | ||
| pixi run oxford | ||
| ``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.