grepros 1.3.0
grep for ROS bag files and live topics
Loading...
Searching...
No Matches
generate_msgs Namespace Reference

Classes

class  generator
 
class  rosapi
 

Functions

 make_argparser ()
 
 plural (word, items)
 
 process_args (args)
 
 run (args)
 
 take_sample (population, k)
 
 wildcard_to_regex (text, end=True)
 

Variables

dict ARGUMENTS
 Configuration for argparse, as {description, epilog, args: [..], groups: {name: [..]}}.
 
str NAME = "generate_msgs"
 Name used for node.
 
 rospy = None
 
 runargs = process_args(make_argparser().parse_args())
 

Detailed Description

Generates random ROS messages and publishes them to live topics.

Usage:

    generate_msgs.py [TYPE [TYPE ...]]
                     [--no-type TYPE [TYPE ...]]
                     [--max-count NUM]
                     [--max-per-topic NUM]
                     [--max-topics NUM]
                     [--topics-per-type NUM]
                     [--interval SECONDS]
                     [--publish-prefix PREFIX]
                     [--publish-suffix SUFFIX]
                     [--no-latch]
                     [--verbose]
                     [--option KEY=VALUE [KEY=VALUE ...]]

Topic names default to "/generate_msgs/type", like "/generate_msgs/std_msgs/Bool".

Supports both ROS1 and ROS2, version detected from environment.

Stand-alone script, requires ROS1 / ROS2 Python libraries.
ROS1 requires ROS master to be running.

------------------------------------------------------------------------------
This file is part of grepros - grep for ROS bag files and live topics.
Released under the BSD License.

@author      Erki Suurjaak
@created     05.02.2022
@modified    09.02.2022
------------------------------------------------------------------------------

Function Documentation

◆ make_argparser()

make_argparser ( )
Returns a populated ArgumentParser instance.

Definition at line 396 of file generate_msgs.py.

◆ plural()

plural (   word,
  items 
)
Returns "N words" or "1 word".

Definition at line 405 of file generate_msgs.py.

◆ process_args()

process_args (   args)
Converts or combines arguments where necessary, returns args.

@param   args  arguments object like argparse.Namespace

Definition at line 430 of file generate_msgs.py.

◆ run()

run (   args)
Generates messages until Ctrl-C or end condition reached.

Definition at line 464 of file generate_msgs.py.

◆ take_sample()

take_sample (   population,
  k 
)
Returns a list of k randomly chosen elements from population.

Definition at line 411 of file generate_msgs.py.

◆ wildcard_to_regex()

wildcard_to_regex (   text,
  end = True 
)
Returns plain wildcard like "foo*bar" as re.Pattern("foo.*bar", re.I).

@param   end  whether pattern should match until end (adds $)

Definition at line 420 of file generate_msgs.py.

Variable Documentation

◆ ARGUMENTS

dict ARGUMENTS

Configuration for argparse, as {description, epilog, args: [..], groups: {name: [..]}}.

Definition at line 65 of file generate_msgs.py.

◆ NAME

str NAME = "generate_msgs"

Name used for node.

Definition at line 129 of file generate_msgs.py.

◆ rospy

rospy = None

Definition at line 51 of file generate_msgs.py.

◆ runargs

runargs = process_args(make_argparser().parse_args())

Definition at line 565 of file generate_msgs.py.