Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset internal force of point mass before every simulation step #1372

Merged
merged 3 commits into from
Jul 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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