Home | Tutorials | Wiki | Issues
Ask Your Question
0

Animation - polaris ranger wheels won't straighten out

asked 2016-02-04 10:30:22 -0600

sm02 gravatar image

updated 2016-02-04 10:59:28 -0600

nkoenig gravatar image

I'm trying to do a simple animation with the polaris_ranger_ev 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);
    }
edit retag flag offensive close merge delete

Comments

Is this plugin attached to the polaris model, is physics enabled, and is the polaris model marked as static?

nkoenig gravatar imagenkoenig ( 2016-02-04 11:37:24 -0600 )edit

Yes, the plugin is attached to the polaris model, in the .world file I did <plugin name="push_animate" filename="libmy_animation.so"/> Physics is enabled in the plugin. The polaris model is not marked as static.

sm02 gravatar imagesm02 ( 2016-02-04 13:24:01 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-02-04 13:59:59 -0600

nkoenig gravatar image

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).

edit flag offensive delete link more

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?

sm02 gravatar imagesm02 ( 2016-02-04 14:04:59 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-02-04 10:30:22 -0600

Seen: 267 times

Last updated: Feb 04 '16