Change a model's appeareance within IGNITION Gazebo
Dear Ignition Community,
i am looking for an approach to change a model's, resp. it's visual geometry's appeareance during runtime.
Within the former Gazebo simulation, it has been able to change a model's appeareance by declaring different materials, e.g.
material green_on
{
technique
{
pass
{
lighting on
ambient 0.08207 0.64 0.040269 1
diffuse 0.08207 0.64 0.040269 1
emissive 0.08207 0.64 0.040269 1
}
}
}
material green_off
{
technique
{
pass
{
lighting on
ambient 0.3 0.3 0.3 1
diffuse 0.08207 0.64 0.040269 1
emissive 0 0 0 1
}
}
}
and then switching between those materials using dedicated messages within a ModelPlugin node's namespace, such as follows:
// Message for changing the visual appearance (setting visual states)
this->dataPtr->visualPub = this->dataPtr->node->Advertise<gazebo::msgs::Visual>("~/visual");
[...]
gazebo::msgs::Visual greenChangeMessage;
greenChangeMessage.set_parent_name(this->model->GetName());
greenChangeMessage.set_name(this->model->GetName() + "::green_light");
if(_green) {
greenChangeMessage.mutable_material()->mutable_script()->set_name("green_on");
} else {
greenChangeMessage.mutable_material()->mutable_script()->set_name("green_off");
}
this->dataPtr->visualPub->Publish(redChangeMessage);
This approach seems to be outdated for IGNITION Gazebo (e.g. fortress), is there another way to go for such functionalities? IGNITION Gazebo seems to have similar Visual message [2] ready for such types of application, but *.material files are not supported any more [1].
As stated in [3], the rendering API only affects one of both "worlds". Since i want to change the model's appeareance, so that the GUI (affecting the user), but also the server (for sensors) are affected in the same way, i am dependent on a synchronized change.
Regards and thx!
[1] https://ignitionrobotics.org/api/gaze...