WPI-AIM / ambf_addon

A Graphical add-on for Blender for Creating and Loading AMBF Models
10 stars 8 forks source link

dupicate "inertia" tag in blender YAML file makes model unstable in ambf_simulator #7

Closed cshreyastech closed 3 years ago

cshreyastech commented 3 years ago

Steps to reproduce: Blender version: 2.83.1 1) Load ADF file for any model 2) Click on "Estimate Body Inertia" button 3) Click on "Write AMBF Description File" 4) launch the model in ambf_simulator

Observed Result: Model joints thrown all over the place.

After debugging I found that this was due to duplicate inertia tags in YAML file. inertia: ix: 0.2957 iy: 0.295 iz: 0.0

inertial offset: position: x: 0.0 y: -0.0169 z: 0.1342 orientation: r: 0 p: 0 y: 0

Fix: Renamed "inertia" tag body_inertia in the yaml file file and launched the model in ambf_simulator. Model worked fine body_inertia: ix: 0.2957 iy: 0.295 iz: 0.0

adnanmunawar commented 3 years ago

Hey Shreyas, thanks for creating the issue. Are you talking about inertia and inertial offset as the two duplicates? They stand for different purposes.

adnanmunawar commented 3 years ago

Great catch. However, as it so happens, the error is different from what you understood. When you name the field to 'body inertia', all it does is that AMBF ignores this field and thus the result is the same as not setting the inertia in the first place, in which case AMBF internally calculates the inertia.

Secondly, the field is not duplicated as highlighted by my post above.

The real issue happened to be a bug in the calculation of the Parallel Axis Theorem, which should be fixed by the following commit.

cshreyastech commented 3 years ago

I see, thanks for the clarification @adnanmunawar .

cshreyastech commented 3 years ago

@adnanmunawar this is still an issue with PSM. it works fine for ECM

adnanmunawar commented 3 years ago

I think the commit fixed this issue.

cshreyastech commented 3 years ago

Thanks