I am using a Python script instantiating a SimulationApp. I use SimulationContext.step() to step through my simulation. Part of the USD stage is an action graph to publish ROS2 messages. While I can trigger the publisher node successfully using On Tick or On Playback Tick, while running the simulation from the UI, the action graph does nothing when I run the scripted simulation.
Hi @bruno.vetter - The issue you’re experiencing might be due to the difference in how the simulation is run in the UI versus in a script. When running the simulation from the UI, certain events like ticks or playback ticks might be automatically triggered, which might not be the case when running the simulation from a script.
Here are a few things you can try:
Manually trigger the tick event: In your script, you might need to manually trigger the tick event that your action graph is listening for. This could be done by calling a method like trigger_tick() on the simulation context or a similar object.
Check the action graph setup: Make sure your action graph is set up correctly in your script and that it’s being added to the simulation context. You might need to call a method like add_action_graph() on the simulation context or a similar object.
Use a different event: If the tick event is not suitable for running the simulation from a script, you might need to use a different event to trigger your action graph. Check the Isaac SDK documentation to see what other events are available.
Check for errors: Make sure there are no errors or exceptions being thrown when you run your script. If there are, they might give you a clue as to what’s going wrong.
Hi @bruno.vetter - You can try following instructions. If that doesn’t work for you then I will find the dev who can help you answer the question.
Manually Trigger the Action Graph: You can manually trigger the Action Graph in your script after each simulation step. You can do this by setting an impulse event on the node that triggers your ROS2 publisher. Here’s an example of how to do this:
import omni.graph.core as og
# Trigger the Action Graph
og.Controller.set(og.Controller.attribute("/ActionGraph/OnImpulseEvent.state:enableImpulse"), True)
Replace “/ActionGraph/OnImpulseEvent” with the path to your impulse event node.
Use a Different Trigger: If manually triggering the Action Graph is not ideal for your use case, you might consider using a different trigger for your ROS2 publisher node. For example, you could use an “On Simulation Tick” node if one is available.
Check the Evaluator: Make sure the evaluator of your Action Graph is set to “execution”. This ensures that the Action Graph is evaluated during the simulation execution.