How to spawn a new node from inside C++ code
I'm using the gazebo_ros package, which is an interface for using ROS with the Gazebo simulation software. On their relevant documentation page, they say that the best way to dynamically create a new model in the simulation is to run the node for spawning models:
rosrun gazebo_ros spawn_model -database coke_can -sdf -model coke_can3 -y 2.2 -x -0.3
This node functions as a wrapper that will get XML from the database and load it, etc. My question is, is there a way to run this node with the command above, but from the C++ code of an already-running ROS node? i.e. to add models dynamically, once the controller node is already running.