class gazebo::physics::World’ has no member named ‘GetModel’; did you mean ‘Models’?
Hi All,
I am very new to Gazebo and ROS. I have the following code snippet in my Ros World Plugin:
void Load(physics::WorldPtr _world, sdf::ElementPtr _sdf)
{
physics::ModelPtr ballmodel;
ballmodel = _world->GetModel("ball");
Any idea why I always get a error like class gazebo::physics::World’ has no member named ‘GetModel’; did you mean ‘Models’?
I am using Ubuntu 18, Melodic and Gazebo 9.
Any idea? Thanks in advance, Peter
EDIT
No idea what's going on, but the ball is not found :-(
class SimulatorPlugin : public WorldPlugin
{
void Load(physics::WorldPtr _world, sdf::ElementPtr _sdf)
{
sdf::SDF ballSDF;
ballSDF.SetFromString(
"<sdf version ='1.6'>\
<model name='ball'>\
<pose>0 0 0 0 0 0</pose>\
<include>\
<uri>/home/peter/gazebo_plugin/models/my_robocup_spl_ball</uri>\
</include>\
</model>\
</sdf>");
sdf::ElementPtr ballmodel = ballSDF.Root()->GetElement("model");
ballmodel->GetAttribute("name")->SetFromString("ball");
_world->InsertModelSDF(ballSDF);
physics::ModelPtr ballmodelPtr = _world->ModelByName("ball");
if (ballmodelPtr != NULL)
{
printf("ball found \n");
}
_world->LoadPlugin("librifball.so", "rifball", ballmodel);
}
}