-
Notifications
You must be signed in to change notification settings - Fork 333
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
[Humble Backport] tf_prefix param: fix slashes and add to IMU Broadcaster #1102
Conversation
@rafal-gorecki, all pull requests must be targeted towards the |
Is this a possible duplicate of #1060? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to be a duplication of #1060, but I like the fact that you have added some tests to the cases. However, I'm not entirely convinced in some places. I've left some comments here to discuss.
else | ||
{ | ||
tf_prefix = tf_prefix + "/"; | ||
tf_prefix.erase(0, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you always want to erase the first character? If the prefix is parsed without '/' then it removes the wrong character right?
I see that you did that when you are using node namespace, however, I think you need to correct the users tf_prefix as well, if he adds a '/' as well. Try to do same logic as done in #1060
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense
# FIXME: Currently does not work with namespace | ||
# validation: { | ||
# not_empty<>: null | ||
# } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain a bit more in what situation it doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes sure:
I don't know exactly what's going on. However, when this is checked it then gets an error:
[ERROR] [1713772814.609746661] [test_namespace.test_imu_sensor_broadcaster]: Exception thrown during init stage with message: Invalid value set during initialization for parameter 'sensor_name': Parameter 'sensor_name' cannot be empty
The problem is probably that:
- Adding a namespace causes the frame_id parameter to be searched for, which is no longer there (because it is ~/frame_id)
- Something else with ControllerInterface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have misinterpreted it. This information is need to get the proper state interfaces within the controller. Please look into the following code
imu_sensor_ = std::make_unique<semantic_components::IMUSensor>( | |
semantic_components::IMUSensor(params_.sensor_name)); |
imu_sensor_broadcaster/src/imu_sensor_broadcaster_parameters.yaml
Outdated
Show resolved
Hide resolved
tf_frame_prefix_enable: { | ||
type: bool, | ||
default_value: true, | ||
description: "Enables or disables appending tf_prefix to tf frame id's.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the need for this new parameter. Can you explain me why it is needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed the example of diff_drive. I think you can get rid of it.
sensor_msgs::msg::Imu imu_msg; | ||
subscribe_and_get_message(imu_msg, test_namespace); | ||
|
||
EXPECT_EQ(imu_msg.header.frame_id, frame_prefix + frame_id_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't there be a slash in between?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A matter for discussion, but in my opinion the prefix can be arbitrary and the user does not necessarily have to want it to end slash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok if you want it to be prefixed without a '/' at the end, why don't you parse it directly already appending it to the frame_id? This frame_id is only used for the published message. I don't see a point of adding a tf_prefix, if it is not namespaced.
realtime_publisher_->msg_.header.frame_id = params_.frame_id; |
What do you think about this?
Dear @saikishor , |
Yes, please rebase and target it to the master :) |
The easiest way for me to do it was this way, a continuation #1104 |
Hello,
I encountered one error related to the tf_prefix parameter. Namely, the current code works in such a way that the use of namespace does not remove the first slash. It's not typical for a tf frame to start with / so I fixed it. Additionally, I don't think it's intuitive to add a slesh every time we use tf_prefix, if only because someone might want to give a prefix that doesn't end with a slesh, although I could be wrong about that.
Additionally, I encountered one error with the option
it doesn't work well with namespaces and I don't know how to fix it yet. However, I see that it is not used in all packages, so I commented it temporarily.