0
$\begingroup$

Gazebo Answers logo

I use a plugin to control a hand model with two fingers from a position(0,0,0) to a high position(0,0,0.5), and the model will quiver up and down. The motion is not regular and not smooth, would you please help me? thank you

world file:

<plugin name="animate_pose1" filename="libanimate_pose1.so"/>

the animate_pose.cc:

  gazebo::common::PoseAnimationPtr anim(
      new gazebo::common::PoseAnimation("box::my_joint5", 10.0, 0));

  gazebo::common::PoseKeyFrame *key = anim->CreateKeyFrame(0.0);
  key = anim->CreateKeyFrame(0);
  key->SetTranslation(math::Vector3(0, 0, 0));
  key = anim->CreateKeyFrame(2.0);
  key->SetTranslation(math::Vector3(0, 0, 0.1));
  key = anim->CreateKeyFrame(4.0);
  key->SetTranslation(math::Vector3(0, 0, 0.2));
  key = anim->CreateKeyFrame(6.0);
  key->SetTranslation(math::Vector3(0, 0, 0.3));
  key = anim->CreateKeyFrame(8.0);
  key->SetTranslation(math::Vector3(0, 0, 0.4));
  key = anim->CreateKeyFrame(10.0);
  key->SetTranslation(math::Vector3(0, 0, 0.5));

  _parent->SetAnimation(anim);

Originally posted by lugd1229 on Gazebo Answers with karma: 75 on 2013-02-24

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Answers logo

The motion is not smooth because there are 4 unnecessary key frames. You can do just this:

gazebo::common::PoseAnimationPtr anim(new gazebo::common::PoseAnimation("box::my_joint5", 10.0, 0));

gazebo::common::PoseKeyFrame *key = anim->CreateKeyFrame(0.0);
key = anim->CreateKeyFrame(0);
key->SetTranslation(math::Vector3(0, 0, 0));
key = anim->CreateKeyFrame(10.0);
key->SetTranslation(math::Vector3(0, 0, 0.5));

_parent->SetAnimation(anim);

Originally posted by nkoenig with karma: 7676 on 2013-03-07

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by lugd1229 on 2013-03-15:
thanks a lot.but use this cannot control one joint of the model that has 7 joints. how to control 7 joints using PoseAnimationPtr or NumericAnimation?

Comment by nkoenig on 2013-03-17:
Use multiple animation to animate multiple joints.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.