Animation - polaris ranger wheels won't straighten out
I'm trying to do a simple animation with the polarisrangerev where it just takes two 90 degree turns. For the first turn, the front wheels turn appropriately but then once it's done turning and is just moving forward, the wheels don't go back to normal, they're still turned. At the second turn (opposite direction), the wheels don't turn like they did for the first turn.
I followed the Animated Box tutorial, here is the code that I am using:
public: void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
{
// Store the pointer to the model
this->model = _parent;
// create the animation
gazebo::common::PoseAnimationPtr anim(
// name the animation "test",
// make it last 60 seconds,
// and set it not to repeat
new gazebo::common::PoseAnimation("test", 80.0, false));
gazebo::common::PoseKeyFrame *key;
// set starting location of the model
key = anim->CreateKeyFrame(0);
key->SetTranslation(math::Vector3(0, 0, 0));
key->SetRotation(math::Quaternion(0, 0, 0));
// set waypoint location after 10 seconds
key = anim->CreateKeyFrame(10.0);
key->SetTranslation(math::Vector3(0, 0, 0));
key->SetRotation(math::Quaternion(0, 0, 0));
key = anim->CreateKeyFrame(20.0);
key->SetTranslation(math::Vector3(1, 0, 0));
key->SetRotation(math::Quaternion(0, 0, 0));
key = anim->CreateKeyFrame(30.0);
key->SetTranslation(math::Vector3(2, 0, 0));
key->SetRotation(math::Quaternion(0, 0, 0));
key = anim->CreateKeyFrame(40.0);
key->SetTranslation(math::Vector3(3, 1, 0));
key->SetRotation(math::Quaternion(0, 0, 1.5707));
key = anim->CreateKeyFrame(50.0);
key->SetTranslation(math::Vector3(3, 2, 0));
key->SetRotation(math::Quaternion(0, 0, 1.5707));
key = anim->CreateKeyFrame(60.0);
key->SetTranslation(math::Vector3(3, 3, 0));
key->SetRotation(math::Quaternion(0, 0, 1.5707));
key = anim->CreateKeyFrame(70.0);
key->SetTranslation(math::Vector3(4, 4, 0));
key->SetRotation(math::Quaternion(0, 0, 0));
key = anim->CreateKeyFrame(80);
key->SetTranslation(math::Vector3(5, 4, 0));
key->SetRotation(math::Quaternion(0, 0, 0));
// set the animation
_parent->SetAnimation(anim);
}
Asked by sm02 on 2016-02-04 11:30:22 UTC
Answers
Based on the comments and the animation script, I believe the wheels are turning in response to first rotation of the model. They don't rotate back because of various physics properties.
Note that you are moving/rotating the whole model. You are not animating the wheels. Therefore the wheels will behave in a somewhat unpredictable manner (the physics engine will compute how they should behave).
Asked by nkoenig on 2016-02-04 14:59:59 UTC
Comments
I think that the "front_right_steering_joint" and "front_left_steering_joint" revolute joints are causing the response I'm seeing. If I were to get rid of these joints, would I be able to use the model without the wheels responding that way? Or would I have to replace the joints with some other type?
Asked by sm02 on 2016-02-04 15:04:59 UTC
Comments
Is this plugin attached to the polaris model, is physics enabled, and is the polaris model marked as static?
Asked by nkoenig on 2016-02-04 12:37:24 UTC
Yes, the plugin is attached to the polaris model, in the .world file I did
Physics is enabled in the plugin. The polaris model is not marked as static.
Asked by sm02 on 2016-02-04 14:24:01 UTC