erwincoumans / tiny-differentiable-simulator

Tiny Differentiable Simulator is a header-only C++ and CUDA physics library for reinforcement learning and robotics with zero dependencies.
Apache License 2.0
1.2k stars 129 forks source link

Spherical joint implementation #53

Closed PaulSchreiner closed 3 years ago

PaulSchreiner commented 3 years ago

Here is the first version of the spherical joint implementation.

Like I wrote in my mail, there seems to be an issue with the implementation still. The simulation gets unstable for certain initial conditions or when there is more than a few links attached, I am not sure the two are related.

The initial condition case: I have been looking at what the bug can be and at first I thought it might be an issue with the inertia matrix but I couldn't find an error in the implemented logic. Then I thought it might have to do with how I initialized the joint. I initialized it exactly the same way as in the pendulum experiment: Initializing the joints with the center of mass at a pure y-axis position. Then having the initial quaternions as q0=[0,0,0,1] the simulation runs as expected. However, setting q0=[0,0,sqrt(1/2), sqrt(1/2)] renders it unstable. However, when I initialize it as having its CoM in the pure (-) z direction I can initialize using q0=[sqrt(1/2), 0, 0, sqrt(1/2)] and q0=[0,sqrt(1/2),0, sqrt(1/2)] and the simulation runs fine in both cases.

Still when initializing with more than ~7/8 spherical joints chained together renders the simulation unstable very quickly, I am wondering if this could be an integrator issue, i.e. that euler steps are not enough?

I will have a look at how RBDL does this for spherical joints.

google-cla[bot] commented 3 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

PaulSchreiner commented 3 years ago

@googlebot I signed it!

Paul Schreiner Industrial PhD Student

Rokoko.com http://www.rokoko.com/

On 3 Dec 2020, at 11.46, google-cla[bot] notifications@github.com wrote:

@googlebot I signed it!

google-cla[bot] commented 3 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

PaulSchreiner commented 3 years ago

@googlebot I signed it!

google-cla[bot] commented 3 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

erwincoumans commented 3 years ago

Thanks Paul. Are all the commits using the github email address that you registered, and the same email address for the CLA?

You could also try to create a new fork, using latest master, and re-apply the changes in a single commit making sure the email address is OK?

Also, travis compilation fails, can you check the output of travis? https://travis-ci.org/github/google-research/tiny-differentiable-simulator/builds/747393175

PaulSchreiner commented 3 years ago

Hi Erwin,

Sorry that I haven’t had the time to reply earlier.

I received a mail that there was an issue with my title, I can’t sign the CLA, it should be signed by an executive. That has now been done, so I am waiting for it to be approved by google now.

Best,

Paul Schreiner Industrial PhD Student

Rokoko.com http://www.rokoko.com/

On 7 Dec 2020, at 19.37, erwincoumans notifications@github.com wrote:

Thanks Paul. Are all the commits using the github email address that you registered, and the same email address for the CLA?

You could also try to create a new fork, using latest master, and re-apply the changes in a single commit making sure the email address is OK?

Also, travis compilation fails, can you check the output of travis? https://travis-ci.org/github/google-research/tiny-differentiable-simulator/builds/747393175 https://travis-ci.org/github/google-research/tiny-differentiable-simulator/builds/747393175 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/google-research/tiny-differentiable-simulator/pull/53#issuecomment-740101855, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGVVAZNFSDGHLJFJJMZPSJTSTUOFXANCNFSM4ULZKFOQ.

google-cla[bot] commented 3 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

PaulSchreiner commented 3 years ago

I am closing this, since it needs some unforseen implementation. I had not counted with the "EigenAlgebra" and the implications that has for the Matrix6x3 struct I made. I have been using the member functions of some of the Tiny structs instead of using the Algebra:: methods.

I'll change this and make a new PR when that is done.