Skip to content

Commit d2ab716

Browse files
authored
Merge pull request #164 from resibots/default_inertia
[robot]: use default inertia/mass of zero for links without mass
2 parents 94e32fb + 0dc5381 commit d2ab716

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/robot_dart/robot.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -1927,7 +1927,14 @@ namespace robot_dart {
19271927
boost::filesystem::path path(model_file);
19281928
std::string extension = path.extension().string();
19291929
if (extension == ".urdf") {
1930+
#if DART_VERSION_AT_LEAST(6, 12, 0)
1931+
dart::io::DartLoader::Options options;
1932+
// if links have no inertia, we put ~zero mass and very very small inertia
1933+
options.mDefaultInertia = dart::dynamics::Inertia(1e-10, Eigen::Vector3d::Zero(), Eigen::Matrix3d::Identity() * 1e-12);
1934+
dart::io::DartLoader loader(options);
1935+
#else
19301936
dart::io::DartLoader loader;
1937+
#endif
19311938
for (size_t i = 0; i < packages.size(); i++) {
19321939
std::string package = std::get<1>(packages[i]);
19331940
std::string package_path = _get_path(package);

0 commit comments

Comments
 (0)