Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Refactor ROS parametrization #282

Merged
merged 12 commits into from
Mar 25, 2024
Merged

Conversation

nachovizzo
Copy link
Collaborator

@nachovizzo nachovizzo commented Feb 29, 2024

Expose KISS parameters in the launch file leaving the ROS arguments exposed through the launch configuration

Besides being a more standard and "ROS"y practice, this will allow us in the future for a more flexible configuration of the ROS NODE. The number of parameters on the ROS side of things is likely to grow, and maintaining this in the launch file will become a mess.

This also lets users have a more flexible usage of the ROS node for experimentation, one can now select at launch time with a parameter file to use. In fact, many people are already doing this

**Important **: This PR does not change any piece of the implementation, it's just a cosmetic change on how we manipulate the ROS wiring, nothing else

@tizianoGuadagnino
Copy link
Collaborator

I am not super excited about this; it goes a bit against our initial philosophy of separating stuff. I will instead have a slightly larger launchfile that merges the two configs. As we know, the parameters of the base pipeline usually work without intervention, so it makes sense that the use of "tweak" is just the ros part in a specific launch file. Also I think it gives more flexibility for developers working on non-ROS framework (if any). As always we can discuss about it

@nachovizzo
Copy link
Collaborator Author

I am not super excited about this; it goes a bit against our initial philosophy of separating stuff. I will instead have a slightly larger launchfile that merges the two configs. As we know, the parameters of the base pipeline usually work without intervention, so it makes sense that the use of "tweak" is just the ros part in a specific launch file. Also I think it gives more flexibility for developers working on non-ROS framework (if any). As always we can discuss about it

I'm also not super as well, let me see if I can improve the launch.py to merge the configs there

@nachovizzo nachovizzo changed the title Expose ros parameters to yaml Improive ros parameters Feb 29, 2024
@nachovizzo
Copy link
Collaborator Author

@tizianoGuadagnino please re-review.

Now I merged the YAML file into the launch.py. The only parameters that are exposed to the ROS CLI are:

base_frame = LaunchConfiguration("base_frame", default="")
odom_frame = LaunchConfiguration("odom_frame", default="odom")
publish_odom_tf = LaunchConfiguration("publish_odom_tf", default=True)
pointcloud_topic = LaunchConfiguration("topic")
visualize = LaunchConfiguration("visualize", default="true")
bagfile = LaunchConfiguration("bagfile", default="")

Meaning that any of the above lists can be modified in the launch file but also when invoking it with the cli.

This way KISS remains configured by default, and from outside we can wire different frames for the tf tree. NOTE that this means that this is not possible anymore (but I guess it never made sense anyway)

ros2 launch kiss_icp odometry.launch.py initial_threshold:=0.4

If one needs further customization then one can create a custom launch file to launch the node with the required config:

from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node


def generate_launch_description():
    return LaunchDescription(
        [
            Node(
                package="kiss_icp",
                executable="kiss_icp_node",
                name="kiss_icp_node",
                output="screen",
                remappings=[("pointcloud_topic", LaunchConfiguration("topic"))],
                parameters=[
                    {
                        "publish_odom_tf": False,
                        "max_range": 20.0,
                    },
                ],
            )
        ]
    )

@tizianoGuadagnino
Copy link
Collaborator

Mmmm ok, let me drive it to see how it feels ;)

@tizianoGuadagnino
Copy link
Collaborator

I got some weird core dump but I guess I'm doing something wrong. The default Python pipeline kind of dies. I will investigate why, but maybe also @benemer can have a look.

image

@nachovizzo
Copy link
Collaborator Author

nachovizzo commented Mar 1, 2024

I got some weird core dump but I guess I'm doing something wrong. The default Python pipeline kind of dies. I will investigate why, but maybe also @benemer can have a look.

image

But I'm not modifying the Python pipeline in this PR 🤔 , maybe is this the new pydantic thing?

EDIT: It is pydantic, is what @benemer also saw, you have an env variable $DATA and pydantic is eating that 🤦 .

I think we might want to change our name to kiss_icp_data or similar:

data: DataConfig = DataConfig()

@benemer
Copy link
Member

benemer commented Mar 1, 2024

Yes, that's due to the new pydantic. Run

unset DATA 

and it works. @nachovizzo, I think the issue is the data field in the config.yaml that pydantic tries to fill with whatever is in $DATA.

@tizianoGuadagnino
Copy link
Collaborator

This is kind of dangerous; it can fire back very easily. We should probably handle this in a separate PR. Me and @benemer will have a look.

@tizianoGuadagnino
Copy link
Collaborator

Now back to your thing @nachovizzo

@nachovizzo
Copy link
Collaborator Author

@benemer , @tizianoGuadagnino fix is already on its way !

train of PRs.... 🚅

#286

@nachovizzo nachovizzo added the ros label Mar 5, 2024
@nachovizzo nachovizzo changed the title Improive ros parameters Improve ros parameters Mar 18, 2024
nachovizzo and others added 4 commits March 18, 2024 11:21
* Add fixed covariance to odometry msg

* Add default value just in case
* Expose registration params to ROS node

* More merge conflicts

* Default to multithread
@nachovizzo nachovizzo changed the title Improve ros parameters Refactor ROS parametrization Mar 18, 2024
Copy link
Collaborator

@tizianoGuadagnino tizianoGuadagnino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me :)

Copy link
Member

@benemer benemer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me as well!

@nachovizzo nachovizzo merged commit 6a941d0 into main Mar 25, 2024
17 checks passed
@nachovizzo nachovizzo deleted the AUTO-2216_expose_ros_parameters_to_yaml branch March 25, 2024 09:27
tizianoGuadagnino pushed a commit to 02alexander/kiss-icp that referenced this pull request Mar 25, 2024
* Move ros params from launch file to YAML

* Reuse arguments for debug clouds

* Rename odometry_node to kiss_icp_node

odometry is way to generic

* Rename node agin

* Voxel size is optional paramter

* Reads better like this

* New parameter proposal

* Add odometry covariance to ros node (PRBonn#283)

* Add fixed covariance to odometry msg

* Add default value just in case

* pre-commit

* Expose number of icp iterations in ros (PRBonn#292)

* Expose registration params to ROS node

* More merge conflicts

* Default to multithread
tizianoGuadagnino added a commit to 02alexander/kiss-icp that referenced this pull request Mar 25, 2024
tizianoGuadagnino added a commit that referenced this pull request Mar 25, 2024
* Fix bug where point would match with random point

* Use closest neightbor distance

* Switch order

* Refactor ROS parametrization (#282)

* Move ros params from launch file to YAML

* Reuse arguments for debug clouds

* Rename odometry_node to kiss_icp_node

odometry is way to generic

* Rename node agin

* Voxel size is optional paramter

* Reads better like this

* New parameter proposal

* Add odometry covariance to ros node (#283)

* Add fixed covariance to odometry msg

* Add default value just in case

* pre-commit

* Expose number of icp iterations in ros (#292)

* Expose registration params to ROS node

* More merge conflicts

* Default to multithread

* Revert "Refactor ROS parametrization (#282)"

This reverts commit 7b8b095.

* Fix and improve ROS visualization (#285)

* Fix this madness

Simplify implementation by debugging in an ego-centric way always.

Since the KISS-ICP internal map is on the global coordinates, fetch the
last ego-centric pose and apply it to the map. Seen from the
cloud_frame_id (which is the sensor frame) everything should always work
in terms of visualization, no matter the multi-sensor setup.

* Now is safe to disable this by default

* Simplify, borrow the header from the input pointcloud msg

This actually makes the visualization closer to the Python visualizer

* Disable path/odom visualization by default

In the case where we are not computing the poses in an egocentric world
(base_frame != "") and we are not publishing to the TF tree, then the
visualization wouldn't make sense. Therefore, disable it by default

* Changed my mind

If someone doesn't have that particular frame defined, then the
visualization won't work. Leave this default

* Move responsability of handling tf frames out of Registration (#288)

* Move responsability of handling tf frames out of Registration

Since with this new changes PublishOdometry is the only member that
requieres to know the user specified target-frame, it is not necesary to
handle all this bits.

This makes the implementation cleaner, easier to read and reduces the
lines of code. Now RegisterFrame is a simple callback as few months ago
one can read in seconds.

* typo

* Easier to read

* We need this for LookupTransform

* Remove unused variable

* Revert "Remove unused variable"

This reverts commit 424ee90.

* Remove unnecessary check

* Remove unnecessary exposed utility function from ROS API

With this change this function is not exposed (which was never the
intention to) to the header. This way we can also "hide" this into a
private unnamed namesapces and benefit from inlining the simple function
into the translation unit

* Revert "Remove unnecessary exposed utility function from ROS API"

This reverts commit 23cd7ef.

* Revert "Remove unnecessary check"

This reverts commit d1dcb48.

* merge conflicts :0

* Remove unnecessary exposed utility function from ROS API (#289)

* Move responsability of handling tf frames out of Registration

Since with this new changes PublishOdometry is the only member that
requieres to know the user specified target-frame, it is not necesary to
handle all this bits.

This makes the implementation cleaner, easier to read and reduces the
lines of code. Now RegisterFrame is a simple callback as few months ago
one can read in seconds.

* typo

* Easier to read

* We need this for LookupTransform

* Remove unused variable

* Revert "Remove unused variable"

This reverts commit 424ee90.

* Remove unnecessary check

* Remove unnecessary exposed utility function from ROS API

With this change this function is not exposed (which was never the
intention to) to the header. This way we can also "hide" this into a
private unnamed namesapces and benefit from inlining the simple function
into the translation unit

* Revert "Remove unnecessary exposed utility function from ROS API"

This reverts commit 23cd7ef.

* Remove unnecessary exposed utility function from ROS API

With this change this function is not exposed (which was never the
intention to) to the header. This way we can also "hide" this into a
private unnamed namesapces and benefit from inlining the simple function
into the translation unit

* Revert "Remove unnecessary check"

This reverts commit d1dcb48.

---------

Co-authored-by: tizianoGuadagnino <[email protected]>

* too many merges

* Merge Rviz and Python colors

* Just make the default construction more clear

---------

Co-authored-by: tizianoGuadagnino <[email protected]>

* Revert "Fix and improve ROS visualization (#285)"

This reverts commit 20797de.

---------

Co-authored-by: tizianoGuadagnino <[email protected]>
Co-authored-by: Benedikt Mersch <[email protected]>
Co-authored-by: Ignacio Vizzo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants