File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -840,7 +840,7 @@ DxlError Dynamixel::GetDxlValueFromSyncRead()
840840 dxl_info_.ConvertValueRPMToVelocityRPS (ID, static_cast <int32_t >(dxl_getdata));
841841 } else if (indirect_info_read_[ID].item_name .at (item_index) == " Present Current" ) {
842842 *it_read_data.item_data_ptr_vec .at (item_index) =
843- dxl_info_.ConvertCurrentToEffort (ID, static_cast <int16_t >(dxl_getdata));
843+ dxl_info_.ConvertCurrentToEffort (ID, static_cast <int16_t >(dxl_getdata));
844844 } else {
845845 *it_read_data.item_data_ptr_vec .at (item_index) =
846846 static_cast <double >(dxl_getdata);
@@ -962,7 +962,7 @@ DxlError Dynamixel::GetDxlValueFromBulkRead()
962962 dxl_info_.ConvertValueRPMToVelocityRPS (ID, static_cast <int32_t >(dxl_getdata));
963963 } else if (indirect_info_read_[ID].item_name .at (item_index) == " Present Current" ) {
964964 *it_read_data.item_data_ptr_vec .at (item_index) =
965- dxl_info_.ConvertCurrentToEffort (ID, static_cast <int16_t >(dxl_getdata));
965+ dxl_info_.ConvertCurrentToEffort (ID, static_cast <int16_t >(dxl_getdata));
966966 } else {
967967 *it_read_data.item_data_ptr_vec .at (item_index) =
968968 static_cast <double >(dxl_getdata);
Original file line number Diff line number Diff line change @@ -869,17 +869,23 @@ void DynamixelHardware::CalcJointToTransmission()
869869 }
870870
871871 for (size_t i = 0 ; i < num_of_transmissions_; i++) {
872- if (hdl_trans_commands_.at (i).interface_name_vec .size () > GOAL_CURRENT_INDEX && hdl_trans_commands_.at (i).interface_name_vec .at (GOAL_CURRENT_INDEX) == " Goal Current" )
872+ if (hdl_trans_commands_.at (i).interface_name_vec .size () > GOAL_CURRENT_INDEX &&
873+ hdl_trans_commands_.at (i).interface_name_vec .at (GOAL_CURRENT_INDEX) == " Goal Current" )
873874 {
874- double value = 0.0 ;
875- for (size_t j = 0 ; j < num_of_joints_; j++) {
876- if (hdl_joint_commands_.at (j).interface_name_vec .size () > GOAL_CURRENT_INDEX && hdl_joint_commands_.at (j).interface_name_vec .at (GOAL_CURRENT_INDEX) == hardware_interface::HW_IF_EFFORT)
875+ for (size_t j = 0 ; j < hdl_joint_commands_.size (); j++)
876+ {
877+ if (hdl_joint_commands_.at (j).interface_name_vec .size () > GOAL_CURRENT_INDEX &&
878+ hdl_joint_commands_.at (j).interface_name_vec .at (GOAL_CURRENT_INDEX) ==
879+ hardware_interface::HW_IF_EFFORT)
877880 {
878- value += joint_to_transmission_matrix_[i][j] *
879- (*hdl_joint_commands_.at (j).value_ptr_vec .at (GOAL_CURRENT_INDEX));
881+ double value = 0.0 ;
882+ for (size_t k = 0 ; k < num_of_joints_; k++) {
883+ value += joint_to_transmission_matrix_[i][k] *
884+ (*hdl_joint_commands_.at (k).value_ptr_vec .at (GOAL_CURRENT_INDEX));
885+ }
886+ *hdl_trans_commands_.at (i).value_ptr_vec .at (GOAL_CURRENT_INDEX) = value;
880887 }
881888 }
882- *hdl_trans_commands_.at (i).value_ptr_vec .at (GOAL_CURRENT_INDEX) = value;
883889 }
884890 }
885891}
You can’t perform that action at this time.
0 commit comments