-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpointcloud2gazebo_config.py
64 lines (47 loc) · 1.87 KB
/
pointcloud2gazebo_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from pathlib import Path
from traitlets import Float, Int
from traitlets.config.configurable import Configurable
from traitlets.config.loader import PyFileConfigLoader
CONFIG_FILE = "config/config.py"
class Crop(Configurable):
"""Configuration of Cropping
"""
# Minimum and maximum height of points to make Gazebo world.
min_z = Float(0.0).tag(config=True)
max_z = Float(2.0).tag(config=True)
def __init__(self, **kwargs):
super(Crop, self).__init__(**kwargs)
class NoiseRemoval(Configurable):
"""Configuration of Noise Removal
"""
# Number of points within the radius.
nb_points = Int(16).tag(config=True)
# Radius of the sphere.
radius = Float(0.1).tag(config=True)
def __init__(self, **kwargs):
super(NoiseRemoval, self).__init__(**kwargs)
class VoxelDownSample(Configurable):
"""Configuration of Voxel DownSampling
"""
# Voxel size(meter) to downsample into.
voxel_size = Float(0.05).tag(config=True)
def __init__(self, **kwargs):
super(VoxelDownSample, self).__init__(**kwargs)
class TriangleMesh(Configurable):
"""Configuration of TriangleMesh
"""
# Parameter to control the shape.
# A very big value will give a shape close to the convex hull.
alpha = Float(0.1).tag(config=True)
def __init__(self, **kwargs):
super(TriangleMesh, self).__init__(**kwargs)
class PointCloud2GazeboConfig(Configurable):
"""Configuration of PointCloud2Gazebo
"""
def __init__(self, **kwargs):
super(PointCloud2GazeboConfig, self).__init__(**kwargs)
self.config = PyFileConfigLoader(str(Path(CONFIG_FILE))).load_config()
self.crop = Crop(config=self.config)
self.noise_removal = NoiseRemoval(config=self.config)
self.voxel_down_sample = VoxelDownSample(config=self.config)
self.triangle_mesh = TriangleMesh(config=self.config)