File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -237,16 +237,14 @@ hardware_interface::CallbackReturn DynamixelHardware::on_init(
237237 [&name](const hardware_interface::ComponentInfo & joint) {
238238 return joint.name == name;
239239 });
240- if (itr != info_.gpios .end ()) {
241- auto params = info_.gpios [std::distance (info_.joints .begin (), itr)].parameters ;
242- if (std::find_if (params.begin (), params.end (),
243- [](const std::pair<std::string, std::string> & p) {
244- return p.first == " Homing Offset" ;
245- }) == params.end ())
240+ if (itr != info_.joints .end ()) {
241+ const auto gpio_idx = std::distance (info_.joints .begin (), itr);
242+ const auto & params = info_.gpios [gpio_idx].parameters ;
243+ if (params.find (" Homing Offset" ) == params.end ())
246244 {
247- info_.gpios [std::distance (info_. joints . begin (), itr) ].parameters .emplace (
248- " Homing Offset" ,
249- std::to_string (std::round (rising * (180.0 / M_PI) / (360.0 / 4095 ))));
245+ info_.gpios [gpio_idx ].parameters .emplace (
246+ " Homing Offset" ,
247+ std::to_string (std::round (rising * (180.0 / M_PI) / (360.0 / 4095 ))));
250248 }
251249 }
252250 }
You can’t perform that action at this time.
0 commit comments