0
$\begingroup$

Gazebo Answers logo

I am using Gazebo 7 with ROS kinetic on Ubuntu 16.04. I wrote a small gazebo plugin with gets loaded when I load a world in gazebo. However, when I try to use LightCount API, I get the compile error saying "error: ‘class gazebo::physics::World’ has no member named ‘LightCount’".
Here is the link that says that this API is supported http://osrf-distributions.s3.amazonaws.com/gazebo/api/dev/classgazebo_1_1physics_1_1World.html

Here is the code snippet that is giving me error
   // Called by the world update start event
    public: void OnUpdate(const common::UpdateInfo & /*_info*/)
    {
       physics::WorldPtr w = this->model->GetWorld();
       unsigned int i = w->LightCount();
       printf("Light count = %d\n", i); 
    }

Originally posted by Ash_100 on Gazebo Answers with karma: 9 on 2017-10-02

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Answers logo

What minor version of Gazebo are you running? It looks like World::LightCount was added on Gazebo 7.1.0 and is not on 7.0.0.

On Gazebo 7.0.0, you should be able to use w->Lights().size() instead.


Originally posted by chapulina with karma: 7504 on 2017-10-02

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Ash_100 on 2017-10-02:
How to update 7.0.0 to 7.1.1? Basically, I want to add/remove lights from the world. Therefore, I need to access API relevant to lights.

Comment by chapulina on 2017-10-02:
You can follow the instructions here: http://gazebosim.org/tutorials?cat=install&tut=install_ubuntu&ver=7.0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.