Closed RobinHeitz closed 3 months ago
I believe this is expected behavior, so I'm going to close this issue, but I will provide more information below.
In your example what you're passing to the target_action
argument of the OnProcessStart
event handler is an IncludeLaunchDescription
action, which cannot be a target for that event handler. The target_action
needs to point to an action that represents a single process, e.g. an ExecuteProcess
action, or a callable (like a function) that takes the Action
instance that created the event and returns true if it matches or false otherwise. The IncludeLaunchDescription
action you're passing isn't something that the OnProcessStart
can use to match to a process, hence this error:
TypeError: action_matcher must be an 'ExecuteProcess' instance or a callable
Instead, you'll need to figure out how to get access to the exact ExecuteProcess
instance you want to match (which will not be possible through an include statement I think) or you'll need to write a function that can match it. I think making a custom matcher is probably your best bet, but you can also use some of the built-in matchers:
If none of those are what you need to match the process you want, then you can use one of those as a starting point for making your own matcher to pass to the target_action
.
On a higher level, I don't think this event is a reliable way to know when Gazebo is "done launch" and/or "ready for use". This process started event happens pretty much immediately, and simply means the process has been started by the OS and stdout/stderr/stdin are attached to launch
. It does not, however, mean that gazebo has loaded your world file, opened the ui, finished loading the server, is running the simulation, is providing ROS topics or services, etc...
Instead, you probably want to wait for some specific IO event (like a particular string to appear in stdout) or for something else that implies the system is working, like the availability of a ros topic or maybe clock messages being produced by the simulation.
But I'll leave that up to you, since I'm not sure exactly what you're trying to detect.
Oh and with respect to:
If tried many combinations for using an RegisterEventHandler, even those from the humble tutorials, None worked:
If you can link to me the tutorials you tried, I can verify that they're working, or maybe help you understand them.
Cheers!
Bug report
Required Info:
Steps to reproduce issue
In a launch file, I want to only include some other launch file, when gazebo has started. I want to then spawn a robot.
If tried many combinations for using an RegisterEventHandler, even those from the humble tutorials, None worked:
Expected behavior
It should not thrown an err.
Actual behavior
When launching this launch file, it catches exceptions.
Additional information
Here is the log from -d: