Skip to content

ping_pong rand() is not seeded so device ids are likely the same across nodes #97

@corytodd

Description

@corytodd

Issue template

Steps to reproduce the issue

Build this repo on your target

  cd /ros2_ws
  . /opt/ros/humble/setup.bash
  . install/local_setup.bash
  colcon build --packages-select micro_ros_demos_rclc
  /ros2_ws/install/micro_ros_demos_rclc/lib/micro_ros_demos_rclc/ping_pong

Expected behavior

I expect to see ping/pong messages

Actual behavior

You will see only Ping or only Pong messages

Additional information

Running on Ubuntu 24.04 host, docker compose driving a pair of containers to pubsub.


In my testing, seeding random with a nanosecond clock is sufficient to generate different device ids. I'd file a PR but I'd like to see if this was intended or maybe just an artifact of launching two container simultaneously

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions