Previous topic

Segment the objects from the plane, color them

Next topic

Using ecto_pcl with ROS

This Page

Display a point cloud from a PCD fileΒΆ

pcd_viewer.py

#!/usr/bin/env python

import ecto, ecto_pcl
import sys
import time
import os

plasm = ecto.Plasm()
pcdfile = os.path.join(os.path.dirname(__file__),
                       'cloud.pcd')

if len(sys.argv) > 1:
    pcdfile = sys.argv[1]

reader = ecto_pcl.PCDReader("Reader",
                            filename=pcdfile)

viewer = ecto_pcl.CloudViewer("viewer",
                              window_name="PCD Viewer")

plasm.connect(reader[:] >> viewer[:])

if __name__=="__main__":
    sched = ecto.schedulers.Threadpool(plasm)
    sched.execute(niter=1)
    #sleep 2 seconds and exit.
    time.sleep(2)

digraph G {
graph [rankdir=TB, ranksep=1]
edge [labelfontsize=8]
node [shape=plaintext]
0[label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">  <TR> <TD ROWSPAN="2" COLSPAN="1" BGCOLOR="khaki">Reader</TD> <TD PORT="p_filename" BGCOLOR="lightblue">filename</TD>
 </TR> <TR> <TD PORT="p_format" BGCOLOR="lightblue">format</TD> </TR>
 <TR>
<TD PORT="o_output" BGCOLOR="indianred1">output</TD>
</TR> </TABLE>>];
1[label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TR>
<TD PORT="i_input" BGCOLOR="springgreen">input</TD>
</TR> <TR> <TD ROWSPAN="1" COLSPAN="1" BGCOLOR="khaki">viewer</TD> <TD PORT="p_window_name" BGCOLOR="lightblue">window_name</TD>
 </TR>   </TABLE>>];
0->1 [headport="i_input" tailport="o_output"];
}