Do not namespace empty actuator strings during attach.

Fixes #2233.

PiperOrigin-RevId: 698070772
Change-Id: I19613acfd407ba6a8ede40dad85324a70db480a8
This commit is contained in:
Alessio Quaglino
2024-11-19 10:41:15 -08:00
committed by Copybara-Service
parent e18567545b
commit 821f1d3f98
2 changed files with 38 additions and 16 deletions
+18 -6
View File
@@ -5031,8 +5031,12 @@ void mjCEquality::PointToLocal() {
void mjCEquality::NameSpace(const mjCModel* m) {
mjCBase::NameSpace(m);
spec_name1_ = m->prefix + spec_name1_ + m->suffix;
spec_name2_ = m->prefix + spec_name2_ + m->suffix;
if (!spec_name1_.empty()) {
spec_name1_ = m->prefix + spec_name1_ + m->suffix;
}
if (!spec_name2_.empty()) {
spec_name2_ = m->prefix + spec_name2_ + m->suffix;
}
}
@@ -5526,7 +5530,9 @@ void mjCWrap::PointToLocal() {
void mjCWrap::NameSpace(const mjCModel* m) {
name = m->prefix + name + m->suffix;
sidesite = m->prefix + sidesite + m->suffix;
if (!sidesite.empty()) {
sidesite = m->prefix + sidesite + m->suffix;
}
}
@@ -5724,9 +5730,15 @@ void mjCActuator::NameSpace(const mjCModel* m) {
if (!plugin_instance_name.empty()) {
plugin_instance_name = m->prefix + plugin_instance_name + m->suffix;
}
spec_target_ = m->prefix + spec_target_ + m->suffix;
spec_refsite_ = m->prefix + spec_refsite_ + m->suffix;
spec_slidersite_ = m->prefix + spec_slidersite_ + m->suffix;
if (!spec_target_.empty()) {
spec_target_ = m->prefix + spec_target_ + m->suffix;
}
if (!spec_refsite_.empty()) {
spec_refsite_ = m->prefix + spec_refsite_ + m->suffix;
}
if (!spec_slidersite_.empty()) {
spec_slidersite_ = m->prefix + spec_slidersite_ + m->suffix;
}
}