What does this SkeletonAnimation error mean?

asked 2018-06-25 10:17:13 -0500

bhej gravatar image

updated 2018-06-25 15:30:06 -0500

I have been trying to solve this error for a while now but I am not sure what may be causing it. It seems to have popped out of nowhere after I created several actors with the same plugin and animation file. Any help would be appreciated, thanks

gzserver: /var/lib/jenkins/workspace/gazebo8-debbuilder/build/gazebo-8.5.0/gazebo/common/SkeletonAnimation.cc:147: ignition::math::Matrix4d gazebo::common::NodeAnimation::FrameAt(double, bool) const: Assertion `(t >= 0.0 && t <= 1.0)&&("t is not in the range 0.0..1.0")' failed.

My world file

<?xml version="1.0"?>
<sdf version="1.4">
  <world name="default">
    <include>
      <uri>model://sun</uri>
    </include>
    <include>
      <uri>model://ground_plane</uri>
    </include>

    <actor name="human1">
      <pose>-1 1 0.5 0 0 0</pose>
      <skin>
        <filename>moonwalk.dae</filename>
      </skin>
      <animation name="walking">
        <filename>walk.dae</filename>
        <interpolate_x>true</interpolate_x>
      </animation>
      <animation name="standing">
        <filename>stand.dae</filename>
        <interpolate_x>true</interpolate_x>
      </animation>
  <plugin name="actor1_plugin" filename="libHumanPlugin.so">
    <target_weight>1.15</target_weight>
    <topic_name>humanone</topic_name>
    <obstacle_weight>1.8</obstacle_weight>
    <animation_factor>5.1</animation_factor>
    <ignore_obstacles>
      <model>ground_plane</model>
    </ignore_obstacles>
  </plugin>
    </actor>

    <actor name="human2">
      <pose>-1 2 0.5 0 0 0</pose>
      <skin>
        <filename>moonwalk.dae</filename>
      </skin>
      <animation name="walking">
        <filename>walk.dae</filename>
        <interpolate_x>true</interpolate_x>
      </animation>
      <animation name="standing">
        <filename>stand.dae</filename>
        <interpolate_x>true</interpolate_x>
      </animation>
  <plugin name="actor2_plugin" filename="libHumanPlugin.so">
    <target_weight>1.15</target_weight>
    <topic_name>humantwo</topic_name>
    <obstacle_weight>1.8</obstacle_weight>
    <animation_factor>5.1</animation_factor>
    <ignore_obstacles>
      <model>ground_plane</model>
    </ignore_obstacles>
  </plugin>
    </actor>

  </world>
</sdf>

EDIT:

I managed to find what is triggering my error although I am not sure why that is so. I am using an edited version of the Actor plugin provided in the tutorials (https://bitbucket.org/osrf/gazebo/raw...). For some reason changing the following in HandleObstacles removes the error.

if (std::find(this->ignoreModels.begin(), this->ignoreModels.end(),
    model->GetName()) == this->ignoreModels.end())
{

to (added ! before std)

if (!(std::find(this->ignoreModels.begin(), this->ignoreModels.end(),
       model->GetName()) == this->ignoreModels.end()))
{

EDIT: After further investigation, I managed to pin the line causing this error when the equality signs change in the if statement. It is due to the following two lines

            _pos.X() -= offset.X();
            _pos.Y() -= offset.Y();

in this function

void ActorPlugin::HandleObstacles(ignition::math::Vector3d &_pos)
{
  for (unsigned int i = 0; i < this->world->ModelCount(); ++i)
  {
    physics::ModelPtr model = this->world->ModelByIndex(i);
    // Do not handle the target to follow as an obstacle. Follow buffer should keep a safe distance.
    if(this->mode == "follow" && model->GetName() == this->targetName)
      continue;

    if ((std::find(this->ignoreModels.begin(), this->ignoreModels.end(),
           model->GetName()) != this->ignoreModels.end()))
    {
      ignition::math::Vector3d offset = model->WorldPose().Pos() -
        this->actor->WorldPose().Pos();
      double modelDist = offset.Length();
      if (modelDist < 4.0)
      {
        double invModelDist = this->obstacleWeight / modelDist;
        offset.Normalize();
        offset *= invModelDist;
        // Only change the X and Y direction vector components... Unless humans can levitate in the future... That would be cool.
        _pos.X() -= offset.X();
        _pos.Y() -= offset.Y();
      }
    }
  }
}

However, I ... (more)

edit retag flag offensive close merge delete