File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -551,8 +551,27 @@ bool DynamixelHardware::InitDxlItems()
551
551
RCLCPP_INFO_STREAM (logger_, " $$$$$ Init Dxl Items" );
552
552
for (const hardware_interface::ComponentInfo & gpio : info_.gpios ) {
553
553
uint8_t id = static_cast <uint8_t >(stoi (gpio.parameters .at (" ID" )));
554
+
555
+ // First write items containing "Limit"
554
556
for (auto it : gpio.parameters ) {
555
- if (it.first != " ID" && it.first != " type" ) {
557
+ if (it.first != " ID" && it.first != " type" && it.first .find (" Limit" ) != std::string::npos) {
558
+ if (dxl_comm_->WriteItem (
559
+ id, it.first ,
560
+ static_cast <uint32_t >(stoi (it.second ))) != DxlError::OK)
561
+ {
562
+ RCLCPP_ERROR_STREAM (logger_, " [ID:" << std::to_string (id) << " ] Write Item error" );
563
+ return false ;
564
+ }
565
+ RCLCPP_INFO_STREAM (
566
+ logger_,
567
+ " [ID:" << std::to_string (id) << " ] item_name:" << it.first .c_str () << " \t data:" <<
568
+ stoi (it.second ));
569
+ }
570
+ }
571
+
572
+ // Then write the remaining items
573
+ for (auto it : gpio.parameters ) {
574
+ if (it.first != " ID" && it.first != " type" && it.first .find (" Limit" ) == std::string::npos) {
556
575
if (dxl_comm_->WriteItem (
557
576
id, it.first ,
558
577
static_cast <uint32_t >(stoi (it.second ))) != DxlError::OK)
You can’t perform that action at this time.
0 commit comments