Regarding upper and lower limits in revolute joint.

asked 2020-02-17 18:14:11 -0500

Suyash gravatar image

updated 2020-02-18 09:37:28 -0500


I am using an SDF world with a model plugin. I am using a revolute joint with certain upper and lower limits for joint position, specified in radians. However, when I am applying higher forces, the links are passing that limit by a small amount (when I have set the limits 1.5, it is going until 1.6 in both directions). I am not sure what else to do, or if I am doing something wrong. Below are the relevant snippets of my sdf file and plugin code. Please suggest the needful. Thanks.

Sdf code for joint:

<joint name='Body_to_ch1' type='revolute'>
        <pose frame=''>0 0 0 0 -0 0</pose>
          <xyz>0 0 1</xyz>

Plugin code:

#include <functional>
#include <gazebo/gazebo.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/common/common.hh>
#include <ignition/math/Vector3.hh>
#include <math.h>

int i = 0;
double w = 50*3.14;
double A = 1.0;
double forceamp = 0.0006295;
double t = 0;
double dt = 0.0001;
double torque = 0;

namespace gazebo
  class ModelPush : public ModelPlugin
    public: void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
      this->model = _parent;

      this->updateConnection = event::Events::ConnectWorldUpdateBegin(
          std::bind(&ModelPush::OnUpdate, this));

    // Called by the world update start event
    public: void OnUpdate()
        torque = forceamp*cos(w*t);
    t = t + dt;

    private: physics::ModelPtr model;

    private: event::ConnectionPtr updateConnection;

edit retag flag offensive close merge delete


Try increasing the effort and decreasing the velocity. I'm assuming 1000 rad/sec is not really what you want.

nlamprian gravatar imagenlamprian ( 2020-02-18 02:07:20 -0500 )edit

Thanks for the suggestion. I tried that and it is still passing the limits. However, I realized that rotation order matters, and it appeared like limits are being passed by a large amount. I printed the position and I found that when I have set the limits to 1.5, it doesn't go beyond 1.6. But it is still passing the limits. Also, I need speeds of the order of around 500 rad/sec.

Suyash gravatar imageSuyash ( 2020-02-18 09:36:13 -0500 )edit