Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Exclude model controlled via ign system plugin from physics calculation

Dear community,

we have implemented a SystemPlugin for Ignition Fortress, which is able to change a model's world pose imitating the implementation of UserCommands [1], actually providing this capabilities as ign services. In the plugin's PreUpdate() interface, we react to incoming ign topics of type ignition::msgs::Pose and move the model according to this pose.

void MySystemPlugin::PreUpdate(const ignition::gazebo::UpdateInfo &_info, ignition::gazebo::EntityComponentManager &_ecm)
{
  [...]
  auto poseCmdComp = _ecm.Component<ignition::gazebo::components::WorldPoseCmd>(this->dataPtr->entity);
  if (!poseCmdComp)
  {
      _ecm.CreateComponent(this->dataPtr->entity, ignition::gazebo::components::WorldPoseCmd(current_pose));
  }
  else
  {
       auto state = poseCmdComp->SetData(current_pose, pose3Eql) ? ignition::gazebo::ComponentState::OneTimeChange : ignition::gazebo::ComponentState::NoChange;
    _ecm.SetChanged(this->dataPtr->entity, ignition::gazebo::components::WorldPoseCmd::typeId, state);
  }
}

Moving the model around typically results to the model being influenced by physics during the Update() interface. This is obvious when moving the model upwards (+z) and consequently gravity is applied. The object then is falling down to the ground.

Since we want to calculate the model's physics completely outside ign, we would like to exclude this model from physics calculation. Is this somehow possible?

BR and thx.

[1] https://github.com/ignitionrobotics/ign-gazebo/blob/ign-gazebo6/src/systems/user_commands/UserCommands.cc