Author: | Geoffrey Biggs and contributors |
---|---|
Date: | 2011-10-24 |
Copyright: | EPL-1.0 |
Version: | 3.0 |
Manual section: | 1 |
Manual group: | User commands |
rtinject [options] <path1:port1> [path2:port2...]
Writes constant values to one or more ports. By default, the value is written once. Options are available to write a set number of times, or write regularly for a specified length of time.
A connection will be made to the port using the default connection settings compatible with the port.
-c CONST, --const=CONST | |
The constant value to send, as a Python expression. If not specified, values will be read from stdin. Any occurrences of {time} in the constant expression will be replaced with the current time. | |
-m MODULES, --mod=MODULES | |
Extra modules to import. If automatic module loading struggles with the constant's data types, try listing the modules here. The module and its __POA partner will be imported. | |
-n MAX, --number=MAX | |
Specify the number of times to write to the port. The default is to write once. Specify -1 to continuously write forever. | |
-p PATHS, --path=PATHS | |
Extra module search paths to add to the PYTHONPATH. | |
-r RATE, --rate=RATE | |
Specify the rate in Hertz at which to emit data. | |
-t TIMEOUT, --timeout=TIMEOUT | |
Write data for this many seconds, then stop. This option overrides --number. |
--version | Show program's version number and exit |
-h, --help | Show a help message and exit |
-v, --verbose | Output verbose information. [Default: False] |
rtshell uses paths to indicate objects in the RTC Tree. A path is the address of object. Name servers and naming contexts on name servers are considered directories. Managers and RT-Components are considered 'files'. As with the POSIX cat command, the path specified as an argument to commands is appended to the current rtshell working directory, which is stored in the RTCSH_CWD environment variable and changeable using the rtcwd command.
The available paths depend on the known name servers at the time the command is executed. This is a combination of the servers listed in the RTCSH_NAMESERVERS environment variable and the servers used in given paths.
For example, /localhost/comp0.rtc refers to the component named comp0.rtc registered on the name server at localhost. /localhost/manager/comp0.rtc refers to the component comp0.rtc in the directory manager on the localhost name server. ./comp0.rtc refers to that component in the current directory.
When specifying a port on an RT-Component, it should be placed after the path, separated by a colon. For example, /localhost/comp0.rtc:data refers to the port data on the component comp0.rtc.
Some commands that create new ports accept extra options in the paths, such as a name for the automatically generated port, or a formatter. The format for specifying these paths is:
path:port.name#formatter
For example:
/localhost/blurg.host_cxt/comp0.rtc:input.stuff#a_printer
This specifies that the automatically generated port should be named stuff, and the data type it handles should be printed using the a_printer function (which must be available, usually it is provided by the user in a loadable module). The port will be connected to the input port of the comp0.rtc component.
The name component is optional. If it is not present, neither should the . character be. For example:
/localhost/blurg.host_cxt/comp0.rtc:input#a_printer
The formatter component is optional. If it is not present, neither should the # character be. For example:
/localhost/blurg.host_cxt/comp0.rtc:input.stuff
- RTCTREE_ORB_ARGS
- A list of arguments, separated by semi-colons, to pass to the ORB when creating it. Optional.
- RTCTREE_NAMESERVERS
- A list of name server addresses, separated by semi-colons, to parse when creating the RTCTree. Each server in the list will be added to the tree, making it available for browsing with rtshell. Optional.
- RTSH_CWD
- The current working directory in the tree. Do not set this variable; it is set automatically by rtshell.
The only variable that should normally be set by the user is RTCTREE_NAMESERVERS. Set this to a list of name server addresses, separated by semi-colons, that rtshell should interact with. For example, in a Bash shell, the following command will set the known name serves to localhost, 192.168.0.1:65346 and example.com:
$ export RTCTREE_NAMESERVERS=localhost;192.168.0.1:65346;example.com
Returns zero on success and non-zero on failure.
Verbose output and error messages are printed to stderr.
$ rtinject /localhost/ConsoleOut0.rtc:in
Inject the first value received at stdin into the in port of ConsoleOut0.rtc.
$ rtinject /localhost/ConsoleOut0.rtc:in -c 'RTC.TimedLong({time}, 42)'
Inject the constant 42 with the current system time into the in port of ConsoleOut0.rtc. Note the quotes used to protect the Python expression.
$ rtinject /localhost/ConsoleOut0.rtc:in -c 'RTC.TimedLong(RTC.Time(1, 0), 42)'
Inject the constant 42 with a timestamp of 1 second into the in port of ConsoleOut0.rtc.
$ rtinject /localhost/ConsoleOut0.rtc:in -n 5
Inject the first five values received at stdin into the in port of ConsoleOut0.rtc.
$ rtinject /localhost/ConsoleOut0.rtc:in -n 5 -c 'RTC.TimedLong({time}, 42)'
Inject the constant 42 with the current system time into the in port of ConsoleOut0.rtc five times.
$ rtinject /localhost/ConsoleOut0.rtc:in -t 5 -r 10 -c 'RTC.TimedLong({time}, 42)'
Inject the constant 42 with the current system time into the in port of ConsoleOut0.rtc at 10Hz for five seconds.
$ rtinject /localhost/MyComp0.rtc:in -c 'MyData.MyVal(84)'
Inject the constant MyData.MyVal(84) in port of MyComp0.rtc once. The data type is specified in a Python module in the PYTHONPATH, which was generated from an OMG IDL file.
$ rtinject /localhost/MyComp0.rtc:in -p /usr/local/mods -c 'MyData.MyVal(84)'
Inject the constant MyData.MyVal(84) in port of MyComp0.rtc once. The data type is specified in a Python module that is not in the PYTHONPATH. The path is specified using the -p option.
$ rtinject /localhost/MyComp0.rtc:in -p /usr/local/mods -m mymod -c 'MyData.MyVal(84)'
Inject the constant MyData.MyVal(84) in port of MyComp0.rtc once. The data type is specified in the mymod Python module, which is in the PYTHONPATH.
rtcat (1), rtlog (1), rtprint (1)