Open chapulina opened 3 years ago
Ive been working on a plugin to disable grav, but not sure the right way to do it (ignition documentation is really rough...). I have the plugin loading, and the gravity is being printed out as 0 0 0 , but not sure if its being applied to the model at all. Any suggestions?
void AntiGrav::Configure(const ignition::gazebo::Entity &_entity,
const std::shared_ptr<const sdf::Element> &_sdf,
ignition::gazebo::EntityComponentManager &_ecm,
ignition::gazebo::EventManager &/*_eventMgr*/)
{
std::string link_name_;
//ignition::gazebo::Model model{ ignition::gazebo::kNullEntity};
ignition::gazebo::Model model{_entity};
// Get sdf parameters
if (_sdf->HasElement("linkName"))
{
link_name_ = _sdf->Get<std::string>("linkName");
}
else
{
ignerr << "The AntiGrav plugin for " << "[MODEL NAME] " << "requires a `linkName` parameter tag" <<std::endl;
return;
}
if(!model.Valid(_ecm))
{
ignerr << "AntiGrav plugin should be attached to a model entity. " << std::endl;
return;
}
ignition::gazebo::Entity E = model.LinkByName(_ecm,link_name_);
_ecm.CreateComponent<ignition::gazebo::components::Gravity>(_entity,ignition::gazebo::components::Gravity());
//const components::Gravity *gravity = _ecm.Component<components::Gravity>(this->dataPtr->world);
const ignition::gazebo::components::Gravity *gravity = _ecm.Component<ignition::gazebo::components::Gravity>(_entity);
if(nullptr == gravity)
{
ignmsg << "gravity is a null pointer" << std::endl;
}
else
{
ignmsg << gravity->Data().X() << gravity->Data().Y() << gravity->Data().Z() << std::endl;
}
}
Any update on this? Specifically, in my case, into Garden...
the sdformat PRs were merged and forward ported to garden and newer versions. We'll need to make sdformat releases so that the gz-physics and gz-sim PRs can be merged.
not to rush or anything, but does this have an ETA? is it scheduled?
I'll kick off the sdformat releases, starting with fortress https://github.com/gazebosim/sdformat/pull/1430
Gazebo Classic supports the
<link><gravity>
SDF element, which makes links float.That hasn't been ported to Ignition yet, we aren't even parsing the flag into sdf::Link.