Skip to content

Commit

Permalink
Merge pull request #2416 from nim65s/issue/2304
Browse files Browse the repository at this point in the history
contact-info: cache nv, fix #2304
  • Loading branch information
jorisv authored Sep 16, 2024
2 parents 52d1e7a + 3720a89 commit e792f90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- Fix linkage of Boost.Serialization on Windows ([#2400](https://github.com/stack-of-tasks/pinocchio/pull/2400))
- Fix mjcf parser appending of inertias at root joint ([#2403](https://github.com/stack-of-tasks/pinocchio/pull/2403))
- Fix unit tests with GCC 13.3 ([#2406](https://github.com/stack-of-tasks/pinocchio/pull/2416)

## [3.2.0] - 2024-08-27

Expand Down
9 changes: 6 additions & 3 deletions include/pinocchio/algorithm/contact-info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,9 +742,10 @@ namespace pinocchio
if (current1_id > current2_id)
{
const JointModel & joint1 = model.joints[current1_id];
const int j1nv = joint1.nv();
joint1_span_indexes.push_back((Eigen::DenseIndex)current1_id);
Eigen::DenseIndex current1_col_id = joint1.idx_v();
for (int k = 0; k < joint1.nv(); ++k, ++current1_col_id)
for (int k = 0; k < j1nv; ++k, ++current1_col_id)
{
colwise_joint1_sparsity[current1_col_id] = true;
}
Expand All @@ -753,9 +754,10 @@ namespace pinocchio
else
{
const JointModel & joint2 = model.joints[current2_id];
const int j2nv = joint2.nv();
joint2_span_indexes.push_back((Eigen::DenseIndex)current2_id);
Eigen::DenseIndex current2_col_id = joint2.idx_v();
for (int k = 0; k < joint2.nv(); ++k, ++current2_col_id)
for (int k = 0; k < j2nv; ++k, ++current2_col_id)
{
colwise_joint2_sparsity[current2_col_id] = true;
}
Expand All @@ -770,10 +772,11 @@ namespace pinocchio
while (current_id > 0)
{
const JointModel & joint = model.joints[current_id];
const int jnv = joint.nv();
joint1_span_indexes.push_back((Eigen::DenseIndex)current_id);
joint2_span_indexes.push_back((Eigen::DenseIndex)current_id);
Eigen::DenseIndex current_row_id = joint.idx_v();
for (int k = 0; k < joint.nv(); ++k, ++current_row_id)
for (int k = 0; k < jnv; ++k, ++current_row_id)
{
colwise_joint1_sparsity[current_row_id] = true;
colwise_joint2_sparsity[current_row_id] = true;
Expand Down

0 comments on commit e792f90

Please sign in to comment.