For controlling any of the light's visible characteristics, use rendering::Light
's API.
Every light in Gazebo consists of a pair of objects, one in the rendering engine, and another in the physics server. The rendering object keeps track of everything related to how the light affects the world's appearance, while the physics object controls how the light moves, its speed and whether it is attached to other objects.
Actually, this "double personality" is not exclusive to lights. All visible entities in the world have both a representation in physics and in rendering. The difference is that for the rendering, they're all instances of rendering::Visual
. You can check which physical entity they correspond to by calling rendering::Visual::GetType and that may return values such as LINK
and COLLISION
.