minor fixes of generator and mesh
This commit is contained in:
@@ -185,7 +185,6 @@ class GenLocationsOnMeshNode(Node):
|
||||
self.dropped_points = {}
|
||||
|
||||
self.declare_parameter('mesh_filename', '')
|
||||
self.declare_parameter('cache_filename', '')
|
||||
self.declare_parameter('init_number_of_points', 10)
|
||||
self.declare_parameter('max_z_coord', 2.)
|
||||
self.declare_parameter('min_distance_between_points', 2.)
|
||||
@@ -246,7 +245,7 @@ class GenLocationsOnMeshNode(Node):
|
||||
def _load_data(self):
|
||||
'''загрузка мэша и его предобработка'''
|
||||
# сначала пытаемся загрузить кэшированный вариант
|
||||
cache_filename = self.get_parameter('cache_filename').get_parameter_value().string_value
|
||||
cache_filename = self.get_parameter('mesh_filename').get_parameter_value().string_value + '.pkl'
|
||||
try:
|
||||
with open(cache_filename, 'rb') as f:
|
||||
dt = pickle.load(f)
|
||||
@@ -260,10 +259,11 @@ class GenLocationsOnMeshNode(Node):
|
||||
self.vs = mesh.vertices
|
||||
self.trs = get_all_triangles_with_correct_orientation(mesh.vertices,
|
||||
mesh.faces,
|
||||
0.1)
|
||||
conns = calc_connections(self.trs)
|
||||
pieces = calc_pieces(self.trs, conns)
|
||||
self.the_piece = find_largest_piece(pieces)
|
||||
1.5)
|
||||
#conns = calc_connections(self.trs)
|
||||
#pieces = calc_pieces(self.trs, conns)
|
||||
#self.the_piece = find_largest_piece(pieces)
|
||||
self.the_piece = list(range(len(self.trs)))
|
||||
# сохраняем кэш
|
||||
try:
|
||||
with open(cache_filename, 'wb') as f:
|
||||
|
||||
@@ -6,21 +6,17 @@ from launch_ros.substitutions import FindPackageShare
|
||||
|
||||
def generate_launch_description():
|
||||
package_name = 'gen_locations_on_mesh'
|
||||
#mesh_file = 'raw_surface.ply'
|
||||
mesh_file = 'sirius_scene_floor.ply'
|
||||
cache_file = 'cache.pkl'
|
||||
mesh_file = 'sirius_scene_floor_and_objs.ply'
|
||||
|
||||
# файл карты для загрузки
|
||||
pkg_share = FindPackageShare(package=package_name).find(package_name)
|
||||
mesh_path = os.path.join(pkg_share, 'share', mesh_file)
|
||||
cache_path = os.path.join(pkg_share, 'share', cache_file)
|
||||
|
||||
start_gen_location_on_mesh_cmd = Node(
|
||||
name='gen_locations_on_mesh',
|
||||
package='gen_locations_on_mesh',
|
||||
executable='gen_locations_on_mesh',
|
||||
parameters=[{'mesh_filename': mesh_path,
|
||||
'cache_filename': cache_path,
|
||||
'init_number_of_points': 20,
|
||||
'max_z_coord': 2.}])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user