Dear Ignition Community,
within the former Gazebo Framework, 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].
Regards and thx!
[1] https://ignitionrobotics.org/api/gazebo/6.0/migrationsdf.html
[2] https://ignitionrobotics.org/api/msgs/6.4/classignition_1_1msgs_1_1Visual.html