def parse_args(): parser = argparse.ArgumentParser( description='Computes a surface mesh of an object in the database') parser.add_argument('-s', '--session_id', metavar='SESSION_ID', dest='session_id', type=str, default='', help='The session id to reconstruct.') parser.add_argument('--all', dest='compute_all', action='store_const', const=True, default=False, help='Compute meshes for all possible sessions.') parser.add_argument('--visualize', dest='visualize', action='store_const', const=True, default=False, help='Turn on visiualization') object_recognition.dbtools.add_db_arguments(parser) sched_group = parser.add_argument_group('Scheduler Options') from ecto.opts import scheduler_options scheduler_options(sched_group, default_scheduler='Threadpool') args = parser.parse_args() if args.compute_all == False and args.session_id == '': parser.print_usage() print "You must either supply a session id, or --all." sys.exit(1) return args
def parse_args(): import argparse parser = argparse.ArgumentParser(description='Compute a LINE-MOD model and saves it to the DB.') scheduler_options(parser.add_argument_group('Scheduler')) options = parser.parse_args() return options
def parse_args(): import argparse parser = argparse.ArgumentParser(description='Find a plane in an RGBD image.') scheduler_options(parser.add_argument_group('Scheduler')) options = parser.parse_args() return options
def parse_args(): import argparse parser = argparse.ArgumentParser(description='Computes the odometry between frames.') scheduler_options(parser.add_argument_group('Scheduler')) options = parser.parse_args() return options
def __init__(self): ecto_ros.init(sys.argv,"ecto_pcl_demo") parser = argparse.ArgumentParser(description='My awesome program thing.') scheduler_options(parser) options = parser.parse_args() plasm = ecto.Plasm() voxel_grid = VoxelGrid("voxel_grid", leaf_size=0.01) cropper = Cropper("cropper", x_min=-0.25, x_max=0.25, y_min=-0.25, y_max=0.25, z_min=0.0, z_max=1.0) ror = RadiusOutlierRemoval("ror", min_neighbors=1, search_radius=1.0) cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2("cloud_sub", topic_name='/camera/depth_registered/points') msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2("cloud_pub",topic_name='/ecto_pcl/cloud_filtered') plasm.connect(cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> voxel_grid[:], voxel_grid[:] >> ror[:], ror[:] >> cloud2msg[:], cloud2msg[:] >> cloud_pub[:]) run_plasm(options, plasm, locals=vars())
def __init__(self): ecto_ros.init(sys.argv, "ecto_pcl_demo") parser = argparse.ArgumentParser( description='My awesome program thing.') scheduler_options(parser) options = parser.parse_args() plasm = ecto.Plasm() voxel_grid = VoxelGrid("voxel_grid", leaf_size=0.01) cropper = Cropper("cropper", x_min=-0.25, x_max=0.25, y_min=-0.25, y_max=0.25, z_min=0.0, z_max=1.0) convex_hull = ConvexHull("convex_hull") ror = RadiusOutlierRemoval("ror", min_neighbors=1, search_radius=1.0) sor = StatisticalOutlierRemoval("sor", mean_k=1) extract_indices = ExtractIndices("extract_indices", negative=False) extract_clusters = EuclideanClusterExtraction("extract_clusters", min_cluster_size=50, cluster_tolerance=0.005) extract_largest_cluster = ExtractLargestCluster( "extract_largest_cluster") cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2( "cloud_sub", topic_name='/camera/depth_registered/points') msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2( "cloud_pub", topic_name='/ecto_pcl/sample_output') plasm.connect( cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> extract_clusters[:], extract_clusters[:] >> extract_largest_cluster["clusters"], msg2cloud[:] >> extract_largest_cluster["input"], extract_largest_cluster[:] >> cloud2msg[:], cloud2msg[:] >> cloud_pub[:]) # plasm.connect(cloud_sub[:] >> msg2cloud[:], # msg2cloud[:] >> voxel_grid[:], # msg2cloud[:] >> extract_indices["input"], # voxel_grid[:] >> cropper[:], # cropper[:] >> extract_clusters[:], # extract_indices[:] >> extract_clusters[:], # extract_clusters[:] >> extract_largest_cluster["clusters"], # cropper[:] >> extract_largest_cluster["input"], # extract_largest_cluster[:] >> cloud2msg[:], # cloud2msg[:] >> cloud_pub[:]) run_plasm(options, plasm, locals=vars())
def parse_args(): import argparse parser = argparse.ArgumentParser(description='Test orb on images.') parser.add_argument('-i,--input', dest='input', help='The input dir. %(default)s', default='./images') scheduler_options(parser.add_argument_group('Scheduler')) options = parser.parse_args() return options
def parse_args(): import argparse parser = argparse.ArgumentParser( description='Computes the odometry between frames.') scheduler_options(parser.add_argument_group('Scheduler')) options = parser.parse_args() return options
def __init__(self): ecto_ros.init(sys.argv, "ecto_pcl_demo") parser = argparse.ArgumentParser(description='Ecto Largest Cluster') scheduler_options(parser) options = parser.parse_args() plasm = ecto.Plasm() voxel_grid = VoxelGrid("voxel_grid", leaf_size=0.015) cropper = Cropper("cropper", x_min=-0.25, x_max=0.25, y_min=-0.25, y_max=0.25, z_min=0.0, z_max=1.0) extract_clusters = EuclideanClusterExtraction("extract_clusters", min_cluster_size=50, cluster_tolerance=0.02) extract_largest_cluster = ExtractLargestCluster( "extract_largest_cluster") nan_filter = PassThrough("nan_removal") colorize = ColorizeClusters("colorize", max_clusters=100) extract_indices = ExtractIndices("extract_indices", negative=False) cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2( "cloud_sub", topic_name='/camera/depth_registered/points') msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2( "cloud_pub", topic_name='/ecto_pcl/cloud_filtered') output = ecto_pcl.XYZRGB # plasm.connect(cloud_sub[:] >> msg2cloud[:], # msg2cloud[:] >> nan_filter[:], # nan_filter[:] >> voxel_grid[:], # voxel_grid[:] >> extract_clusters[:], # extract_clusters[:] >> extract_largest_cluster["clusters"], # voxel_grid[:] >> extract_largest_cluster["input"], # extract_largest_cluster[:] >> cloud2msg[:], # cloud2msg[:] >> cloud_pub[:]) # # run_plasm(options, plasm, locals=vars()) plasm.connect( cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> nan_filter[:], nan_filter[:] >> voxel_grid[:], voxel_grid[:] >> extract_clusters[:], extract_clusters[:] >> extract_largest_cluster["clusters"], voxel_grid[:] >> extract_largest_cluster["input"], extract_largest_cluster["output"] >> 'out') run_plasm(options, plasm, locals=output)
def parse_args(): epilog = textwrap.dedent( '''Capturing requires a ROS openni device (http://ros.org/wiki/openni), with registered rgb and depth. You may want to do the following before capturing data with this program: $ roslaunch openni_launch openni.launch In a seperate terminal: $ rosrun dynamic_reconfigure dynparam set /camera/driver depth_registration True To switch into high resolution mode: $ rosrun dynamic_reconfigure dynparam set /camera/driver image_mode 1 To switch to vga mode: $ rosrun dynamic_reconfigure dynparam set /camera/driver image_mode 2 ''') parser = argparse.ArgumentParser( formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent( '''Captures data appropriate for training object recognition pipelines. Assumes an opposing dot pattern, (black dots on white background, white dots on black background), is the scene, and captures views of the object sparsely, depending on the delta setting.'''), ) parser.add_argument( '-o', '--output', metavar='BAG_FILE', dest='bag', type=str, default='', help='A bagfile to write to.') parser.add_argument( '-a', '--angle_thresh', metavar='RADIANS', dest='angle_thresh', type=float, default=math.pi / 36, help='''The delta angular threshold in pose. Default is pi/36 radians. Frames will not be recorded unless they are not closer to any other pose by this amount. ''') from ecto.opts import scheduler_options #add ecto scheduler args. group = parser.add_argument_group('ecto scheduler options') scheduler_options(group, default_scheduler='Threadpool') args = parser.parse_args() if len(args.bag) < 1: print parser.print_help() sys.exit(1) return args
def parse_args(): import argparse parser = argparse.ArgumentParser(description='Test orb on images.') parser.add_argument('train', help='train image.') parser.add_argument('test', help='test image.') parser.add_argument('output', help='the output dir.') scheduler_options(parser.add_argument_group('Scheduler'), default_niter=1) options = parser.parse_args() return options
def __init__(self): ecto_ros.init(sys.argv, "ecto_pcl_demo") parser = argparse.ArgumentParser( description='My awesome program thing.') scheduler_options(parser) options = parser.parse_args() plasm = ecto.Plasm() voxel_grid = VoxelGrid("voxel_grid", leaf_size=0.01) passthru_z = PassThrough("passthru_z", filter_field_name="z", filter_limit_min=0.0, filter_limit_max=1.0) passthru_x = PassThrough("passthru_x", filter_field_name="x", filter_limit_min=-0.25, filter_limit_max=0.25) passthru_y = PassThrough("passthru_y", filter_field_name="y", filter_limit_min=-0.25, filter_limit_max=0.25) cropper = Cropper("cropper", x_min=-0.25, x_max=0.25, y_min=-0.25, y_max=0.25, z_min=0.0, z_max=1.0) viewer = CloudViewer("viewer", window_name="Clouds!") cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2( "cloud_sub", topic_name='/camera/depth_registered/points') msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2( "cloud_pub", topic_name='/ecto_pcl/sample_output') plasm.connect( cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> voxel_grid[:], voxel_grid[:] >> passthru_z[:], passthru_z[:] >> passthru_x[:], passthru_x[:] >> passthru_y[:], passthru_y[:] >> cloud2msg[:], cloud2msg[:] >> cloud_pub[:]) # plasm.connect(cloud_sub[:] >> msg2cloud[:], # msg2cloud[:] >> voxel_grid[:], # voxel_grid[:] >> cropper[:], # cropper[:] >> cloud2msg[:], # cloud2msg[:] >> cloud_pub[:]) run_plasm(options, plasm, locals=vars())
def __init__(self): ecto_ros.init(sys.argv, "ecto_pcl_demo") parser = argparse.ArgumentParser( description='Ecto Euclidean Clustering') scheduler_options(parser) options = parser.parse_args() plasm = ecto.Plasm() voxel_grid = VoxelGrid("voxel_grid", leaf_size=0.015) cropper = Cropper("cropper", x_min=-0.25, x_max=0.25, y_min=-0.25, y_max=0.25, z_min=0.3, z_max=1.0) passthru_z = PassThrough("passthru_z", filter_field_name="z", filter_limit_min=0.3, filter_limit_max=1.0) passthru_x = PassThrough("passthru_x", filter_field_name="x", filter_limit_min=-0.25, filter_limit_max=0.25) passthru_y = PassThrough("passthru_y", filter_field_name="y", filter_limit_min=-0.25, filter_limit_max=0.25) extract_clusters = EuclideanClusterExtraction("extract_clusters", min_cluster_size=50, cluster_tolerance=0.02) nan_filter = PassThrough("nan_removal") colorize = ColorizeClusters("colorize", max_clusters=100) cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2( "cloud_sub", topic_name='/camera/depth_registered/points') msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2( "cloud_pub", topic_name='/ecto_pcl/cloud_filtered') plasm.connect( cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> nan_filter[:], nan_filter[:] >> voxel_grid[:], voxel_grid[:] >> cropper[:], cropper["output"] >> extract_clusters["input"], extract_clusters[:] >> colorize["clusters"], cropper[:] >> colorize["input"], colorize[:] >> cloud2msg[:], cloud2msg[:] >> cloud_pub[:]) run_plasm(options, plasm, locals=vars())
def __init__(self): ecto_ros.init(sys.argv,"ecto_pcl_demo") # Create the argument parser parser = argparse.ArgumentParser(description='Ecto Euclidean Clustering') # Use the parser to create scheduler options scheduler_options(parser) options = parser.parse_args() # Create the overall plasm plasm = ecto.Plasm() # A VoxelGrid cell voxel_grid = ecto_pcl.VoxelGrid("voxel_grid", leaf_size=0.01) # A Cropper cell cropper = ecto_pcl.Cropper("cropper", x_min=-0.35, x_max=0.35, y_min=-0.35, y_max=0.35, z_min=0.3, z_max=1.5) # A EuclideanClusterExtraction cell extract_clusters = ecto_pcl.EuclideanClusterExtraction("extract_clusters", min_cluster_size=50, cluster_tolerance=0.02) # A cell to filter NaN values from the point cloud nan_filter = ecto_pcl.PassThrough("nan_removal") # A cell to colorize the clusters colorize = ecto_pcl.ColorizeClusters("colorize", max_clusters=100) # Create the subscriber cell with the appropriate point cloud topic cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2("cloud_sub", topic_name='camera/depth_registered/points') # A cell to convert a point cloud ROS message to an Ecto/PCL point cloud object msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) # A cell to convert a Ecto/PCL point cloud back to a point cloud message cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") # A cell to convert a point cloud ROS message to an Ecto/PCL point cloud object cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2("cloud_pub",topic_name='ecto_pcl/cloud_filtered') # Create the plasm by connecting the cells plasm.connect(cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> nan_filter[:], nan_filter[:] >> voxel_grid[:], voxel_grid[:] >> cropper[:], cropper[:] >> extract_clusters[:], extract_clusters[:] >> colorize["clusters"], cropper[:] >> colorize["input"], colorize[:] >> cloud2msg[:], cloud2msg[:] >> cloud_pub[:]) # Run the plasm run_plasm(options, plasm, locals=vars())
def parse_args(): import argparse parser = argparse.ArgumentParser(description='Test orb on images.') parser.add_argument('-i,--input', dest='input', help='The input dir. %(default)s', default='./images') parser.add_argument('-o,--output', dest='output', type=str, help='The output directory for this template. Default: %(default)s', default='./') factory = cell_options(parser, ORB, 'ORB') scheduler_options(parser.add_argument_group('Scheduler'), default_niter=1) options = parser.parse_args() options.niter = 1 options.orb_factory = factory return options
def __init__(self): ecto_ros.init(sys.argv, "ecto_pcl_demo") # Create the argument parser parser = argparse.ArgumentParser(description="Ecto PCL Demo") # Use the parser to create scheduler options scheduler_options(parser) options = parser.parse_args() # Create the overall plasm plasm = ecto.Plasm() # Create three PassThrough cells along the x, y and z dimensions passthru_z = ecto_pcl.PassThrough( "passthru_z", filter_field_name="z", filter_limit_min=0.0, filter_limit_max=1.0 ) passthru_x = ecto_pcl.PassThrough( "passthru_x", filter_field_name="x", filter_limit_min=-0.25, filter_limit_max=0.25 ) passthru_y = ecto_pcl.PassThrough( "passthru_y", filter_field_name="y", filter_limit_min=-0.25, filter_limit_max=0.25 ) # Create the subscriber cell with the appropriate point cloud topic cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2("cloud_sub", topic_name="camera/depth_registered/points") # A cell to convert a point cloud ROS message to an Ecto/PCL point cloud object msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) # A cell to convert a point cloud ROS message to an Ecto/PCL point cloud object cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") # A publisher cell with the desired topic name cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2("cloud_pub", topic_name="ecto_pcl/cloud_filtered") # Create the plasm by connecting the cells plasm.connect( cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> passthru_z[:], passthru_z[:] >> passthru_x[:], passthru_x[:] >> passthru_y[:], passthru_y[:] >> cloud2msg[:], cloud2msg[:] >> cloud_pub[:], ) # Run the plasm run_plasm(options, plasm, locals=vars())
def __init__(self): ecto_ros.init(sys.argv,"ecto_pcl_demo") parser = argparse.ArgumentParser(description='Ecto Largest Cluster') scheduler_options(parser) options = parser.parse_args() plasm = ecto.Plasm() voxel_grid = VoxelGrid("voxel_grid", leaf_size=0.015) cropper = Cropper("cropper", x_min=-0.25, x_max=0.25, y_min=-0.25, y_max=0.25, z_min=0.0, z_max=1.0) extract_clusters = EuclideanClusterExtraction("extract_clusters", min_cluster_size=50, cluster_tolerance=0.02) extract_largest_cluster = ExtractLargestCluster("extract_largest_cluster") nan_filter = PassThrough("nan_removal") colorize = ColorizeClusters("colorize", max_clusters=100) extract_indices = ExtractIndices("extract_indices", negative=False) cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2("cloud_sub", topic_name='/camera/depth_registered/points') msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2("cloud_pub",topic_name='/ecto_pcl/cloud_filtered') output = ecto_pcl.XYZRGB # plasm.connect(cloud_sub[:] >> msg2cloud[:], # msg2cloud[:] >> nan_filter[:], # nan_filter[:] >> voxel_grid[:], # voxel_grid[:] >> extract_clusters[:], # extract_clusters[:] >> extract_largest_cluster["clusters"], # voxel_grid[:] >> extract_largest_cluster["input"], # extract_largest_cluster[:] >> cloud2msg[:], # cloud2msg[:] >> cloud_pub[:]) # # run_plasm(options, plasm, locals=vars()) plasm.connect(cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> nan_filter[:], nan_filter[:] >> voxel_grid[:], voxel_grid[:] >> extract_clusters[:], extract_clusters[:] >> extract_largest_cluster["clusters"], voxel_grid[:] >> extract_largest_cluster["input"], extract_largest_cluster["output"] >> 'out') run_plasm(options, plasm, locals=output)
def __init__(self): ecto_ros.init(sys.argv,"ecto_pcl_demo") parser = argparse.ArgumentParser(description='My awesome program thing.') scheduler_options(parser) options = parser.parse_args() plasm = ecto.Plasm() voxel_grid = VoxelGrid("voxel_grid", leaf_size=0.01) cropper = Cropper("cropper", x_min=-0.25, x_max=0.25, y_min=-0.25, y_max=0.25, z_min=0.0, z_max=1.0) convex_hull = ConvexHull("convex_hull") ror = RadiusOutlierRemoval("ror", min_neighbors=1, search_radius=1.0) sor = StatisticalOutlierRemoval("sor", mean_k=1) extract_indices = ExtractIndices("extract_indices", negative=False) extract_clusters = EuclideanClusterExtraction("extract_clusters", min_cluster_size=50, cluster_tolerance=0.005) extract_largest_cluster = ExtractLargestCluster("extract_largest_cluster") cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2("cloud_sub", topic_name='/camera/depth_registered/points') msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2("cloud_pub",topic_name='/ecto_pcl/sample_output') plasm.connect(cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> extract_clusters[:], extract_clusters[:] >> extract_largest_cluster["clusters"], msg2cloud[:] >> extract_largest_cluster["input"], extract_largest_cluster[:] >> cloud2msg[:], cloud2msg[:] >> cloud_pub[:]) # plasm.connect(cloud_sub[:] >> msg2cloud[:], # msg2cloud[:] >> voxel_grid[:], # msg2cloud[:] >> extract_indices["input"], # voxel_grid[:] >> cropper[:], # cropper[:] >> extract_clusters[:], # extract_indices[:] >> extract_clusters[:], # extract_clusters[:] >> extract_largest_cluster["clusters"], # cropper[:] >> extract_largest_cluster["input"], # extract_largest_cluster[:] >> cloud2msg[:], # cloud2msg[:] >> cloud_pub[:]) run_plasm(options, plasm, locals=vars())
def execute_detection(cmd,path): parser = create_parser() # add ecto options scheduler_options(parser) pid = os.getpid() print("pid = ", pid) args = parser.parse_args(['-c', cmd]) args = parser.parse_args(['--config_file', path]) # create the plasm that will run the detection # args = parser.parse_args() ork_params, _args = read_arguments(args) plasm = create_plasm(ork_params) # run the detection plasm run_plasm(args, plasm) print "Exit Finished"
def __init__(self): ecto_ros.init(sys.argv, "ecto_pcl_demo") # Create the argument parser parser = argparse.ArgumentParser(description='Ecto PCL Cropper Demo') # Use the parser to create scheduler options scheduler_options(parser) options = parser.parse_args() # Create the overall plasm plasm = ecto.Plasm() # Create the Cropper cell with the desired dimensions (in meters) cropper = ecto_pcl.Cropper("cropper", x_min=-0.25, x_max=0.25, y_min=-0.25, y_max=0.25, z_min=0.0, z_max=1.0) # Create the subscriber cell with the appropriate point cloud topic cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2( "cloud_sub", topic_name='camera/depth_registered/points') # A cell to convert a point cloud ROS message to an Ecto/PCL point cloud object msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) # A cell to convert a point cloud ROS message to an Ecto/PCL point cloud object cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") # A publisher cell with the desired topic name cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2( "cloud_pub", topic_name='ecto_pcl/cloud_filtered') # Create the plasm by connecting the cells plasm.connect(cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> cropper[:], cropper[:] >> cloud2msg[:], cloud2msg[:] >> cloud_pub[:]) # Run the plasm run_plasm(options, plasm, locals=vars())
def __init__(self): ecto_ros.init(sys.argv, "ecto_pcl_demo") parser = argparse.ArgumentParser(description="My awesome program thing.") scheduler_options(parser) options = parser.parse_args() plasm = ecto.Plasm() voxel_grid = VoxelGrid("voxel_grid", leaf_size=0.01) passthru_z = PassThrough("passthru_z", filter_field_name="z", filter_limit_min=0.0, filter_limit_max=1.0) passthru_x = PassThrough("passthru_x", filter_field_name="x", filter_limit_min=-0.25, filter_limit_max=0.25) passthru_y = PassThrough("passthru_y", filter_field_name="y", filter_limit_min=-0.25, filter_limit_max=0.25) cropper = Cropper("cropper", x_min=-0.25, x_max=0.25, y_min=-0.25, y_max=0.25, z_min=0.0, z_max=1.0) viewer = CloudViewer("viewer", window_name="Clouds!") cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2("cloud_sub", topic_name="/camera/depth_registered/points") msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2("cloud_pub", topic_name="/ecto_pcl/sample_output") plasm.connect( cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> voxel_grid[:], voxel_grid[:] >> passthru_z[:], passthru_z[:] >> passthru_x[:], passthru_x[:] >> passthru_y[:], passthru_y[:] >> cloud2msg[:], cloud2msg[:] >> cloud_pub[:], ) # plasm.connect(cloud_sub[:] >> msg2cloud[:], # msg2cloud[:] >> voxel_grid[:], # voxel_grid[:] >> cropper[:], # cropper[:] >> cloud2msg[:], # cloud2msg[:] >> cloud_pub[:]) run_plasm(options, plasm, locals=vars())
def __init__(self): ecto_ros.init(sys.argv,"ecto_pcl_demo") # Create the argument parser parser = argparse.ArgumentParser(description='Ecto PCL Demo') # Use the parser to create scheduler options scheduler_options(parser) options = parser.parse_args() # Create the overall plasm plasm = ecto.Plasm() # Create three PassThrough cells along the x, y and z dimensions passthru_z = ecto_pcl.PassThrough("passthru_z", filter_field_name="z", filter_limit_min=0.0, filter_limit_max=1.0) passthru_x = ecto_pcl.PassThrough("passthru_x", filter_field_name="x", filter_limit_min=-0.25, filter_limit_max=0.25) passthru_y = ecto_pcl.PassThrough("passthru_y", filter_field_name="y", filter_limit_min=-0.25, filter_limit_max=0.25) # Create the subscriber cell with the appropriate point cloud topic cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2("cloud_sub", topic_name='camera/depth_registered/points') # A cell to convert a point cloud ROS message to an Ecto/PCL point cloud object msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) # A cell to convert a point cloud ROS message to an Ecto/PCL point cloud object cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") # A publisher cell with the desired topic name cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2("cloud_pub",topic_name='ecto_pcl/cloud_filtered') # Create the plasm by connecting the cells plasm.connect(cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> passthru_z[:], passthru_z[:] >> passthru_x[:], passthru_x[:] >> passthru_y[:], passthru_y[:] >> cloud2msg[:], cloud2msg[:] >> cloud_pub[:]) # Run the plasm run_plasm(options, plasm, locals=vars())
def parse_args(): parser = argparse.ArgumentParser(description='Computes a surface mesh of an object in the database') parser.add_argument('-s', '--session_id', metavar='SESSION_ID', dest='session_id', type=str, default='', help='The session id to reconstruct.') parser.add_argument('--all', dest='compute_all', action='store_const', const=True, default=False, help='Compute meshes for all possible sessions.') parser.add_argument('--visualize', dest='visualize', action='store_const', const=True, default=False, help='Turn on visiualization') object_recognition.dbtools.add_db_arguments(parser) sched_group = parser.add_argument_group('Scheduler Options') from ecto.opts import scheduler_options scheduler_options(sched_group, default_scheduler='Threadpool') args = parser.parse_args() if args.compute_all == False and args.session_id == '': parser.print_usage() print "You must either supply a session id, or --all." sys.exit(1) return args
def __init__(self): ecto_ros.init(sys.argv,"ecto_pcl_demo") parser = argparse.ArgumentParser(description='Ecto Euclidean Clustering') scheduler_options(parser) options = parser.parse_args() plasm = ecto.Plasm() voxel_grid = VoxelGrid("voxel_grid", leaf_size=0.015) cropper = Cropper("cropper", x_min=-0.25, x_max=0.25, y_min=-0.25, y_max=0.25, z_min=0.3, z_max=1.0) passthru_z = PassThrough("passthru_z", filter_field_name="z", filter_limit_min=0.3, filter_limit_max=1.0) passthru_x = PassThrough("passthru_x", filter_field_name="x", filter_limit_min=-0.25, filter_limit_max=0.25) passthru_y = PassThrough("passthru_y", filter_field_name="y", filter_limit_min=-0.25, filter_limit_max=0.25) extract_clusters = EuclideanClusterExtraction("extract_clusters", min_cluster_size=50, cluster_tolerance=0.02) nan_filter = PassThrough("nan_removal") colorize = ColorizeClusters("colorize", max_clusters=100) cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2("cloud_sub", topic_name='/camera/depth_registered/points') msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2("cloud_pub",topic_name='/ecto_pcl/cloud_filtered') plasm.connect(cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> nan_filter[:], nan_filter[:] >> voxel_grid[:], voxel_grid[:] >> cropper[:], cropper["output"] >> extract_clusters["input"], extract_clusters[:] >> colorize["clusters"], cropper[:] >> colorize["input"], colorize[:] >> cloud2msg[:], cloud2msg[:] >> cloud_pub[:]) run_plasm(options, plasm, locals=vars())
def parse_args(): ''' Setup some argparse stuffs.''' import argparse import textwrap parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent(''' Captures data appropriate for training object recognition pipelines. Press 's' to save a bundle of messages to the bag.'''), ) parser.add_argument('-o', '--output', metavar='BAG_FILE', dest='bag', type=str, default='', help='A bagfile to write to.') from ecto.opts import scheduler_options #add ecto scheduler args. group = parser.add_argument_group('ecto scheduler options') scheduler_options(group, default_scheduler='Threadpool') args = parser.parse_args() if len(args.bag) < 1: print parser.print_help() print "Missing output filename." sys.exit(1) return args
def __init__(self): ecto_ros.init(sys.argv,"ecto_pcl_demo") # Create the argument parser parser = argparse.ArgumentParser(description='Ecto PCL Cropper Demo') # Use the parser to create scheduler options scheduler_options(parser) options = parser.parse_args() # Create the overall plasm plasm = ecto.Plasm() # Create the Cropper cell with the desired dimensions (in meters) cropper = ecto_pcl.Cropper("cropper", x_min=-0.25, x_max=0.25, y_min=-0.25, y_max=0.25, z_min=0.0, z_max=1.0) # Create the subscriber cell with the appropriate point cloud topic cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2("cloud_sub", topic_name='camera/depth_registered/points') # A cell to convert a point cloud ROS message to an Ecto/PCL point cloud object msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) # A cell to convert a point cloud ROS message to an Ecto/PCL point cloud object cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") # A publisher cell with the desired topic name cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2("cloud_pub",topic_name='ecto_pcl/cloud_filtered') # Create the plasm by connecting the cells plasm.connect(cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> cropper[:], cropper[:] >> cloud2msg[:], cloud2msg[:] >> cloud_pub[:]) # Run the plasm run_plasm(options, plasm, locals=vars())
def do_ecto(): # ecto options parser = argparse.ArgumentParser( description='Publish images from directory.') scheduler_options(parser) args = parser.parse_args() #this will read all images in the path path = '/home/sam/Code/vision/VOCdevkit/VOC2012/JPEGImages' images = ImageReader(path=os.path.expanduser(path)) mat2image = ecto_ros.Mat2Image(encoding='rgb8') pub_rgb = ImagePub("image_pub", topic_name='/camera/rgb/image_raw') display = imshow(name='image', waitKey=5000) plasm = ecto.Plasm() plasm.connect( images['image'] >> mat2image['image'], images['image'] >> display['image'], mat2image['image'] >> pub_rgb['input'], ) ecto.view_plasm(plasm) run_plasm(args, plasm, locals=vars())
import ecto, ecto_pcl, ecto_ros, ecto_pcl_ros import ecto_ros.ecto_sensor_msgs as ecto_sensor_msgs from ecto.opts import scheduler_options, run_plasm import sys import time import os import argparse import cloud_treatment_ecto.cloud_treatment as cloud_treatment ecto_ros.init(sys.argv, "locate_ladder") parser = argparse.ArgumentParser(description='Treatment that segments the' 'ladder steps from the rest on the scene') scheduler_options(parser) parser.add_argument('-p', '--pcdfile', default='ladder_test_5.pcd', help='The pcdfile to input') options = parser.parse_args() pcdfilename = options.pcdfile plasm = ecto.Plasm() reader = cloud_treatment.PCDReaderCell("Reader_ecto", filename=pcdfilename) cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2( "cloud_sub", topic_name='/worldmodel_main/pointcloud_vis') msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud",
description='Saves images from a connect on keystroke.') parser.add_argument('-o,--output', dest='output', help='The output directory. Default: %(default)s', default='./images/%s' % (time.strftime('%Y-%b-%d-%H.%M.%S'))) parser.add_argument('-d,--device', dest='device', default=0, help='The video device number. Default: %(default)s') parser.add_argument('--width', dest='width', default=640) parser.add_argument('--height', dest='height', default=480) parser.add_argument('--preview', action='store_true') #ecto options scheduler_options(parser.add_argument_group('Scheduler Options')) args = parser.parse_args() if not os.path.exists(args.output): os.makedirs(args.output) #camera = VideoCapture(video_device=1,width=int(args.width),height=int(args.height)) source = create_source( package_name='image_pipeline', source_type='OpenNISource') #optionally pass keyword args here... depth_saver = ImageSaver( filename_format=os.path.join(args.output, 'frame_%010d_depth.png')) image_saver = ImageSaver( filename_format=os.path.join(args.output, 'frame_%010d_image.png')) #mono_saver = ImageSaver(filename_format=os.path.join(args.output, 'frame_%010d_mono.png'))
import argparse parser = argparse.ArgumentParser(description='My awesome program thing.') #our local command line args. parser.add_argument('--value', metavar='VALUE', dest='value', type=float, default=3, help='A value to use a constant.') parser.add_argument('--factor', metavar='FACTOR', dest='factor', type=float, default=5, help='The factor to multiply the constant with.') #add ecto scheduler args. group = parser.add_argument_group('ecto scheduler options') scheduler_options(group) options = parser.parse_args() c = Constant(value=options.value) m = Multiply(factor=options.factor) pr = Printer() plasm = ecto.Plasm() plasm.connect(c[:] >> m[:], m[:] >> pr[:]) #run the scheduler given the options, plasm, and our local variables. run_plasm(options, plasm, locals=vars())
import ecto, ecto_pcl, ecto_ros, ecto_pcl_ros import ecto_ros.ecto_sensor_msgs as ecto_sensor_msgs from ecto.opts import scheduler_options, run_plasm import sys import time import os import argparse import cloud_treatment_ecto.cloud_treatment as cloud_treatment ecto_ros.init(sys.argv, "locate_ladder") parser = argparse.ArgumentParser(description='Treatment that segments the' 'ladder steps from the rest on the scene') scheduler_options(parser) parser.add_argument('-p', '--pcdfile' , default='ladder_test_5.pcd', help='The pcdfile to input') options = parser.parse_args() pcdfilename = options.pcdfile plasm = ecto.Plasm() reader = cloud_treatment.PCDReaderCell( "Reader_ecto", filename=pcdfilename) cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2("cloud_sub", topic_name='/worldmodel_main/pointcloud_vis') msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) cloud2msg_main = ecto_pcl_ros.PointCloud2Message("cloud2msg_main")
def __init__(self): ecto_ros.init(sys.argv,"ecto_tracker") parser = argparse.ArgumentParser(description='Ecto Tracker.') scheduler_options(parser) options = parser.parse_args() plasm = ecto.Plasm() voxel_grid = VoxelGrid("voxel_grid", leaf_size=0.01) passthru_z = PassThrough("passthru_z", filter_field_name="z", filter_limit_min=0.2, filter_limit_max=1.0) passthru_x = PassThrough("passthru_x", filter_field_name="x", filter_limit_min=-0.5, filter_limit_max=0.5) passthru_y = PassThrough("passthru_y", filter_field_name="y", filter_limit_min=-0.5, filter_limit_max=0.5) nan_filter = PassThrough("nan_removal") cropper = Cropper("cropper", x_min=-0.5, x_max=0.5, y_min=-0.5, y_max=0.5, z_min=0.0, z_max=1.0) #convex_hull = ConvexHull("convex_hull") # extract_stuff = ExtractPolygonalPrismData("extract_stuff", height_min=0.01, height_max=0.2) extract_indices = ExtractIndices("extract_indices", negative=False) extract_clusters = EuclideanClusterExtraction("extract_clusters", min_cluster_size=50, cluster_tolerance=0.005) extract_largest_cluster = ExtractLargestCluster("extract_largest_cluster") colorize = ColorizeClusters("colorize", max_clusters=3) merge = MergeClouds("merge") viewer = CloudViewer("viewer", window_name="Clouds!") # cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2("cloud_sub", topic_name='/camera/depth_registered/points') msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2("cloud_pub",topic_name='/ecto_pcl/sample_output') # plasm.connect(cloud_sub["output"] >> msg2cloud[:], # msg2cloud[:] >> voxel_grid[:], ## voxel_grid[:] >> extract_indices[:], # voxel_grid[:] >> cloud2msg[:], # cloud2msg[:] >> cloud_pub[:],) # ## plasm += [voxel_grid['output'] >> extract_clusters[:], ## extract_clusters[:] >> colorize["clusters"], ## cloud_generator[:] >> merge["input"], ## colorize[:] >> merge["input2"], ## colorize[:] >> viewer[:] ## ] # # plasm.connect(cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> voxel_grid[:], voxel_grid[:] >> cropper[:], cropper[:] >> extract_clusters[:], msg2cloud[:] >> extract_indices["input"], extract_clusters[:] >> colorize["clusters"], extract_indices[:] >> colorize["input"], msg2cloud[:] >> merge["input"], colorize[:] >> merge["input2"], merge[:] >> cloud2msg[:], cloud2msg[:] >> cloud_pub[:],) # plasm.connect(cloud_sub["output"] >> msg2cloud[:], # msg2cloud[:] >> voxel_grid[:], # #voxel_grid[:] >> nan_filter[:], # #nan_filter[:] >> extract_indices["indices"], # voxel_grid[:] >> extract_indices["indices"], # msg2cloud[:] >> extract_indices["input"],) # #extract_indices[:] >> extract_clusters[:],) ## extract_clusters[:] >> colorize["clusters"], ## extract_indices[:] >> colorize["input"], ## msg2cloud[:] >> merge["input"], ## colorize[:] >> merge["input2"], ## colorize[:] >> viewer[:],) # plasm.connect(cloud_sub["output"] >> msg2cloud[:], # msg2cloud[:] >> voxel_grid["input"], # voxel_grid["output"] >> passthru_z["input"], # passthru_z["output"] >> passthru_x["input"], # passthru_x["output"] >> passthru_y["input"], # passthru_y["output"] >> extract_indices["input"], # passthru_y["output"] >> extract_clusters["input"], # extract_clusters[:] >> colorize["clusters"], # extract_indices[:] >> colorize["input"], # msg2cloud[:] >> merge["input"], # colorize[:] >> merge["input2"], # colorize[:] >> viewer[:],) # # #passthru_y["output"] >> cloud2msg[:], # #cloud2msg[:] >> cloud_pub[:],) run_plasm(options, plasm, locals=vars()) #sched = ecto.Scheduler(plasm) #sched.execute_async() time.sleep(10)
# import ecto import ecto_test import yaml import argparse from ecto.opts import scheduler_options, CellYamlFactory, cell_options, run_plasm parser = argparse.ArgumentParser(description='My awesome program thing.') parser.add_argument('-i,--input', metavar='IMAGE_FILE', dest='imagefile', type=str, default='', help='an image file to load.') group = parser.add_argument_group('ecto scheduler options') scheduler_options(group, default_niter=2) multiply_factory = cell_options(parser, ecto_test.Multiply, prefix='mult') const_factory = cell_options(parser, ecto.Constant(value=0.50505), prefix='const') options = parser.parse_args() print options.mult_factor assert options.mult_factor == 3.14 c = const_factory(options) m = multiply_factory(options) cyaml = CellYamlFactory(c, 'const') print cyaml.dump() c = cyaml.load(yaml.load(cyaml.dump()))
import ecto from ecto.opts import scheduler_options, run_plasm from ecto import Constant from ecto_test import Multiply, Printer import argparse parser = argparse.ArgumentParser(description='My awesome program thing.') #our local command line args. parser.add_argument('--value', metavar='VALUE', dest='value', type=float, default=3, help='A value to use a constant.') parser.add_argument('--factor', metavar='FACTOR', dest='factor', type=float, default=5, help='The factor to multiply the constant with.') #add ecto scheduler args. group = parser.add_argument_group('ecto scheduler options') scheduler_options(group) options = parser.parse_args() c = Constant(value=options.value) m = Multiply(factor=options.factor) pr = Printer() plasm = ecto.Plasm() plasm.connect(c[:] >> m[:], m[:] >> pr[:] ) #run the scheduler given the options, plasm, and our local variables. run_plasm(options, plasm, locals=vars())
def __init__(self): ecto_ros.init(sys.argv,"ecto_pcl_demo") # Create the argument parser parser = argparse.ArgumentParser(description='Ecto Tabletop Segmentation') # Use the parser to create scheduler options scheduler_options(parser) options = parser.parse_args() # Create the overall plasm plasm = ecto.Plasm() cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2("cloud_sub", topic_name='/camera/depth_registered/points') msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2("cloud_pub",topic_name='ecto_pcl/cloud_filtered') voxel_grid = VoxelGrid("voxel_grid", leaf_size=0.01) graph = [cloud_sub["output"] >> msg2cloud[:], msg2cloud[:] >> voxel_grid[:] ] # estimate normals, segment and find convex hull normals = NormalEstimation("normals", k_search=0, radius_search=0.02) planar_segmentation = SACSegmentationFromNormals("planar_segmentation", model_type=SACMODEL_NORMAL_PLANE, eps_angle=0.09, distance_threshold=0.1) project_inliers = ProjectInliers("project_inliers", model_type=SACMODEL_NORMAL_PLANE) nan_filter = PassThrough('nan_removal') convex_hull = ConvexHull("convex_hull") graph += [voxel_grid[:] >> normals[:], voxel_grid[:] >> planar_segmentation["input"], normals[:] >> planar_segmentation["normals"], voxel_grid[:] >> project_inliers["input"], planar_segmentation["model"] >> project_inliers["model"], project_inliers[:] >> nan_filter[:], nan_filter[:] >> convex_hull[:] ] # extract stuff on table from original high-res cloud and show in viewer extract_stuff = ExtractPolygonalPrismData("extract_stuff", height_min=0.01, height_max=0.2) extract_indices = ExtractIndices("extract_indices", negative=False) viewer = CloudViewer("viewer", window_name="Clouds!") graph += [msg2cloud[:] >> extract_stuff["input"], convex_hull[:] >> extract_stuff["planar_hull"], extract_stuff[:] >> extract_indices["indices"], msg2cloud[:] >> extract_indices["input"], extract_indices[:] >> cloud2msg[:], cloud2msg[:] >> cloud_pub[:] ] plasm.connect(graph) # Run the plasm run_plasm(options, plasm, locals=vars())
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # import ecto import ecto.ecto_test as ecto_test import yaml import argparse from ecto.opts import scheduler_options, CellYamlFactory, cell_options, run_plasm parser = argparse.ArgumentParser(description='My awesome program thing.') parser.add_argument('-i,--input', metavar='IMAGE_FILE', dest='imagefile', type=str, default='', help='an image file to load.') group = parser.add_argument_group('ecto scheduler options') scheduler_options(group, default_niter=2) multiply_factory = cell_options(parser, ecto_test.Multiply, prefix='mult') const_factory = cell_options(parser, ecto.Constant(value=0.50505), prefix='const') options = parser.parse_args() print options.mult_factor assert options.mult_factor == 3.14 c = const_factory(options) m = multiply_factory(options) cyaml = CellYamlFactory(c,'const') print cyaml.dump() c = cyaml.load(yaml.load(cyaml.dump())) assert c.params.value == 0.50505
def __init__(self): ecto_ros.init(sys.argv, "ecto_pcl_demo") # Create the argument parser parser = argparse.ArgumentParser( description='Ecto Euclidean Clustering') # Use the parser to create scheduler options scheduler_options(parser) options = parser.parse_args() # Create the overall plasm plasm = ecto.Plasm() # A VoxelGrid cell voxel_grid = ecto_pcl.VoxelGrid("voxel_grid", leaf_size=0.01) # A Cropper cell cropper = ecto_pcl.Cropper("cropper", x_min=-0.35, x_max=0.35, y_min=-0.35, y_max=0.35, z_min=0.3, z_max=1.5) # A EuclideanClusterExtraction cell extract_clusters = ecto_pcl.EuclideanClusterExtraction( "extract_clusters", min_cluster_size=50, cluster_tolerance=0.02) # A cell to filter NaN values from the point cloud nan_filter = ecto_pcl.PassThrough("nan_removal") # A cell to colorize the clusters colorize = ecto_pcl.ColorizeClusters("colorize", max_clusters=100) # Create the subscriber cell with the appropriate point cloud topic cloud_sub = ecto_sensor_msgs.Subscriber_PointCloud2( "cloud_sub", topic_name='camera/depth_registered/points') # A cell to convert a point cloud ROS message to an Ecto/PCL point cloud object msg2cloud = ecto_pcl_ros.Message2PointCloud("msg2cloud", format=ecto_pcl.XYZRGB) # A cell to convert a Ecto/PCL point cloud back to a point cloud message cloud2msg = ecto_pcl_ros.PointCloud2Message("cloud2msg") # A cell to convert a point cloud ROS message to an Ecto/PCL point cloud object cloud_pub = ecto_sensor_msgs.Publisher_PointCloud2( "cloud_pub", topic_name='ecto_pcl/cloud_filtered') # Create the plasm by connecting the cells plasm.connect( cloud_sub[:] >> msg2cloud[:], msg2cloud[:] >> nan_filter[:], nan_filter[:] >> voxel_grid[:], voxel_grid[:] >> cropper[:], cropper[:] >> extract_clusters[:], extract_clusters[:] >> colorize["clusters"], cropper[:] >> colorize["input"], colorize[:] >> cloud2msg[:], cloud2msg[:] >> cloud_pub[:]) # Run the plasm run_plasm(options, plasm, locals=vars())
def parse_args(self): self.parser = argparse.ArgumentParser( description='Generate observations by 3d rendering.') dbtools.add_db_arguments(self.parser) scheduler_options(self.parser) self.options = self.parser.parse_args()
#!/usr/bin/env python import ecto from ecto_opencv.highgui import imshow, ImageSaver from image_pipeline.io.source import create_source from ecto.opts import run_plasm, scheduler_options import argparse import sys import os parser = argparse.ArgumentParser(description='Saves images from a connect on keystroke.') parser.add_argument('-o,--output', dest='output', help='The output directory. Default: %(default)s', default='./images') #ecto options scheduler_options(parser.add_argument_group('Scheduler Options')) args = parser.parse_args() if not os.path.exists(args.output): os.makedirs(args.output) source = create_source(package_name='image_pipeline', source_type='OpenNISource') #optionally pass keyword args here... depth_saver = ecto.If('depth saver', cell=ImageSaver(filename_format=os.path.join(args.output, 'depth%04d.png'))) image_saver = ecto.If('rgb saver', cell=ImageSaver(filename_format=os.path.join(args.output, 'image%04d.png'))) display = imshow(name='RGB', triggers=dict(save=ord('s'))) plasm = ecto.Plasm() plasm.connect(source['image'] >> (display['image'], image_saver['image']), source['depth'] >> (imshow(name='Depth')['image'], depth_saver['image']),