Start Gazebo at the same time as an external ROS compliant application

asked 2019-09-30 09:33:08 -0500

Bruno Vieira gravatar image

Dear all,

I have a simulation environment developed on gazebo that gets launched with a typical roslaunch file... However, this simulation has now, different external applications that use ROS libraries on their code, that interact with the gazebo simulation in different ways and to simplify the workflow of these simulations, it would be optimal to guarantee that all this applications were being started at the same time as Gazebo launches...

Which should be the best way to do this? A bash script isn't quite a solution right now, since I can't seem to properly code one that just starts the gazebo environment directly...

Best regards, Bruno Vieira

edit retag flag offensive close merge delete

Comments

this applications were being started at the same time as Gazebo launches...

can you clarify what this means exactly?

And why this is so important?

gvdhoorn gravatar imagegvdhoorn ( 2019-09-30 10:23:16 -0500 )edit

It means that I would require these applications to start at the same time or using the same "command" as the roslaunch I launch to start the gazebo environment... It is important because these applications interact and depend on the gazebo simulation to properly work.

Bruno Vieira gravatar imageBruno Vieira ( 2019-09-30 10:26:06 -0500 )edit

So would it be sufficient to start those non-ROS applications using roslaunch?

If so, see: #q272267.

gvdhoorn gravatar imagegvdhoorn ( 2019-09-30 10:28:33 -0500 )edit

I couldn't quite understand how I'm able to include this "non-ros application" into the roslauch script... For example, one of my applications gets initiated by a similar command to this:

cmake --build build --target APPNAME

being APPNAME the name of the application that gets started. Any possible input on how can i possibly include this in a typical roslaunch file?

Bruno Vieira gravatar imageBruno Vieira ( 2019-09-30 10:48:03 -0500 )edit

CMake is typically a tool invoked during the build phase of your program, not the runtime phase.

Your question seemed to be about how to orchestrate the runtime phase of multiple ROS and non-ROS applications, not their build phases.

Are you sure that you use CMake to start your application(s)?

gvdhoorn gravatar imagegvdhoorn ( 2019-09-30 15:00:56 -0500 )edit

Yes, i use exactly that command to start my applications, since it allows me to build all my code and then start that APPNAME script to launch it

Bruno Vieira gravatar imageBruno Vieira ( 2019-10-02 04:46:19 -0500 )edit

It's probably possible to invoke cmake from a .launch file, but I question your current development workflow. Building is very much a separate phase from runtime. I get the convenience you get from invoking a build target that also starts your application, but it might complicate what you're trying to do here.

After building a workspace, you'll need to resource it. If you add or remove packages, sourceing is required. I'm not sure how (and whether) roslaunch will be able to cope with that.

But simply invoking cmake should not be a problem.

gvdhoorn gravatar imagegvdhoorn ( 2019-10-02 04:56:10 -0500 )edit

Yes I agree that this workflow should be improved. However, about the availability of calling this during a roslaunch phase, how should I properly do it?

Bruno Vieira gravatar imageBruno Vieira ( 2019-10-02 08:22:07 -0500 )edit