ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Ping from .launch file

asked 2018-06-26 16:26:11 -0500

AmateurHour gravatar image

Hello! I am attempting to add a line to my ros .launch file that would emulate the 'ping ##.#.###.##' command used in the command line. Is this possible? I am running Ubuntu 16.04. Thanks!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2018-06-27 01:37:19 -0500

gvdhoorn gravatar image

'emulate' or actually run ping?

If the latter: see #q272267.

Running regular (ie: non-ROS) binaries from roslaunch is possible, but requires some special care.

The example there is with Python, but a simple bash script should also work.

edit flag offensive delete link more


With the assistance of your answer, I made a small python script and put that in the launch file. Thank you!

AmateurHour gravatar image AmateurHour  ( 2018-07-03 21:35:54 -0500 )edit

answered 2018-07-03 21:41:26 -0500

130s gravatar image

updated 2018-09-15 18:32:56 -0500

  • For ICMP ping, you can also run rosping node from your launch.
  • For xmlrpc ping in ROS network level, in rosnode Python API there are some methods, e.g. rosnode_ping. In the simplest form you can run a command like:

    python -c "import rosnode; rosnode.rosnode_ping('/rosout', verbose=True)"
edit flag offensive delete link more


@AmateurHour: this is a good suggestion and was actually why I asked:

'emulate' or actually run ping?

gvdhoorn gravatar image gvdhoorn  ( 2018-07-04 01:13:34 -0500 )edit

Question Tools

1 follower


Asked: 2018-06-26 16:26:11 -0500

Seen: 368 times

Last updated: Sep 15 '18