ivs-ros-pkg: janus | rosshell

Package Summary

rosshell

Overview

This package provides the two nodes, that enable to run and interact with different non-ros-programs. rosshell can be used to start a program or any kind of shell-command. If some kind of interaction with the programs is required, use rosshellX to receive and send messages from stdin and stdout.

Usage

The required commands are always defined as a string:

$ rosrun rosshell rosshell.py "command"

$ rosrun rosshell rosshellX.py "command"

have a look at the examples or at the included launch-files.

Examples

rosshell

This command is just used to generate some random noise ...

$ rosrun rosshell rosshell.py "aplay -c 2 -f S16_LE -r 44100 /dev/urandom"

Pipe the results of /dev/random into a text file ...

$ rosrun rosshell rosshell.py "cat /dev/random > test.txt"

or the some information about the current directory ...

$ rosrun rosshell rosshell.py "ls -Shal > test.txt"

rosshellX

This node is used if you require some interaction with stdin and stdout.

rosshellX is by default subscribed to /rosshellX/stdin and publishes at topic /rosshellX/stdout, both of type std_msgs/String.

Some basic calculations

bc is just a simple commandline-calculator

  1. open three shells
  2. start bc with the following command:

    $ rosrun rosshell rosshellX.py "bc"
  3. print the the results of bc stdout by running:

    $ rostopic echo /rosshellX/stdout
  4. and now, send some inputs like:

       1 $ rostopic pub /rosshellX/stdin std_msgs/String "99*99\n"
       2 $ rostopic pub /rosshellX/stdin std_msgs/String "sqrt(2.0)\n"
       3 $ rostopic pub /rosshellX/stdin std_msgs/String "33^3\n"
       4 $ rostopic pub /rosshellX/stdin std_msgs/String "quit\n"
    

Additional functionality

To get some filesystem-information try:

$ rosrun rosshell rosshellX.py "ls -Shal"

or

$ rosrun rosshell rosshellX.py _command:="ls -Shal"

both are the same but you also have the possibility to change the command and topics, also within the launch-file, have a look at rosshellX.launch ...

   1 <node pkg="rosshell" type="rosshellX.py" name="rosshellBC">
   2     <param name="command" type="String" value="bc" />
   3     <param name="stdout" type="String" value="bc/stdout" />
   4     <param name="stdin" type="String" value="bc/stdin" />
   5 </node>

Nodes

rosshell

Allows to run commands with no interaction possibilities.

rosshellX

Allows to run commands and enables an interaction over stdin and stdout.

Subscribed Topics

/rosshellX/stdin (std_msgs/String)
  • The standard topic for stdin.

Published Topics

/rosshellX/stdout (std_msgs/String)
  • The current line of the stdout.

Parameters

command (string, default: "")
  • Commands that will be executed.
stdout (string, default: /rosshellX/stdout)
  • Change the topic for stdout.
stdin (string, default: /rosshellX/stdin)
  • Change the topic for stdin.

Bug Reports & Feature Requests

Wiki: rosshell (last edited 2011-10-01 07:32:31 by André Dietrich)