@@ -288,6 +288,7 @@ namespace robot_dart {
288
288
ROBOT_DART_EXCEPTION_INTERNAL_ASSERT (_skeleton != nullptr );
289
289
_skeleton->setName (robot_name);
290
290
_set_damages (damages);
291
+ reset ();
291
292
}
292
293
293
294
std::shared_ptr<Robot> Robot::clone () const
@@ -488,9 +489,22 @@ namespace robot_dart {
488
489
_skeleton->resetPositions ();
489
490
_skeleton->resetVelocities ();
490
491
_skeleton->resetAccelerations ();
491
- this ->clear_external_forces ();
492
+
493
+ clear_internal_forces ();
494
+ reset_commands ();
495
+ clear_external_forces ();
492
496
}
493
497
498
+ void Robot::clear_external_forces () { _skeleton->clearExternalForces (); }
499
+
500
+ void Robot::clear_internal_forces ()
501
+ {
502
+ _skeleton->clearInternalForces ();
503
+ _skeleton->clearConstraintImpulses ();
504
+ }
505
+
506
+ void Robot::reset_commands () { _skeleton->resetCommands (); }
507
+
494
508
void Robot::set_actuator_types (const std::string& type, const std::vector<std::string>& joint_names, bool override_mimic, bool override_base)
495
509
{
496
510
// Set all dofs to same actuator type
@@ -1003,8 +1017,6 @@ namespace robot_dart {
1003
1017
bd->addExtTorque (torque, local);
1004
1018
}
1005
1019
1006
- void Robot::clear_external_forces () { _skeleton->clearExternalForces (); }
1007
-
1008
1020
Eigen::Vector6d Robot::external_forces (const std::string& body_name) const
1009
1021
{
1010
1022
auto bd = _skeleton->getBodyNode (body_name);
@@ -1718,8 +1730,10 @@ namespace robot_dart {
1718
1730
body->setInertia (inertia);
1719
1731
1720
1732
// Put the body into position
1733
+ auto robot = std::make_shared<Robot>(box_skel, box_name);
1734
+
1721
1735
if (type == " free" ) // free floating
1722
- box_skel-> setPositions (pose);
1736
+ robot-> set_positions (pose);
1723
1737
else // fixed
1724
1738
{
1725
1739
Eigen::Isometry3d T;
@@ -1728,7 +1742,7 @@ namespace robot_dart {
1728
1742
body->getParentJoint ()->setTransformFromParentBodyNode (T);
1729
1743
}
1730
1744
1731
- return std::make_shared<Robot>(box_skel, box_name) ;
1745
+ return robot ;
1732
1746
}
1733
1747
1734
1748
std::shared_ptr<Robot> Robot::create_ellipsoid (const Eigen::Vector3d& dims,
@@ -1759,9 +1773,11 @@ namespace robot_dart {
1759
1773
inertia.setMoment (ellipsoid->computeInertia (mass));
1760
1774
body->setInertia (inertia);
1761
1775
1776
+ auto robot = std::make_shared<Robot>(ellipsoid_skel, ellipsoid_name);
1777
+
1762
1778
// Put the body into position
1763
1779
if (type == " free" ) // free floating
1764
- ellipsoid_skel-> setPositions (pose);
1780
+ robot-> set_positions (pose);
1765
1781
else // fixed
1766
1782
{
1767
1783
Eigen::Isometry3d T;
@@ -1770,6 +1786,6 @@ namespace robot_dart {
1770
1786
body->getParentJoint ()->setTransformFromParentBodyNode (T);
1771
1787
}
1772
1788
1773
- return std::make_shared<Robot>(ellipsoid_skel, ellipsoid_name) ;
1789
+ return robot ;
1774
1790
}
1775
1791
} // namespace robot_dart
0 commit comments