add link names args to CreateMultibody

This commit is contained in:
yycho0108
2021-01-20 15:53:24 +09:00
parent d274093f76
commit c0d9553d65
6 changed files with 45 additions and 7 deletions
@@ -2232,6 +2232,11 @@ struct ProgrammaticUrdfInterface : public URDFImporterInterface
///pure virtual interfaces, precondition is a valid linkIndex (you can assert/terminate if the linkIndex is out of range)
virtual std::string getLinkName(int linkIndex) const
{
// Allow user overrides on default-created link names.
if(m_createBodyArgs.m_linkNames[linkIndex] != nullptr
&& strlen(m_createBodyArgs.m_linkNames[linkIndex]) > 0){
return std::string(m_createBodyArgs.m_linkNames[linkIndex]);
}
std::string linkName = "link";
char numstr[21]; // enough to hold all numbers up to 64-bits
sprintf(numstr, "%d", linkIndex);
@@ -2309,6 +2314,11 @@ struct ProgrammaticUrdfInterface : public URDFImporterInterface
virtual std::string getJointName(int linkIndex) const
{
// Allow user overrides on default-created joint names.
if(m_createBodyArgs.m_linkNames[linkIndex] != nullptr
&& strlen(m_createBodyArgs.m_linkNames[linkIndex]) > 0){
return std::string(m_createBodyArgs.m_linkNames[linkIndex]);
}
std::string jointName = "joint";
char numstr[21]; // enough to hold all numbers up to 64-bits
sprintf(numstr, "%d", linkIndex);