Skip to content

Commit

Permalink
Reset internal force of point mass before every simulation step (#1372)
Browse files Browse the repository at this point in the history
* Reset internal force of point mass before every simulation step

* Fix typos

* Update changelog
  • Loading branch information
jslee02 committed Jul 14, 2019
1 parent ae7f426 commit 2466c01
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

### [DART 6.10.0 (20XX-XX-XX)](https://github.com/dartsim/dart/milestone/58?closed=1)

* Dynamics

* Fixed soft body simulation when command input is not resetted: [#1372](https://github.com/dartsim/dart/pull/1372)

* GUI

* Fixed memory leaks from dart::gui::osg::Viewer: [#1349](https://github.com/dartsim/dart/pull/1349)
Expand Down
2 changes: 1 addition & 1 deletion dart/dynamics/PointMass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ void PointMass::updateBiasForceFD(double _dt, const Eigen::Vector3d& _gravity)
double kv = mParentSoftBodyNode->getVertexSpringStiffness();
double ke = mParentSoftBodyNode->getEdgeSpringStiffness();
double kd = mParentSoftBodyNode->getDampingCoefficient();
int nN = getNumConnectedPointMasses();
std::size_t nN = getNumConnectedPointMasses();
mAlpha = state.mForces - (kv + nN * ke) * getPositions()
- (_dt * (kv + nN * ke) + kd) * getVelocities()
- getMass() * getPartialAccelerations() - mB;
Expand Down
10 changes: 9 additions & 1 deletion dart/dynamics/SoftBodyNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,16 @@ void SoftBodyNode::updateBiasForce(
{
const Eigen::Matrix6d& mI
= BodyNode::mAspectProperties.mInertia.getSpatialTensor();
for (auto& pointMass : mPointMasses)
for (PointMass* pointMass : mPointMasses)
{
// Reset internal forces of point masses before used.
//
// Once control force for point mass is introduced, assign it to the
// internal force instead of always resetting the internal forces to zero.
pointMass->resetForces();

pointMass->updateBiasForceFD(_timeStep, _gravity);
}

// Gravity force
if (BodyNode::mAspectProperties.mGravityMode == true)
Expand Down

0 comments on commit 2466c01

Please sign in to comment.