Public Member Functions | Static Public Attributes | List of all members
generate_msgs.rosapi Class Reference
Inheritance diagram for generate_msgs.rosapi:
Inheritance graph
[legend]

Public Member Functions

def canonical (cls, typename)
 
def create_publisher (cls, topic, typecls, latch=True, queue_size=10)
 
def get_message_class (cls, typename)
 
def get_message_fields (cls, val)
 
def get_message_types (cls)
 
def init (cls, launch=False)
 
def is_ros_message (cls, val)
 
def is_ros_time (cls, val)
 
def make_full_typename (cls, typename)
 
def message_to_yaml (cls, msg)
 
def scalar (cls, typename, bound=False)
 
def shutdown (cls)
 

Static Public Attributes

dictionary DDS_TYPES
 ROS2 Data Distribution Service types to ROS built-ins. More...
 
 NODE = None
 rclpy.Node instance More...
 
list ROS_BUILTIN_TYPES = ROS_NUMERIC_TYPES + ROS_STRING_TYPES
 All built-in basic types in ROS. More...
 
 ROS_INTEGER_RANGES
 Value ranges for ROS integer types, as {typename: (min, max)}. More...
 
list ROS_NUMERIC_TYPES
 All built-in numeric types in ROS. More...
 
list ROS_STRING_TYPES = ["string", "wstring"]
 All built-in string types in ROS. More...
 
dictionary ROS_TIME_CLASSES
 ROS time/duration types mapped to type names. More...
 

Detailed Description

Generic interface for accessing ROS1 / ROS2 API.

Definition at line 132 of file generate_msgs.py.

Member Function Documentation

◆ canonical()

def generate_msgs.rosapi.canonical (   cls,
  typename 
)
Returns "pkg/Type" for "pkg/msg/Type", standardizes various ROS2 formats.

Converts DDS types like "octet" to "byte", and "sequence<uint8, 100>" to "uint8[100]".

Definition at line 210 of file generate_msgs.py.

◆ create_publisher()

def generate_msgs.rosapi.create_publisher (   cls,
  topic,
  typecls,
  latch = True,
  queue_size = 10 
)
Returns ROS publisher instance.

Definition at line 245 of file generate_msgs.py.

◆ get_message_class()

def generate_msgs.rosapi.get_message_class (   cls,
  typename 
)
Returns ROS message class.

Definition at line 255 of file generate_msgs.py.

◆ get_message_fields()

def generate_msgs.rosapi.get_message_fields (   cls,
  val 
)
Returns OrderedDict({field name: field type name}) if ROS1 message, else {}.

Definition at line 262 of file generate_msgs.py.

◆ get_message_types()

def generate_msgs.rosapi.get_message_types (   cls)
Returns a list of available message types, as ["pksg/Msg", ].

Definition at line 186 of file generate_msgs.py.

◆ init()

def generate_msgs.rosapi.init (   cls,
  launch = False 
)
Initializes ROS, creating and spinning node if specified.

Definition at line 194 of file generate_msgs.py.

◆ is_ros_message()

def generate_msgs.rosapi.is_ros_message (   cls,
  val 
)
Returns whether value is a ROS message or special like time/duration.

Definition at line 274 of file generate_msgs.py.

◆ is_ros_time()

def generate_msgs.rosapi.is_ros_time (   cls,
  val 
)
Returns whether value is a ROS time/duration.

Definition at line 281 of file generate_msgs.py.

◆ make_full_typename()

def generate_msgs.rosapi.make_full_typename (   cls,
  typename 
)
Returns "pkg/msg/Type" for "pkg/Type".

Definition at line 286 of file generate_msgs.py.

◆ message_to_yaml()

def generate_msgs.rosapi.message_to_yaml (   cls,
  msg 
)
Returns ROS message as YAML string.

Definition at line 293 of file generate_msgs.py.

◆ scalar()

def generate_msgs.rosapi.scalar (   cls,
  typename,
  bound = False 
)
Returns scalar type from ROS message data type, like "uint8" from "uint8[100]".

Returns type unchanged if already a scalar.

@param   bound  if True, does not strip string boundaries like "string<=10"

Definition at line 300 of file generate_msgs.py.

◆ shutdown()

def generate_msgs.rosapi.shutdown (   cls)

Definition at line 314 of file generate_msgs.py.

Member Data Documentation

◆ DDS_TYPES

dictionary generate_msgs.rosapi.DDS_TYPES
static
Initial value:
= {"boolean": "bool",
"float": "float32",
"double": "float64",
"octet": "byte",
"short": "int16",
"unsigned short": "uint16",
"long": "int32",
"unsigned long": "uint32",
"long long": "int64",
"unsigned long long": "uint64"}

ROS2 Data Distribution Service types to ROS built-ins.

Definition at line 174 of file generate_msgs.py.

◆ NODE

generate_msgs.rosapi.NODE = None
static

rclpy.Node instance

Definition at line 136 of file generate_msgs.py.

◆ ROS_BUILTIN_TYPES

list generate_msgs.rosapi.ROS_BUILTIN_TYPES = ROS_NUMERIC_TYPES + ROS_STRING_TYPES
static

All built-in basic types in ROS.

Definition at line 146 of file generate_msgs.py.

◆ ROS_INTEGER_RANGES

generate_msgs.rosapi.ROS_INTEGER_RANGES
static
Initial value:
= dict({
"byte": (-2** 7, 2** 7 - 1),
"int8": (-2** 7, 2** 7 - 1),
"int16": (-2**15, 2**15 - 1),
"int32": (-2**31, 2**31 - 1),
"int64": (-2**63, 2**63 - 1),
"char": (0, 2** 8 - 1),
"uint8": (0, 2** 8 - 1),
"uint16": (0, 2**16 - 1),
"uint32": (0, 2**31 - 1),
"uint64": (0, 2**64 - 1),
}, **{
"byte": (0, 2** 8 - 1),
"char": (-2** 7, 2** 7 - 1),
} if rclpy else {})

Value ranges for ROS integer types, as {typename: (min, max)}.

Definition at line 157 of file generate_msgs.py.

◆ ROS_NUMERIC_TYPES

list generate_msgs.rosapi.ROS_NUMERIC_TYPES
static
Initial value:
= ["byte", "char", "int8", "int16", "int32", "int64", "uint8",
"uint16", "uint32", "uint64", "float32", "float64", "bool"]

All built-in numeric types in ROS.

Definition at line 139 of file generate_msgs.py.

◆ ROS_STRING_TYPES

list generate_msgs.rosapi.ROS_STRING_TYPES = ["string", "wstring"]
static

All built-in string types in ROS.

Definition at line 143 of file generate_msgs.py.

◆ ROS_TIME_CLASSES

dictionary generate_msgs.rosapi.ROS_TIME_CLASSES
static
Initial value:
= {rospy.Time: "time", rospy.Duration: "duration",
genpy.Time: "time", genpy.Duration: "duration"} if rospy else \

ROS time/duration types mapped to type names.

Definition at line 149 of file generate_msgs.py.


The documentation for this class was generated from the following file:


grepros
Author(s): Erki Suurjaak
autogenerated on Sat Jan 6 2024 03:11:29