-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
torque controller is not working properly with real robot #107
Comments
This has nothing to do with the movement of your robot. It's complicated why we need this, but in torque control mode this shouldn't affect your commands/movement.
Giving it zero torque, leaves only the gravity compensation, which does not work very well on each own for all cases. So it is "normal" that the robot might move. What type of movement do you get? |
Hi! I'm working with @Elise-J. We checked together, here are the facts we collected.
20230512_140326_1_1.mp4
Note that we observe the faulty behavior only when testing on our real IIWA for some reason it does not appear in simulation. This is the reason that makes us think commit e293093 is at fault. From what I see I think the assumption that the dithering constant is too high makes sens. Could it interfer with grav comp or generate some kind of unstable control? Or do you have any other leads? |
If you compare the performance of the robot system with and without this commit, you would notice a significant difference in the joint stiction. Of course as a side effect, this also makes calibration errors more noticeable. My experience here is in line with the Stanford researchers that have a closer contact with KUKA and when those researchers complained about the high joint stiction, the KUKA engineers told them to use this technique to keep the friction compensation running. This joint position dithering is expected to be used when people turn the stiffness of the KUKA internal joint impedance controller off. Therefore we are expecting that it does not make any difference since it would be multiplied with a 0. (Although there was at least one person who did not turn the stiffness off and actually saw it dithering). If you want to use your robot with much larger joint stiction and this gives you a good-enough performance, you can of course turn it off. For us, this small feature is a huge improvement in accuracy and we would not want to go back to the old behavior. |
Alright, after a bit of investigation, I understand you point. However some of us still need to use non-null stiffness with the joint impedance controller. Although it is easy to fix by hand, as a matter of source control, it is a bit annoying having to patch the repo at every clone (or pull if we wanna keep up with main). Could we have dithering as a flag or something? I am not very knowledgeable in this repo, but it seems to me that it might not be optimal to have a commit that breaks some functionalities on master. Also I did note that striction is lower which is great. However, (and this is just a thought) couldn't we add the dithering on the torque command instead of the position to yield similar results without breaking the impedance controller with non-zero joint stiffness? |
Great to hear.
Of course this change expects that there is no use-case that configures stiffness of the joint impedance controller and use torque control since these two modes "interfere" somewhat. Note that this position dithering is just applied if someone wants to do torque control from ROS. There is still the use-case of people wanting to do position control in which case the dithering is not needed and also not added.
I have some master students who are investigating this right now. The short answer is that it's not that easy and by doing the position dithering we are just "enabling" a KUKA functionality that they just did not document anywhere.
Reminds me a bit of https://xkcd.com/1172/ |
My apologies, I think I might not have made myself clear but we are getting there. So to be sure... now if I start the "FRIOverlay" program on the IIWA and select torque for control, choosing any stiffness other than 0 on the IIWA screen will result in actually observing the dithering in the robot?
This is funny and made me laugh. Regardless I say this update is breaking things not because it reduces friction but because I have the option to choose a non-zero stiffness in the dialogue box of "FRIOverlay" and choosing anything other than 0 is actually resulting in an unwanted behavior (i.e. I see the robot dithering). It is my understanding that some stiffness in the joint control is pretty standard, I have the option to pick it, and I believe that some of the controller developed in our lab are mathematically unstable with null stiffness. So does the user now have to compute stiffness? Should we remove the dialog box for the stiffness choice in the java app? Or am I still completely missing the point? |
Yes, that would be the expected behavior. tbh, I never did that, because it felt like a not very-smart combination. But there was one person who did and he saw it moving.
:-)
This is totally correct. I think the issue here is more the FRIOverlay program. With iiwa_ros it does not really make sense to choose any other stiffness than 0 when doing torque control mode. In my own adaption, I removed that dialogue when selecting torque control and it is directly set to 0. I can give you an example on why this combination does not make sense for me. Let me know if I am missing sth.: Now you have the option to send additional torque commands from ROS, so e.g. you want it to rotate around joint 0 and you command 5nm to the joint. Now it would move into that direction until the "repelling" force of the joint impedance controller is also 5nm and a new equilibrium is established. When you send 0nm from ROS it would move back. The issue is that you can not correct these reference joint positions anymore if you want to send torque command through FRI. So I do not really see an option to bring the robot to a very different configuration.
My take would be that if you really want to use joint impedance control, you either establish an FRI connection for joint position (and not torque) updates (in which there would be no dithering) and then you can easily update the position references for KUKA's joint impedance controller. For example this RL code does that.
I am not quite for what you mean with "the user now have to compute the stiffness". There are many torque controllers available in the literature that you could use. Most of them would have some sort of stiffness.
It would indeed be an option to remove the joint-impedance stiffness dialogue if the user set the FRI connection to torque control. As explained above, setting a stiffness with torque control enabled does not really make sense to me. |
@niederha I found a way to look at the video. It did not really show in the Github issue. The behavior is a bit surprising actually. I expected it to make smaller, slower movements, but it moves quite fast. It's not what my robots are doing even when I send 0 torques.
|
I'm using the torqueController, which is the defualt controller when launching iiwa_bringup
I'm using 'FRIOverlay' and not 'FRIOverlayGripper' so, if I read the code correctly, no tool values are used. Notice, there is no tool mounted on the robot.
In zero position, the torque on each joint is within [-1.0; 1.0] Nm
Yes. This is the point of this issue. Now, I have an explanation for this behavior. In the internal impedance controller the stiffness term is formulated as Does that seem a likely explanation to you? |
I think it might be the case.
If my reading of the code is correct, that is not the case. We it seems that the position in the robot command sent in Footnotes
|
Totally correct. My bad.
That sounds alright. It's about in the same ballpark of what we see as well.
Correct. It would make it oscillate if one chooses a stiffness for the KUKA joint impedance controller. For our robots, since we want to do "pure" torque control, we select a joint impedance stiffness of 0 and then it works. Both for us and also other people. So I am wondering what's different in your setup. I assume that you also started the FRIOverlay program in that 0 joint position? There is the issue that it always needs to be completely cancelled (unticking it from the programs list) and start it again from scratch.
How do you want to control your robot? With joint position references or joint torque references?
You are totally right that you would observe this oscillation. In the iiwa_ros torque control mode, we are just sending the current position references so the KUKA joint impedance controller does not interfere with the torque commands. This is necessary because KUKA decided that to send torque commands, one also needs to send a position reference that is sufficiently close to the current position. Even if the stiffness of the joint impedance controller is set to 0. All torque controllers I have seen so far do not expect the "internal" robot controller to interfere. But if one configures some stiffness for KUKA's joint impedance controller, it might actually do that and it can be quite challenging to estimate how the joint impedance controller would behave. Without this dithering, we would send the last read joint positions as a new reference at the FRI frequency, so 200Hz-1000Hz. Anyway, I don't want to be the grumpy person sitting on top of some code and questioning what people want to do (Reddit /Stackoverflow Reference). |
Alright. I think the issue is quiet clear now. I understand how everything works now. I was a bit confused I think because all control done on the robot side and FRIOverlay uses the Impedance controller denomination, thus I thought it would be expected that uses this to implement the impedance controller's friction and damping (which is also likely biased by the dithering but I couldn't do a conclusive experiment on it). Alright so as I see it, as it is the repo might give a few headaches to a new user. Here is some suggestion I have that could fix it.
I like the first option, I just would like to make sure I'm not breaking any old demo from our side. I'm happy to build the MR for it. Just would appreciate your input and maybe the one from @fkhadivar (Who was the most knowledgeable person in the lab about this repo) before moving forward with it. |
Hello @niederha and @matthias-mayr , When I first created That being said (and for being backward compatible), I think that option 2 is the most reasonable one. We "assume" that when in Thanks both for the exchange of ideas ;) What do you think? |
I was a bit imprecise and also had a though error here. So yes, the reference positions are updated to be the current ones (with or without dithering).
Okay, that I did not expect anyone to do. I would have expected you to make a proper control solution :-) @niederha: Thanks for the suggestions.
I would actually vote for that. I think that the use-case of having torque control and do some sort of joint impedance control is quite niche, unless @niederha, you want to keep this way of kinesthetic teaching running.
I would again depend it on your way of kinesthetic teaching. If you need it, sure we can quickly add a switch. It's faster to do it than to spend more time discussing it.
As you already noted, I am afraid that the FRI connection can not submit such information. Thanks for the discussion. I learned something & I hope you too. |
We just had someone else to do torque control, select some joint impedance stiffness and observe a similar behavior. It would make sense to document how torque control mode should be used. |
Yeah, sorry, things piled up and I never got to doing an proper fix for this issue... I'll see if I can do it within the month as I have some work with the IIWA coming up |
The torque controller is not working properly anymore with real robot.
When launching the torque controller with
roslaunch iiwa_driver iiwa_bringup.launch
the robot starts to move when it shouldn't,The issue seems to be the dithering implementer to trigger the friction observer (commit e293093 ).
I'm not sure I've understood it clearly, but a sinusoidal signal is added to the position command. This sinusoid is bounded by 0.1 rad (which seems quite high) and results in the robot moving on its own.
@matthias-mayr
Do you think we could add a flag to choose to run or not those lines?
Also, shouldn't the signal added be smaller than 0.1 rad ?
The text was updated successfully, but these errors were encountered: