Taking Gazebo screenshots using a ROS node
I'm using Gazebo to make some experiments. I want to take photos of Gazebo simulation in certain moments (decided by my ROS node). Gazebo has a screen capture utility by itself, it can be activated using a GUI button. However, there doesn't seem to be a ROS message or service to trigger it from a ROS node. Am I missing something?
Otherwise, can you suggest me the most modular way to take screenshots of whole screen? Can I create a shell script and rosrun it like a node when necessary? Or should I call screenshot application directly from my ROS node using C++?