Hand bouncing off to infinity

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
DrPhil
Posts: 4
Joined: Wed Dec 13, 2017 7:33 pm

Hand bouncing off to infinity

Post by DrPhil » Wed Dec 13, 2017 9:40 pm

Hey folks,

I'm trying to use a simple robotic hand in an open environment to interact with a pyramid shaped object. Everything seems to be mostly working, however the hand can bounce off to infinity under certain circumstances. I suspect this is to be expected for an expert, but I'm new to the engine so I'm sure I'm doing something stupid.

What I'm aiming for is a freely moving hand that is flat unless the user deliberately rotates the palm out of the horizontal plane. In previous iterations of the code, moving the hand up and down would cause the hand to torque and rotate such that the thumb was pointing either up or down. I fix this by setting the angularDamping with the p.changeDynamics function, but I suspect this may be causing the bouncing off to infinity issue.

I've recorded a screencast of the hand bouncing off to infinity, as well as provided a gist of all the code and model files.

https://gist.github.com/MachineLearning ... bd1e7c7b8f

https://youtu.be/vTzrNlqmQn8

Any insight into what I'm doing incorrectly would be greatly appreciated.

DrPhil
Posts: 4
Joined: Wed Dec 13, 2017 7:33 pm

Re: Hand bouncing off to infinity

Post by DrPhil » Fri Dec 15, 2017 9:39 pm

Folks, I realized my original code may have been unclear, due to the presence of the ahead_view() and down_view() functions, as well as the fact I was using gist - which is probably the worst medium for this problem.

I've created a separate git repo with all the required files

https://github.com/MachineLearningLab-A ... nd-Example

Something interesting to note is that removing the ahead_view() seems to have resolved the issue with the hand bouncing off to infinity. As far as I can tell it is the line:

p.addUserDebugLine(link_p,[link_p[0]+0.1*axisY[0],link_p[1]+0.1*axisY[1],link_p[2]+0.1*axisY[2]],[1,0,0],2,0.2)

This seems to make the hand more rigid during collisions - meaning that when I ram the hand into the pyramid it maintains its pointing gesture, minus the deflection of the index finger.

Removing the ahead_view() function completely, the hand will deform during collisions. Meaning that it will bend back onto the wrist.

I suspect that it is the rigidity of the hand induced during the call to ahead_view() that causes the hand to bounce off to infinity. If the energy of the collision doesn't go into deflecting and manipulating the hand, it has to go somewhere. In the absence of that outlet, the engine decides to impart the energy to the hand's base, causing it to fly off.


So to recap - I have fixed the issue with the hand bouncing off to infinity, but it seems to be caused by the p.addUserDebugLine() function - no idea why. Can someone clarify the behavior for me?

User avatar
Erwin Coumans
Site Admin
Posts: 4113
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Hand bouncing off to infinity

Post by Erwin Coumans » Tue Dec 19, 2017 6:07 am

Remove the line

Code: Select all

p.changeDynamics(hand, linkIndex=-1, angularDamping=35.0)
since it is better to leave the damping as default and the value is out-of-range (we don't check against meaningless values at the moment)

DrPhil
Posts: 4
Joined: Wed Dec 13, 2017 7:33 pm

Re: Hand bouncing off to infinity

Post by DrPhil » Thu Dec 21, 2017 6:26 pm

Erwin, thanks for the reply.

I went ahead and removed the changeDynamics call, and that indeed gets rid of the bouncing off to infinity. However, it introduces a new issue.

When moving the hand down below the X-Y plane, the wrist rotates to the vertical position.

How can I uncouple the rotation of the hand from the up and down movement, without using the changeDynamics function and thus introducing the funny aberrant behavior?

Post Reply