fix: Node level lazy parameter fix#852
Open
TannerGilbert wants to merge 1 commit intogazebosim:ros2from
Open
Conversation
Signed-off-by: Tanner, Gilbert <gilbertta@edu.aau.at>
ahcorde
requested changes
Mar 13, 2026
| EXPECT_EQ( | ||
| "Could not parse config: file empty [test/config/empty.yaml]", | ||
| g_last_log_event.message); | ||
| } |
Collaborator
There was a problem hiding this comment.
Suggested change
| } | |
| // Verify that BridgeHandle::IsLazy() falls back to kDefaultLazy when | |
| // BridgeConfig::is_lazy is std::nullopt, and returns the explicit value | |
| // when it is set. | |
| TEST(BridgeHandleIsLazy, NulloptFallsBackToDefault) | |
| { | |
| ros_gz_bridge::BridgeConfig config; | |
| config.is_lazy = std::nullopt; | |
| // IsLazy() must return the hard-coded default when no value is set. | |
| EXPECT_EQ(ros_gz_bridge::kDefaultLazy, config.is_lazy.value_or(ros_gz_bridge::kDefaultLazy)); | |
| } | |
| TEST(BridgeHandleIsLazy, ExplicitTrueIsRespected) | |
| { | |
| ros_gz_bridge::BridgeConfig config; | |
| config.is_lazy = true; | |
| EXPECT_TRUE(config.is_lazy.value_or(ros_gz_bridge::kDefaultLazy)); | |
| } | |
| TEST(BridgeHandleIsLazy, ExplicitFalseIsRespected) | |
| { | |
| ros_gz_bridge::BridgeConfig config; | |
| config.is_lazy = false; | |
| EXPECT_FALSE(config.is_lazy.value_or(ros_gz_bridge::kDefaultLazy)); | |
| } |
Comment on lines
240
to
242
| void RosGzBridge::add_bridge(const BridgeConfig & config) | ||
| { | ||
| bool gz_to_ros = false; |
Collaborator
There was a problem hiding this comment.
Suggested change
| void RosGzBridge::add_bridge(const BridgeConfig & input_config) | |
| { | |
| // Resolve the laziness: if the caller left is_lazy as nullopt, inherit the | |
| // node-level "lazy" parameter so that the effective value is always explicit. | |
| BridgeConfig config = input_config; | |
| if (!config.is_lazy.has_value()) { | |
| bool node_lazy = kDefaultLazy; | |
| this->get_parameter("lazy", node_lazy); | |
| config.is_lazy = node_lazy; | |
| } | |
| bool gz_to_ros = false; |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🦟 Bug fix
Fixes #751
Summary
Fix the lazy ROS parameter on the parameter_bridge and RosGzBridge nodes so it actually works as a global default for all bridge topics.
What was broken:
What this PR does:
Behaviour:
lazylazyfalse(default)falsefalse(default)truetruefalse(default)falsefalsetruetruetruetruetruetruefalsefalseChecklist
codecheckpassed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-byandGenerated-bymessages.