Skip to content

Commit 389c3c2

Browse files
committed
fix: remove redundant loop in sensor state initialization in InitDxlReadItems
1 parent d8ddfe8 commit 389c3c2

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/dynamixel_hardware_interface.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -811,15 +811,13 @@ bool DynamixelHardware::InitDxlReadItems()
811811

812812
} else if (gpio.state_interfaces.size() && gpio.parameters.at("type") == "sensor") {
813813
HandlerVarType temp_sensor;
814-
for (auto it : gpio.state_interfaces) {
815-
uint8_t id = static_cast<uint8_t>(stoi(gpio.parameters.at("ID")));
814+
uint8_t id = static_cast<uint8_t>(stoi(gpio.parameters.at("ID")));
816815

817-
temp_sensor.id = id;
818-
temp_sensor.name = gpio.name;
819-
for (auto it : gpio.state_interfaces) {
820-
temp_sensor.interface_name_vec.push_back(it.name);
821-
temp_sensor.value_ptr_vec.push_back(std::make_shared<double>(0.0));
822-
}
816+
temp_sensor.id = id;
817+
temp_sensor.name = gpio.name;
818+
for (auto it : gpio.state_interfaces) {
819+
temp_sensor.interface_name_vec.push_back(it.name);
820+
temp_sensor.value_ptr_vec.push_back(std::make_shared<double>(0.0));
823821
}
824822
hdl_gpio_sensor_states_.push_back(temp_sensor);
825823
}

0 commit comments

Comments
 (0)