def generate_schemas_from_all(output_directory=""): """ Generates schemas from all ROS message types found in your ROS package paths Args: output_directory: Directory to output .h and .cpp files Returns: schemas: A list of strings which are the contents of the .h and .cpp files to write to the system. """ templates = [] pkg_paths = get_rospkg_paths() for pkg, pkg_path in pkg_paths.iteritems(): if (pkg in GLOBAL_WHITELIST) or (pkg not in GLOBAL_BLACKLIST): types = rosmsg._list_types(pkg_path[0], "msg", ".msg") print types for t in types: if (t in GLOBAL_WHITELIST) and (t not in GLOBAL_BLACKLIST): full_type = pkg + "/" + t GLOBAL_TYPES_LIST.append(full_type) load_all_subtypes(GLOBAL_TYPES_LIST) print "Total number of types (recursively) used in system: %d" % len(GLOBAL_TYPES_LIST) return generate_schemas(GLOBAL_TYPES_LIST, output_directory)
def get_ros1_services(rospack=None): if not rospack: rospack = rospkg.RosPack() srvs = [] pkgs = sorted(x for x in rosmsg.iterate_packages(rospack, rosmsg.MODE_SRV)) for package_name, path in pkgs: for message_name in rosmsg._list_types(path, 'srv', rosmsg.MODE_SRV): srvs.append(Message(package_name, message_name, path)) return srvs
def get_ros1_messages(rospack=None): if not rospack: rospack = rospkg.RosPack() msgs = [] pkgs = sorted(x for x in rosmsg.iterate_packages(rospack, rosmsg.MODE_MSG)) for package_name, path in pkgs: for message_name in rosmsg._list_types(path, 'msg', rosmsg.MODE_MSG): msgs.append(Message(package_name, message_name, path)) return msgs