8000 Adding inertias yields: AttributeError: 'SpatialInertia' object has no attribute 'I' · Issue #101 · bdaiinstitute/spatialmath-python · GitHub
[go: up one dir, main page]

Skip to conten 8000 t
Adding inertias yields: AttributeError: 'SpatialInertia' object has no attribute 'I' #101
Closed
@niederha

Description

@niederha

When adding two spatial inertia using the + override I get a AttributeError: 'SpatialInertia' object has no attribute 'I'.

I think I'm noticing 3 potential mistakes in the source code at line 637

return SpatialInertia(left.I + left.I)
  1. It seems SpatialInertia has no member I but rather a data[0]
  2. We're adding left twice and not right.
  3. I am not sure the syntax matches the definition in the constructor...

To make minimum changes, I would suggest rewritting this line as such:

total_inertia=SpatialInertia()
total_inertia.data[0] = left.data[0] + right.data[0]
return total_inertia

But I'm not familiar with the whole code corpus, and I just infer that from quickly reading the class. Does that seem correct? If so could we fix it? If it helps I am happy making a PR and expending tests so this doesn't happen anymore.

Otherwise, thanks for a cool library!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0