Skip to content

Conversation

@kuralme
Copy link

@kuralme kuralme commented Nov 11, 2025

Added the tf prefix helper here instead of control_toolbox. Prefix enabler flag re-added and frame removed from input arguments.
Related PR

Comment on lines +108 to +111
if (!tf_prefix_enabled)
{
return std::string{};
}
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to have this arg here? Can't we condition it outside whoever is using this code?

Copy link
Member

Choose a reason for hiding this comment

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

IMHO, the helper methods shouldn't condition things, they do some standard operation and the users adapt to their usecases

Copy link
Contributor

Choose a reason for hiding this comment

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

this refers to my comment here: ros-controls/ros2_controllers#1997 (comment)
The current state feels a bit unconvenient. If !tf_prefix_enabled then it is just the given odom frame without adding something. How would you design this?

Copy link
Member

Choose a reason for hiding this comment

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

How about something like this

If the tf_prefix is empty, then return empty
If the tf_prefix is ~, then then the node namespace
If the tr_pedix is anything else, then return that

Obviously, trimming the /'s

What do you think about it?

Copy link
Author

@kuralme kuralme Nov 11, 2025

Choose a reason for hiding this comment

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

IMO, the previous version -helper without the prefix enable arg- was causing clutter when called with the ternary operator. It was still a one liner but looked more complicated then it is. I can remove it again regardless so it can comply the standard:

the helper methods shouldn't condition things

The decision is yours.

If the tf_prefix is empty, then return empty
If the tf_prefix is ~, then then the node namespace
If the tr_pedix is anything else, then return that

Not clear about this second one, do you mean i take node namespace if the user inputs the tilde character specifically or is it a result of some operation I am not aware?

Copy link
Member

@saikishor saikishor Nov 11, 2025

Choose a reason for hiding this comment

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

Yes, if the user inputs tilde, you replace that part with node namespace. Wouldn't that work?. This way you wouldn't need the parameter of tf_prefix_enable or not right?

For the conditioning part, the part you say complicated. I need to check that part of the code and get back to you.

Copy link
Author

@kuralme kuralme Nov 11, 2025

Choose a reason for hiding this comment

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

Previous one I tested here

Thanks for the reference. My question is do we really need tf_frame_prefix_enable parameter? If so, why?

@christophfroehlich christophfroehlich changed the title helper and test added Add tf prefix helper and test Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants