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

Ping from .launch file

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

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
1

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

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

Comments

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 -0600 )edit
1

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

130s gravatar image

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

  • 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

Comments

@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 -0600 )edit

Question Tools

1 follower

Stats

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

Seen: 379 times

Last updated: Sep 15 '18