def create_worker(self, idnum, topic, collname): msg_class, real_topic, msg_eval = rostopic.get_topic_class( topic, blocking=True) w = None node_path = None if not self.no_specific and msg_class == tfMessage: print("DETECTED transform topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_tf") if not node_path: print( "FAILED to detect mongodb_log_tf, falling back to generic logger (did not build package?)" ) elif not self.no_specific and msg_class == PointCloud: print("DETECTED point cloud topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_pcl") if not node_path: print( "FAILED to detect mongodb_log_pcl, falling back to generic logger (did not build package?)" ) elif not self.no_specific and msg_class == CompressedImage: print("DETECTED compressed image topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_cimg") if not node_path: print( "FAILED to detect mongodb_log_cimg, falling back to generic logger (did not build package?)" ) """ elif msg_class == TriangleMesh: print("DETECTED triangle mesh topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_trimesh") if not node_path: print("FAILED to detect mongodb_log_trimesh, falling back to generic logger (did not build package?)") """ if node_path: w = SubprocessWorker(idnum, topic, collname, self.in_counter.count, self.out_counter.count, self.drop_counter.count, QUEUE_MAXSIZE, self.mongodb_host, self.mongodb_port, self.mongodb_name, self.nodename_prefix, node_path) if not w: print("GENERIC Python logger used for topic %s" % topic) w = WorkerProcess(idnum, topic, collname, self.in_counter.count, self.out_counter.count, self.drop_counter.count, QUEUE_MAXSIZE, self.mongodb_host, self.mongodb_port, self.mongodb_name, self.nodename_prefix) if self.graph_topics: self.assert_worker_rrd(collname) return w
def create_worker(self, idnum, topic, collname): try: msg_class, real_topic, msg_eval = rostopic.get_topic_class(topic, blocking=False) except Exception as e: print('Topic %s not announced, cannot get type: %s' % (topic, e)) raise if real_topic is None: raise rostopic.ROSTopicException('topic type was empty, probably not announced') w = None node_path = None if not self.no_specific and msg_class == tfMessage: print("DETECTED transform topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_tf") if not node_path: print("FAILED to detect mongodb_log_tf, falling back to generic logger (did not build package?)") elif not self.no_specific and msg_class == PointCloud: print("DETECTED point cloud topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_pcl") if not node_path: print("FAILED to detect mongodb_log_pcl, falling back to generic logger (did not build package?)") elif not self.no_specific and msg_class == CompressedImage: print("DETECTED compressed image topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_cimg") if not node_path: print("FAILED to detect mongodb_log_cimg, falling back to generic logger (did not build package?)") """ elif msg_class == TriangleMesh: print("DETECTED triangle mesh topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_trimesh") if not node_path: print("FAILED to detect mongodb_log_trimesh, falling back to generic logger (did not build package?)") """ if node_path: w = SubprocessWorker(idnum, topic, collname, self.in_counter.count, self.out_counter.count, self.drop_counter.count, QUEUE_MAXSIZE, self.mongodb_host, self.mongodb_port, self.mongodb_name, self.nodename_prefix, node_path) if not w: print("GENERIC Python logger used for topic %s" % topic) w = WorkerProcess(idnum, topic, collname, self.in_counter.count, self.out_counter.count, self.drop_counter.count, QUEUE_MAXSIZE, self.mongodb_host, self.mongodb_port, self.mongodb_name, self.nodename_prefix) return w
def __init__(self, name, topic, collname, mongodb_host, mongodb_port, mongodb_name): node_path = find_node(PACKAGE_NAME, "mongodb_log_desig") additional_parameters = ["-d" "designator-request"] if not node_path: raise RuntimeError("FAILED to detect mongodb_log_desig, falling back to generic logger (did not build package?)") super(DesignatorRequestLogger, self).__init__(name, topic, collname, mongodb_host, mongodb_port, mongodb_name, node_path[0], additional_parameters)
def __init__(self, name, topic, collname, mongodb_host, mongodb_port, mongodb_name): node_path = find_node(PACKAGE_NAME, "mongodb_log_img") if not node_path: raise RuntimeError("FAILED to detect mongodb_log_img, falling back to generic logger (did not build package?)") super(ImageLogger, self).__init__(name, topic, collname, mongodb_host, mongodb_port, mongodb_name, node_path[0], None)
def rec_start(cfg): # type: (BagConfig) -> Popen try: # Prepare the command_line, command name and output path cmd = [find_node('rosbag', 'record')[0]] cmd.extend([ '--output-prefix', rec_path() + get_param('ros_rest/rec_prefix') + str(cfg.id) ]) # Specify the topics to record cmd.extend(['--regex', cfg.regex] if cfg.regex else ['--exclude', cfg.exclude] if cfg.exclude else ['--all']) # Set the limits for splits, duration and size cmd.extend([ '--split', '--max-splits', str(cfg.splits) if cfg.splits else get_param( 'ros_rest/rec_splits', 5), '--size', str(cfg.size) if cfg.size else get_param('ros_rest/rec_size', '50'), '--duration', str(cfg.duration) if cfg.duration else get_param( 'ros_rest/rec_time', '10') ]) cmd.extend([ '--' + (cfg.compression if cfg.compression else get_param( 'ros_rest/rec_zip', 'lz4')) ]) # Set the name of the node to easily check it's state cmd.extend( ['__name:=' + get_param('ros_rest/rec_node', 'rest_bag_record')]) print(cmd) return Popen(cmd) except Exception as e: # The command might be missing or the BagConfig might be None logerr('ros_rest : rec_start : ' + str(e))
def create_worker(self, idnum, topic, collname): msg_class, real_topic, msg_eval = rostopic.get_topic_class(topic, blocking=True) w = None node_path = None if not self.no_specific and msg_class == tfMessage: print("DETECTED transform topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_tf") if not node_path: print("FAILED to detect mongodb_log_tf, falling back to generic logger (did not build package?)") elif not self.no_specific and msg_class == PointCloud: print("DETECTED point cloud topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_pcl") if not node_path: print("FAILED to detect mongodb_log_pcl, falling back to generic logger (did not build package?)") elif not self.no_specific and msg_class == CompressedImage: print("DETECTED compressed image topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_cimg") if not node_path: print("FAILED to detect mongodb_log_cimg, falling back to generic logger (did not build package?)") """ elif msg_class == TriangleMesh: print("DETECTED triangle mesh topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_trimesh") if not node_path: print("FAILED to detect mongodb_log_trimesh, falling back to generic logger (did not build package?)") """ if node_path: w = SubprocessWorker(idnum, topic, collname, self.in_counter.count, self.out_counter.count, self.drop_counter.count, QUEUE_MAXSIZE, self.mongodb_host, self.mongodb_port, self.mongodb_name, self.nodename_prefix, node_path) if not w: print("GENERIC Python logger used for topic %s" % topic) w = WorkerProcess(idnum, topic, collname, self.in_counter.count, self.out_counter.count, self.drop_counter.count, QUEUE_MAXSIZE, self.mongodb_host, self.mongodb_port, self.mongodb_name, self.nodename_prefix) if self.graph_topics: self.assert_worker_rrd(collname) return w
def __init__(self, name, topic, collname, mongodb_host, mongodb_port, mongodb_name): node_path = find_node(PACKAGE_NAME, "mongodb_log_tf") # Log only when the preceeding entry of that # transformation had at least 0.100 vectorial and radial # distance to its predecessor transformation, but at least # every second. additional_parameters = ["-k" "0.100" "-l" "0.100" "-g" "1"] if not node_path: raise RuntimeError("FAILED to detect mongodb_log_tf, falling back to generic logger (did not build package?)") super(TFLogger, self).__init__(name, topic, collname, mongodb_host, mongodb_port, mongodb_name, node_path[0], additional_parameters)
def create_worker(self, idnum, topic, collname): msg_class, real_topic, msg_eval = rostopic.get_topic_class(topic, blocking=True) w = None node_path = None additional_parameters = []; if not self.no_specific and (msg_class == tfMessage) or (msg_class == TFMessage): print("DETECTED transform topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_tf") #additional_parameters = ["-a"] #additional_parameters = ["-k" "0.005" "-l" "0.005" "-g" "0"] #additional_parameters = ["-k" "0.025" "-l" "0.025" "-g" "0"] # Log only when the preceeding entry of that # transformation had at least 0.100 vectorial and radial # distance to its predecessor transformation, but at least # every second. additional_parameters = ["-k" "0.100" "-l" "0.100" "-g" "1"] if not node_path: print("FAILED to detect mongodb_log_tf, falling back to generic logger (did not build package?)") elif not self.no_specific and msg_class == PointCloud: print("DETECTED point cloud topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_pcl") if not node_path: print("FAILED to detect mongodb_log_pcl, falling back to generic logger (did not build package?)") elif not self.no_specific and msg_class == Image: print("DETECTED compressed image topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_img") if not node_path: print("FAILED to detect mongodb_log_img, falling back to generic logger (did not build package?)") elif not self.no_specific and msg_class == CompressedImage: print("DETECTED compressed image topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_cimg") if not node_path: print("FAILED to detect mongodb_log_cimg, falling back to generic logger (did not build package?)") elif not self.no_specific and msg_class == DesignatorRequest: print("DETECTED designator request topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_desig") additional_parameters = ["-d" "designator-request"] if not node_path: print("FAILED to detect mongodb_log_desig, falling back to generic logger (did not build package?)") elif not self.no_specific and msg_class == DesignatorResponse: print("DETECTED designator response topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_desig") additional_parameters = ["-d" "designator-response"] if not node_path: print("FAILED to detect mongodb_log_desig, falling back to generic logger (did not build package?)") elif not self.no_specific and msg_class == Designator: print("DETECTED designator topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_desig") additional_parameters = ["-d" "designator"] if not node_path: print("FAILED to detect mongodb_log_desig, falling back to generic logger (did not build package?)") """ elif msg_class == TriangleMesh: print("DETECTED triangle mesh topic %s, using fast C++ logger" % topic) node_path = find_node(PACKAGE_NAME, "mongodb_log_trimesh") if not node_path: print("FAILED to detect mongodb_log_trimesh, falling back to generic logger (did not build package?)") """ if node_path: w = SubprocessWorker(idnum, topic, collname, self.in_counter.count, self.out_counter.count, self.drop_counter.count, QUEUE_MAXSIZE, self.mongodb_host, self.mongodb_port, self.mongodb_name, self.nodename_prefix, node_path[0], additional_parameters) if not w: print("GENERIC Python logger used for topic %s" % topic) w = WorkerProcess(idnum, topic, collname, self.in_counter.count, self.out_counter.count, self.drop_counter.count, QUEUE_MAXSIZE, self.mongodb_host, self.mongodb_port, self.mongodb_name, self.nodename_prefix) if self.graph_topics: self.assert_worker_rrd(collname) return w