revert linkNames in createMultiBody, we cannot pass pointers pointing to local memory (storing the string) around into shared memory or over the network.

This commit is contained in:
Erwin Coumans
2021-09-20 12:22:30 -07:00
parent 4e881118ef
commit 87605ca4c8
6 changed files with 10 additions and 26 deletions
@@ -2250,11 +2250,7 @@ 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] != 0
&& 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);
@@ -2332,11 +2328,6 @@ 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] != 0
&& 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);