Esempio n. 1
0
    def __init__(self):
        self.regionFilter = hirop_perception.RegionFilters("regionFilter",
                                                           maxZ=2)
        self.pclFunsion = hirop_perception.PclFusion("pclFusion")
        self.rosSource = hirop_perception.PointCloudRos(
            'source',
            topic_name="/kinect2/qhd/points",
            world_frame='base_link')
        self.pclViewer = ecto_pcl.CloudViewer("viewer",
                                              window_name="PCD Viewer")
        self.saver = ecto_pcl.PCDWriter(
            "saver", filename_format="/home/eima/test_%04u.pcd", binary=True)
        self.loader = ecto_pcl.PCDReader("Reader",
                                         filename="/home/eima/test_0000.pcd")
        self.publisher = hirop_perception.PointCloudPublish(
            "publisher", topic_name="/filter_points", frame_id="base_link")
        self.objectFilter = hirop_perception.ObjectFilter("objectFilter",
                                                          frame_id="base_link",
                                                          hight=0.20,
                                                          width=0.13,
                                                          length=0.15)
        self.voxelFilter = hirop_perception.VoxelFilter("voxelFilter")

        self.lookPlasm = ecto.Plasm()
        self.lookPlasm.connect(self.rosSource["output"] >> self.regionFilter["input"], self.regionFilter["output"] >> self.voxelFilter["input"],\
                self.rosSource["R"] >> self.pclFunsion["R"], self.rosSource["T"] >> self.pclFunsion["T"],\
                self.voxelFilter["output"] >> self.pclFunsion["input"], self.pclFunsion["output"] >> self.objectFilter["input"], \
                self.objectFilter["output"] >> self.publisher["input"])

        self.savePlasm = ecto.Plasm()
        self.savePlasm.connect(self.rosSource["output"] >> self.pclFunsion["input"],\
         self.rosSource["T"] >>self.pclFunsion["T"], self.rosSource["R"] >>self.pclFunsion["R"], \
         self.pclFunsion["output"] >> self.saver["input"])

        self.loadPlasm = ecto.Plasm()
        self.loadPlasm.connect(self.loader["output"] >> self.pclFunsion["input"], \
         self.pclFunsion["output"] >> self.pclViewer["input"])

        self.testPlasm = ecto.Plasm()
        self.testPlasm.connect(self.rosSource["output"] >> self.pclFunsion["input"], self.pclFunsion["output"] >>  self.regionFilter["input"],\
           self.pclFunsion["output"] >>  self.pclViewer["input"])

        self.cleanPlasm = ecto.Plasm()
        self.cleanPlasm.connect(
            self.rosSource["output"] >> self.pclFunsion["input"],
            self.pclFunsion["output"] >> self.objectFilter["input"])

        self.keepRun = True
Esempio n. 2
0
#!/usr/bin/env python

import hirop_perecption.hirop_perception as hirop_perception
import ecto, ecto_pcl
import sys
import time
import os

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

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

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

filters = hirop_perception.RegionFilters("tester", maxZ=1)

fusion = hirop_perception.PclFusion()

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

saver = ecto_pcl.PCDWriter("Saver")

plasm.connect(reader["output"] >> fusion["input"],
              fusion["output"] >> viewer["input"])

if __name__ == "__main__":
    sched = ecto.Scheduler(plasm)
    sched.execute(niter=1)
    #sleep 10 seconds and exit.