Skip to content

Commit

Permalink
Fix skeleton gen
Browse files Browse the repository at this point in the history
  • Loading branch information
xuhao1 committed Jan 13, 2023
1 parent 8935e46 commit 5d616cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions taichi_slam/mapping/dense_tsdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ def process_new_pcl(self):
z = self.new_pcl_z[i, j, k]/c
self.occupy[self.sxyz_to_ijk(submap_id, pos_p)] = 1
ray_cast_voxels = ti.min(len_pos_s2p/self.voxel_scale+ti.static(self.internal_voxels), self.max_ray_length/self.voxel_scale)
j_f = ti.cast(ray_cast_voxels, ti.f32)/2
for _j in range(ray_cast_voxels/2, ray_cast_voxels):
j_f = 0.0
for _j in range(ray_cast_voxels):
j_f += 1.0
x_ = d_s2p*j_f*self.voxel_scale + self.input_T[None]
xi = self.sxyz_to_ijk(submap_id, x_)
Expand Down Expand Up @@ -301,8 +301,10 @@ def fuse_submaps_kernel(self, num_submaps: ti.i32, TSDF:ti.template(), W_TSDF:ti
coord = ijk_low+ti.Vector([0, di, dj, dk])
coord_f32 = ti.cast(coord, ti.f32)
weight = (1 - ti.abs(coord_f32[1] - ijk[0])) * (1 - ti.abs(coord_f32[2] - ijk[1])) * (1 - ti.abs(coord_f32[3] - ijk[2]))
self.fuse_with_interploation(coord, TSDF[s, i, j, k], W_TSDF[s, i, j, k]*weight, OCC[s, i, j, k], COLOR[s, i, j, k])

if ti.static(self.enable_texture):
self.fuse_with_interploation(coord, TSDF[s, i, j, k], W_TSDF[s, i, j, k]*weight, OCC[s, i, j, k], COLOR[s, i, j, k])
else:
self.fuse_with_interploation(coord, TSDF[s, i, j, k], W_TSDF[s, i, j, k]*weight, OCC[s, i, j, k], 0)

def reset(self):
self.B.parent().deactivate_all()
Expand Down
2 changes: 1 addition & 1 deletion taichi_slam/mapping/topo_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def add_mesh(self, mesh: ti.types.ndarray(), neighbors:ti.types.ndarray(), last_
for j in range(ti.static(3)):
self.tri_colors[facelet_idx*3 + j] = self.colormap[self.num_nodes[None]]
if self.facelets[facelet_idx].is_frontier:
self.tri_colors[facelet_idx*3 + j][3] = ti.static(self.transparent_frontier)
self.tri_colors[facelet_idx*3 + j][3] = self.transparent_frontier
new_node_center = center_pos/center_count
self.nodes[self.num_nodes[None]].init(self.num_nodes[None], last_node_idx, facelet_start_idx, facelet_start_idx + num_facelets, new_node_center)
if last_node_idx >= 0:
Expand Down

0 comments on commit 5d616cb

Please sign in to comment.