Home | Tutorials | Wiki | Issues
Ask Your Question
1

Control of Closed-Kinematic Chain with a Plugin

asked 2016-06-30 10:42:55 -0600

Gifak gravatar image

Hi,

I am working on a robot arm.

I simulated with gazebo and the PID controller provided and it works just fine. But, what I want is only to have the kinematic control of the robot, without having to take into account inertia and other stuff.

Therefore I used a plugin to set the angle of a joint for instance, which works just fine usually, but it seems that it doesnt work so easily in the case of a closed-loop chain. Indeed, here, every joints are linked and if one moves, it triggers the others.

What can I do to take this into account? Is there an option in Gazebo GUI for kinematic control only? I havent saw it so far.. If not, do you have any hint so that I can work on a plugin on my side? Please note that I am working on Gazebo as a standalone, whithout ROS. Also, I dont have the authorization from my company to provide any pictures.

Thank you by advance and have a nice day,

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-07-01 05:31:43 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Ok some update, I will finally use the JointController Class. Problem is, the SetJointPosition function doesnt seem to work and i am not the only one because there is also a few threads about this already, whithout any convincing answer so far..

Even more disturbing, I found this on the doc: 'Implementation: In order to change the position of a Joint inside a Model, this call must recursively crawl through all the connected children Link's in this Model, and update each Link Pose affected by this Joint angle update. Warning: There is no constraint satisfaction being done here, traversal through the kinematic graph has unexpected behavior if you try to set the joint position of a link inside a loop structure. Warning: "

So I shoudlnt expect for the JointController to work on a closed chain. Is there any alternative??

Here is my code:

#include <boost/bind.hpp>
#include <gazebo/gazebo.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/math/Pose.hh>
#include <gazebo/common/common.hh>
#include <stdio.h>

namespace gazebo
{
  class ModelPush : public ModelPlugin
{

public: void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
{
  // Store the pointer to the model
  this->model = _parent;

  // Listen to the update event. This event is broadcast every
  // simulation iteration.
  this->updateConnection = event::Events::ConnectWorldUpdateBegin(
      boost::bind(&ModelPush::OnUpdate, this, _1));
}

// Called by the world update start event
public: void OnUpdate(const common::UpdateInfo & /*_info*/)
{
  // Apply a small linear velocity to the model.
  //this->model->SetLinearVel(math::Vector3(.03, 0, 0));

    int i;

    physics::JointController jointController(this->model);



    //printf("test \n");
    joint = this->model->GetJoint("BaseToGround");
    joint2 = this->model->GetJoint("prismatic1");


    jointController.AddJoint(joint);
    jointController.AddJoint(joint2);
    jointController.AddJoint(this->model->GetJoint("arm2-end"));
    jointController.AddJoint(this->model->GetJoint("arm2_JOINT_0"));
    jointController.AddJoint(this->model->GetJoint("Base-verin2"));
    jointController.AddJoint(this->model->GetJoint("Base-arm1"));
    jointController.AddJoint(this->model->GetJoint("Base-verin1"));
    jointController.AddJoint(this->model->GetJoint("dummy-arm1"));
    jointController.AddJoint(this->model->GetJoint("arm1-arm2"));
    jointController.AddJoint(this->model->GetJoint("prismatic2"));      

    for(i=0; i<100; i++)
        jointController.SetJointPosition(joint2, 0.5,i);


    //for(i=0;i<100;i++)
        //joint->SetPosition(i,1);



}




private: physics::JointPtr joint;
private: physics::JointPtr joint2;
// Pointer to the model
private: physics::ModelPtr model;

// Pointer to the update event connection
private: event::ConnectionPtr updateConnection;
 };




}
edit flag offensive delete link more

Comments

@scpeters may know. This seems like something internal to how we do our physics. @Gifak, what do you expect to happen if you give it a joint position that isn't possible given the constrains of your chain? I suspect that's why the behavior is undefined

Peter Mitrano gravatar imagePeter Mitrano ( 2016-07-01 18:01:40 -0600 )edit

Possible. But in this case, the joint position that I commanded works fine when I use the PID. It is a very simple and small move, so it should works. Of course, the JointController would need to move all the other joints to have the desired position, but there is defininetely a solution. Also, the solution is unique since the system isn't redundant.

Gifak gravatar imageGifak ( 2016-07-02 02:11:02 -0600 )edit

Right, I believe you I'm just saying that's probably why the documentation says that. So SetJointPosition just does nothing for you? I strongly suggest looking at the gazebo code for that method. If you can't provide a reproducible SDF for the problem it is hard for use to help you

Peter Mitrano gravatar imagePeter Mitrano ( 2016-07-02 14:43:51 -0600 )edit

Yes, I will take a look on BitBucket even though I'm not that great at programming.. I will ask my boss if it is possible to provide the .SDF file.

Gifak gravatar imageGifak ( 2016-07-03 04:31:02 -0600 )edit

Do you know if there is a way to control the kinematic chain with the GUI, as with V-REP?

Gifak gravatar imageGifak ( 2016-07-04 03:02:53 -0600 )edit

Finally, I'll give up on the strictly closed-chain approach. I will do something similar with an open chain but I will add geometrical constraints on my low-end joints in order to simulate the effect of a closed chain. Do you know if it is possible to add such geometrical constraints on my joints? For instance: Be as closer to this other joint as possible.

Gifak gravatar imageGifak ( 2016-07-04 03:07:23 -0600 )edit

I haven't heard anyone doing it, but it might be possible. I'd ask that ask that as a separate question. As for going control, there's the joints panel on the right (you have to pull it open, it's closed by default). It uses joint controllers and can either apply force, or do velocity PID or position PID

Peter Mitrano gravatar imagePeter Mitrano ( 2016-07-04 11:00:57 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-06-30 10:42:55 -0600

Seen: 313 times

Last updated: Jul 01 '16