@@ -500,15 +500,29 @@ namespace pinocchio
500500 namespace fs = boost::filesystem;
501501 MjcfTexture text;
502502 auto file = el.get_optional <std::string>(" <xmlattr>.file" );
503- if (!file)
504- throw std::invalid_argument (" Only textures with files are supported" );
505-
506- fs::path filePath (*file);
507- std::string name = getName (el, filePath);
503+ auto name_ = el.get_optional <std::string>(" <xmlattr>.name" );
504+ auto type = el.get_optional <std::string>(" <xmlattr>.type" );
508505
509- text.filePath =
510- updatePath (compilerInfo.strippath , compilerInfo.texturedir , modelPath, filePath).string ();
506+ std::string name;
507+ if (name_)
508+ name = *name_;
509+ else if (type && *type == " skybox" )
510+ name = *type;
511+ if (!file)
512+ {
513+ std::cout << " Warning - Only texture with files are supported" << std::endl;
514+ if (name.empty ())
515+ throw std::invalid_argument (" Textures need a name." );
516+ }
517+ else
518+ {
519+ fs::path filePath (*file);
520+ name = getName (el, filePath);
511521
522+ text.filePath =
523+ updatePath (compilerInfo.strippath , compilerInfo.texturedir , modelPath, filePath)
524+ .string ();
525+ }
512526 auto str_v = el.get_optional <std::string>(" <xmlattr>.type" );
513527 if (str_v)
514528 text.textType = *str_v;
@@ -785,15 +799,12 @@ namespace pinocchio
785799 {
786800
787801 FrameIndex parentFrameId = 0 ;
788- Inertia inert = Inertia::Zero ();
789802 if (!currentBody.bodyParent .empty ())
790- {
791803 parentFrameId = urdfVisitor.getBodyId (currentBody.bodyParent );
792- inert = currentBody.bodyInertia ;
793- }
804+
794805 // get body pose in body parent
795806 const SE3 bodyPose = currentBody.bodyPlacement ;
796-
807+ Inertia inert = currentBody. bodyInertia ;
797808 SE3 jointInParent = bodyPose * joint.jointPlacement ;
798809 bodyInJoint = joint.jointPlacement .inverse ();
799810 UrdfVisitor::JointType jType;
@@ -1036,7 +1047,8 @@ namespace pinocchio
10361047 // get name and inertia of first root link
10371048 std::string rootLinkName = bodiesList.at (0 );
10381049 MjcfBody rootBody = mapOfBodies.find (rootLinkName)->second ;
1039- urdfVisitor.addRootJoint (rootBody.bodyInertia , rootLinkName);
1050+ if (rootBody.jointChildren .size () == 0 )
1051+ urdfVisitor.addRootJoint (rootBody.bodyInertia , rootLinkName);
10401052
10411053 fillReferenceConfig (rootBody);
10421054 for (const auto & entry : bodiesList)
0 commit comments