Skip to content

Commit

Permalink
Updating goos_vis
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmaral committed Oct 24, 2024
1 parent d44c165 commit a6d5c3a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions testing/goose_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,37 +136,35 @@ def vis_first_file() -> None:
vis.destroy_window()

def vis_sequences():

path_file_list = load_path_files(path)
num_files = len(path_file_list)
point_cloud = o3d.geometry.PointCloud()
update_pointcloud(path_file_list[0], point_cloud)

vis = o3d.visualization.VisualizerWithKeyCallback()
vis.create_window(window_name='PointCloud Sequence')
configure_visualizer(vis)

vis.add_geometry(point_cloud)

# Call to configure the camera view once the geometry has been added
configure_visualizer(vis)

frame = [0]
last_update_time = [time.time()] # Track the time of the last update

def update_frame(vis):
current_time = time.time()

if current_time - last_update_time[0] >= 0.001:
if current_time - last_update_time[0] >= 0.5: # Adjust the speed for faster updates
frame[0] += 1
if frame[0] >= num_files:
frame[0] = 0 # Reset to loop the sequence if desired
frame[0] = 0 # Loop the sequence if desired

update_pointcloud(path_file_list[frame[0]], point_cloud)
vis.update_geometry(point_cloud)
vis.poll_events()
vis.update_renderer()

last_update_time[0] = current_time # Update the time of the last update

# Set a timer callback to update the frame
# Register a callback for each frame
vis.register_animation_callback(lambda vis: update_frame(vis))

vis.run()
Expand Down

0 comments on commit a6d5c3a

Please sign in to comment.