Hi guys,
so here is the situation:
I launch an app with the python.sh (following the simulation example ones)
Inside the python I do the following
CONFIG = {"display_options":3286, "width": 1280, "height": 720, "headless": args.headless}
kit = SimulationApp(launch_config=CONFIG)
enable some extensions
omni.usd.get_context().open_stage(env_path, None)
simulation_context = SimulationContext(physics_dt=1.0 / 200.0, rendering_dt=1.0 / 200.0, stage_units_in_meters=0.01)
simulation_context.start_simulation()
kit.update()
# set timeline of the experiment
timeline = omni.timeline.get_timeline_interface()
timeline.set_start_time(0.0)
timeline.set_end_time(args.experiment_length / 24.0)
fps = 24.0
timeline.set_time_codes_per_second(fps)
load a custom (simple) robot
attach 2 ROSBridgeCameras (NOT REB)
load another couple of objects
dynamic_prims = list of dynamic objects
while kit.is_running():
# step the physics
simulation_context.step(render=False)
frame += 1
if frame % 2 == 0:
omni.kit.commands.execute("RosBridgeTickComponent", path="/ROS_Clock")
# toggle the environment hiding objects
status = not status
utils.toggle_environment(status, dynamic_prims)
simulation_context.render()
# every two frames publish even cameras
if frame % 2 == 0:
for i, cam in enumerate(ros_camera_list):
if i % 2 == 0:
# THIS PUBLISH ONLY ON EVEN CAMERAS
omni.kit.commands.execute("RosBridgeTickComponent", path=str(cam.GetPath()))
# # toggle the environment to YES show the moving objects
status = not status
utils.toggle_environment(status, dynamic_prims)
simulation_context.render()
if frame % 2 == 0:
for i, cam in enumerate(ros_camera_list):
if i % 2 == 1:
# THIS PUBLISH ONLY ON ODD CAMERAS
omni.kit.commands.execute("RosBridgeTickComponent", path=str(cam.GetPath()))
Problem is that the cameras sees randomly the objects that I am toggling (wrongly).
The simulation itself is running at 10FPS, and this might get even lower as I want very high resolution.
Isn’t render supposed to “hold” the execution until it is finished?
Is this ghosting normal or is there some setting that I need to set to avoid that?
I’ve noticed that, if I sleep after each render (let’s say more than 0.1s) this ghosting does not happen anymore (as the rendering do finish).
I’ve tried by attaching a callback to the render but that does not help either. (simulation_context.add_rendering_callback)
Best,
Elia