Skip to content

Instantly share code, notes, and snippets.

@mxgrey
Created February 6, 2023 15:33
Show Gist options
  • Save mxgrey/b56bad03e7cecb114c513feed4c7e8b6 to your computer and use it in GitHub Desktop.
Save mxgrey/b56bad03e7cecb114c513feed4c7e8b6 to your computer and use it in GitHub Desktop.
test_samehost
#!/bin/bash
. /ros/install/setup.bash
echo "Same host publisher setting is $ROS_AUTOMATIC_DISCOVERY_RANGE, static peers is ${ROS_STATIC_PEERS}"
ROS_AUTOMATIC_DISCOVERY_RANGE=OFF ROS_STATIC_PEERS="" ros2 topic echo --timeout 15 --once /test_topic std_msgs/String > /results/no_discovery_no_static/subscriber &
ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST ROS_STATIC_PEERS="" ros2 topic echo --timeout 15 --once /test_topic std_msgs/String > /results/localhost_no_static/subscriber &
ROS_AUTOMATIC_DISCOVERY_RANGE=SUBNET ROS_STATIC_PEERS="" ros2 topic echo --timeout 15 --once /test_topic std_msgs/String > /results/subnet_no_static/subscriber &
ROS_AUTOMATIC_DISCOVERY_RANGE=OFF ROS_STATIC_PEERS="10.0.0.2" ros2 topic echo --timeout 15 --once /test_topic std_msgs/String > /results/no_discovery_static/subscriber &
ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST ROS_STATIC_PEERS="10.0.0.2" ros2 topic echo --timeout 15 --once /test_topic std_msgs/String > /results/localhost_static/subscriber &
ROS_AUTOMATIC_DISCOVERY_RANGE=SUBNET ROS_STATIC_PEERS="10.0.0.2" ros2 topic echo --timeout 15 --once /test_topic std_msgs/String > /results/subnet_static/subscriber &
ros2 topic pub -t 10 --max-wait-time 5 /test_topic std_msgs/String "data: Hello" & ros2 topic echo --timeout 10 --once /test_topic std_msgs/String > /results/publisher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment