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

Publish binary time data when use_sim_time parameter is true #114

Merged
merged 4 commits into from
Dec 14, 2022

Conversation

achim-k
Copy link
Collaborator

@achim-k achim-k commented Dec 13, 2022

Public-Facing Changes

  • Publish binary time data when use_sim_time is true

Description
Depends on foxglove/ws-protocol#299

  • When the use_sim_time parameter is set

    • The server advertises the time capability
    • It subscribes to the /clock topic and broadcasts binary time messages
  • I have removed the code that detects presence of the /clock topic, since now it has to be known at startup whether use_sim_time is true or false

  • Includes Make server capabilities configurable #115 (will rebase after it got merged)

@achim-k achim-k marked this pull request as draft December 13, 2022 19:02
@achim-k achim-k marked this pull request as ready for review December 14, 2022 15:48
@achim-k achim-k changed the title Publish binary time data when /clock topic is present Publish binary time data when use_sim_time parameter is true Dec 14, 2022
@@ -116,14 +115,22 @@ class FoxgloveBridge : public rclcpp::Node {
const auto useTLS = this->get_parameter("tls").as_bool();
const auto certfile = this->get_parameter("certfile").as_string();
const auto keyfile = this->get_parameter("keyfile").as_string();
_useSimTime = this->get_parameter("use_sim_time").as_bool();
Copy link
Contributor

Choose a reason for hiding this comment

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

For ROS 1 we retrieve /use_sim_time. I'm not familiar enough with ROS 2 params to know if this is correct or if we should be using the / prefix here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In ROS 2 the use_sim_time is not global anymore but every node declares that paramter (automatically). From what I read, the main challenge is setting this parameter for all nodes when e.g. launching multiple nodes in a launch file

Choose a reason for hiding this comment

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

From what I read, the main challenge is setting this parameter for all nodes when e.g. launching multiple nodes in a launch file

I happened to see this comment by mistake and want to share a tip; You can set the use_sim_time for all your Nodes inside a GroupAction in this way:

from launch.actions import GroupAction
from launch_ros.actions import SetParameter

GroupAction(
        actions=[
            SetParameter("use_sim_time", True),
            Node(...),
            Node(...)
       ]
)

@jhurliman jhurliman merged commit 8fccb98 into main Dec 14, 2022
@jhurliman jhurliman deleted the achim/time_publishing branch December 14, 2022 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants