Hello,
I am new in this forum. I have encountered a challenge that I’m unable to resolve and hope that someone might have a solution. Thus far, I’ve successfully created a platform, obstacles, and a couple of characters within Isaac Sim. These characters autonomously navigate to a target point defined in a text file, a process I learned from a video tutorial. However, I’m uncertain about how to extract specific data from the simulation, such as the length of the path between two points and the time taken to traverse this path. I’m looking for a tool within the software that can provide this statistical information in an Excel file, allowing me to analyze the numeric values
Thank you,
Hi @csevtekin - Are you following this video tutorial? 10.9. Agent Simulation Synthetic Data Generation — Omniverse IsaacSim latest documentation
Hi @rthaker,
I followed the documentation and, in addition to that, watched a video tutorial by @mati-nvidia
Based on that video, I managed to place points programmatically between the character (agent) and the goal path, recognizing all the obstacles, which is amazing.
My question is, is there a way to calculate the distance between the character (agent) and the goal point? Also, how can I calculate the time it takes for a character (agent) to walk from point A to point B along that path?
Ideally, I would like to compile this data in an Excel format to visualize information such as path length, time spent by the character, overall path length, and overall time spent by the character (including time spent looking around, defined in seconds).
I attempted to use the code below to calculate this and see the calculation in a txt format, but I couldn’t make it happen. I’m not sure what I am missing. For ‘Gf.Distance,’ I tried using ‘GF.PathLength,’ but so far, no success…"
import omni.anim.navigation.core as nav
import omni.usd
from pxr import Usd, UsdGeom, Gf
import time
# Acquire the navigation interface
stage = omni.usd.get_context().get_stage()
inav = nav.acquire_interface()
# Set the start and end points. If valid, new path points will be generated along the NavMesh.
start_point = (3, 3, 0)
end_point = (0, -3, 0)
# Measure the time it takes to compute the path
start_time = time.time()
path = inav.query_navmesh_path(start_point, end_point)
points = path.get_points()
end_time = time.time()
elapsed_time = end_time - start_time
# Calculate the length of the path
path_length = sum(Gf.Distance(points[i], points[i + 1]) for i in range(len(points) - 1))
# Print the results
print("Path Points:", points)
print("Elapsed Time:", elapsed_time)
print("Path Length:", path_length)
# Write data directly to a text file
text_file_path = 'simulation_data.txt'
with open(text_file_path, 'w') as file:
file.write("Elapsed Time: {}\n".format(elapsed_time))
file.write("Path Length: {}\n".format(path_length))
# Visualize the path using USDGeom
geom_points = UsdGeom.Points.Define(stage, "/World/PathPoints")
points_list = [list(pt) for pt in points]
geom_points.GetPrim().GetAttribute("points").Set(points_list)
widths = [0.01] * len(points_list)
geom_points.GetPrim().GetAttribute("widths").Set(widths)
# Save the USD stage
stage.GetRootLayer().Save()
Thank you again!