Home | Tutorials | Wiki | Issues
Ask Your Question
1

Lift Controller Plugin

asked 2016-09-20 13:09:06 -0500

TwoBid gravatar image

updated 2016-09-28 04:28:09 -0500

Hi,

I created a model of a Fork-Lifter. The Chassis and the forks are separated links, connected with a prismatic joint. This joint is controlled by a plug-in that handles the fork height.

When I'm spawning the model, sometimes I have the issue that the fork is spawned a few meters away from the chassis. When I'm excluding the fork lift plug-in it seems stable.

Another issue is that sometimes when I'm spawning the model, it seems that it gets a force kick and than it flies away. I already adjusted the inertia, but it doesn't helped. The reproductivity of both errors are quite strange, sometimes it works, sometimes the forks are displaced and sometime the whole model flies away.

Can someone have a look on my model.sdf and the lift/fork control plug-in? I'm really running out of ideas where the error could be.

[UPDATE]:

model.sdf

lift_ctrl.cpp

The solution for me was to use SetForce() instead of using the model SetJointPosition() method. I followed the ElevatorPlugin example and implemented it like that:

this->liftPID.Init(1600, 0, 1600);
double error = this->liftJoint->GetAngle(2).Radian() - (setpoint_height);
double force = this->liftPID.Update(error, _info.simTime - this->prevSimTime);
this->prevSimTime = _info.simTime;
this->liftJoint->SetForce(0, force);

Also an approach over a JointController and setting up a pid over SetPositionPID() was avoiding my problem. But now I'm encountering another one, when I'm trying to lift something with the fork, a pallet or a box, its either flying away or the vehicle starts to shake.... I updated already my model added the same parameters like in the elevator example for the lift joint, but no success.

Thanks a lot, Rob

edit retag flag offensive close merge delete

Comments

What's the gazebo version you're using?

chapulina gravatar imagechapulina ( 2016-09-20 14:53:38 -0500 )edit

That happens to me also, when using factory message to spawn a model, one part of the model goes to the correct place, the other goes to a completly different position ... Gazebo is very buggy sometimes, it doesnt handle model spawn/delete on the fly very well, at least for me tho

wicked88 gravatar imagewicked88 ( 2016-09-20 19:14:55 -0500 )edit

I'm using 7.3.1

TwoBid gravatar imageTwoBid ( 2016-09-21 01:04:54 -0500 )edit

So i narrowed it down to the lift control plugin. I changed the initial fork height from 0.163 to 0. I actually assumed that the method SetJointPosition is not influencing the physics engine, but it doesn't help anyway. I also changed the order of the subscriber init and the update events init and now its done at the end of the load method. But still 1 of 4 times the fork is displaced.

TwoBid gravatar imageTwoBid ( 2016-09-21 03:11:36 -0500 )edit

May be, we (you and i) should use boost::mutex * GetSetWorldPoseMutex () const before making any changes to a model ... In my plugin i also dynamically change the sdf of the robot and odd behaviours occur.

wicked88 gravatar imagewicked88 ( 2016-09-21 04:52:42 -0500 )edit

So i played around a little and in my case the following line is causing the problem: this->model->SetJointPosition(lift_joint->GetScopedName(), this->lift_height);

TwoBid gravatar imageTwoBid ( 2016-09-27 04:55:27 -0500 )edit

I don't think setJointPosition does a teleportation like you expect. The easy solution is to send a JointCmd message, which uses PID to control joint position

Peter Mitrano gravatar imagePeter Mitrano ( 2016-09-29 23:59:55 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-09-30 00:01:51 -0500

As you discovered, SetJointPosition doesn't do the kind of pretty teleportation you wanted. I'll offer another way to do PID however, which is to publish a msgs::JointCmd to the right topic. This is often cleaner in your code than using a PID object and such. It's the same interface the joint panel in gazebo uses.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2016-09-20 13:09:06 -0500

Seen: 266 times

Last updated: Sep 30 '16