Skip to content

Commit 6119809

Browse files
author
Kristopher Wehage
committed
Bypass saved pos file when using all abs actuators
1 parent fea6d91 commit 6119809

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/manager.cc

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,12 +1026,27 @@ bool fastcat::Manager::LoadActuatorPosFile()
10261026
break;
10271027
}
10281028
}
1029-
10301029
if (!actuators_in_topo) {
10311030
MSG("No actuators found in topology, bypassing saved positions file "
10321031
"functions");
10331032
return true;
10341033
}
1034+
1035+
bool all_absolute_actuators_in_topo = true;
1036+
for (auto device = jsd_device_list_.begin(); device != jsd_device_list_.end();
1037+
++device) {
1038+
std::shared_ptr<Actuator> actuator =
1039+
std::dynamic_pointer_cast<Actuator>(*device);
1040+
if (!actuator->HasAbsoluteEncoder()) {
1041+
all_absolute_actuators_in_topo = false;
1042+
break;
1043+
}
1044+
}
1045+
if (all_absolute_actuators_in_topo) {
1046+
MSG("Topology,contains only actuators with absolute encoders; bypassing processing "
1047+
"saved positions file");
1048+
return true;
1049+
}
10351050

10361051
if (!actuator_fault_on_missing_pos_file_) {
10371052
WARNING("YAML parameter \'actuator_fault_on_missing_pos_file\' is FALSE");
@@ -1124,15 +1139,13 @@ bool fastcat::Manager::ValidateActuatorPosFile()
11241139
}
11251140

11261141
actuator = std::dynamic_pointer_cast<Actuator>(*device);
1127-
1128-
auto find_pos_data = actuator_pos_map_.find(dev_name);
1129-
11301142
if (actuator->HasAbsoluteEncoder()) {
11311143
MSG("Actuator %s has absolute encoder so does not need saved position",
11321144
dev_name.c_str());
11331145
continue;
11341146
}
11351147

1148+
auto find_pos_data = actuator_pos_map_.find(dev_name);
11361149
if (find_pos_data == actuator_pos_map_.end()) {
11371150
if (!actuator_fault_on_missing_pos_file_) {
11381151
WARNING(

0 commit comments

Comments
 (0)