- modified torque control code
This commit is contained in:
@ -3,7 +3,7 @@ model_name = H42-20-S300-R
|
||||
device_type = dynamixel
|
||||
|
||||
[type info]
|
||||
current_ratio = 4.0283203125
|
||||
torque_to_current_value_ratio = 27.15146
|
||||
|
||||
value_of_0_radian_position = 0
|
||||
value_of_min_radian_position = -151900
|
||||
|
@ -3,7 +3,7 @@ model_name = H54-100-S500-R
|
||||
device_type = dynamixel
|
||||
|
||||
[type info]
|
||||
current_ratio = 16.11328125
|
||||
torque_to_current_value_ratio = 9.66026
|
||||
|
||||
value_of_0_radian_position = 0
|
||||
value_of_min_radian_position = -250950
|
||||
|
@ -3,7 +3,7 @@ model_name = H54-200-B500-R
|
||||
device_type = dynamixel
|
||||
|
||||
[type info]
|
||||
current_ratio = 16.11328125
|
||||
torque_to_current_value_ratio = 9.09201
|
||||
|
||||
value_of_0_radian_position = 0
|
||||
value_of_min_radian_position = -250950
|
||||
|
@ -3,7 +3,7 @@ model_name = H54-200-S500-R
|
||||
device_type = dynamixel
|
||||
|
||||
[type info]
|
||||
current_ratio = 16.11328125
|
||||
torque_to_current_value_ratio = 9.09201
|
||||
|
||||
value_of_0_radian_position = 0
|
||||
value_of_min_radian_position = -250950
|
||||
|
@ -3,8 +3,6 @@ model_name = L54-30-S400-R
|
||||
device_type = dynamixel
|
||||
|
||||
[type info]
|
||||
current_ratio = 16.11328125
|
||||
|
||||
value_of_0_radian_position = 0
|
||||
value_of_min_radian_position = -144198
|
||||
value_of_max_radian_position = 144198
|
||||
|
@ -3,8 +3,6 @@ model_name = L54-30-S500-R
|
||||
device_type = dynamixel
|
||||
|
||||
[type info]
|
||||
current_ratio = 16.11328125
|
||||
|
||||
value_of_0_radian_position = 0
|
||||
value_of_min_radian_position = -180684
|
||||
value_of_max_radian_position = 180684
|
||||
|
@ -3,8 +3,6 @@ model_name = L54-50-S290-R
|
||||
device_type = dynamixel
|
||||
|
||||
[type info]
|
||||
current_ratio = 16.11328125
|
||||
|
||||
value_of_0_radian_position = 0
|
||||
value_of_min_radian_position = -103860
|
||||
value_of_max_radian_position = 103860
|
||||
|
@ -3,8 +3,6 @@ model_name = L54-50-S500-R
|
||||
device_type = dynamixel
|
||||
|
||||
[type info]
|
||||
current_ratio = 16.11328125
|
||||
|
||||
value_of_0_radian_position = 0
|
||||
value_of_min_radian_position = -180684
|
||||
value_of_max_radian_position = 180684
|
||||
|
@ -3,8 +3,6 @@ model_name = M42-10-S260-R
|
||||
device_type = dynamixel
|
||||
|
||||
[type info]
|
||||
current_ratio = 4.0283203125
|
||||
|
||||
value_of_0_radian_position = 0
|
||||
value_of_min_radian_position = -131584
|
||||
value_of_max_radian_position = 131584
|
||||
|
@ -3,8 +3,6 @@ model_name = M54-40-S250-R
|
||||
device_type = dynamixel
|
||||
|
||||
[type info]
|
||||
current_ratio = 16.11328125
|
||||
|
||||
value_of_0_radian_position = 0
|
||||
value_of_min_radian_position = -125700
|
||||
value_of_max_radian_position = 125700
|
||||
|
@ -3,8 +3,6 @@ model_name = M54-60-S250-R
|
||||
device_type = dynamixel
|
||||
|
||||
[type info]
|
||||
current_ratio = 16.11328125
|
||||
|
||||
value_of_0_radian_position = 0
|
||||
value_of_min_radian_position = -125700
|
||||
value_of_max_radian_position = 125700
|
||||
|
@ -3,7 +3,7 @@ model_name = XM-430
|
||||
device_type = dynamixel
|
||||
|
||||
[type info]
|
||||
current_ratio = 2.69
|
||||
torque_to_current_value_ratio = 178.842161
|
||||
|
||||
value_of_0_radian_position = 2048
|
||||
value_of_min_radian_position = 0
|
||||
|
@ -56,8 +56,8 @@ public:
|
||||
std::string ctrl_module_name_;
|
||||
DynamixelState *dxl_state_;
|
||||
|
||||
double current_ratio_;
|
||||
double velocity_ratio_;
|
||||
double velocity_to_value_ratio_;
|
||||
double torque_to_current_value_ratio_;
|
||||
|
||||
int32_t value_of_0_radian_position_;
|
||||
int32_t value_of_min_radian_position_;
|
||||
@ -82,8 +82,8 @@ public:
|
||||
double convertValue2Velocity(int32_t value);
|
||||
int32_t convertVelocity2Value(double velocity);
|
||||
|
||||
double convertValue2Current(int16_t value);
|
||||
int16_t convertCurrent2Value(double current);
|
||||
double convertValue2Torque(int16_t value);
|
||||
int16_t convertTorque2Value(double torque);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
double present_current_;
|
||||
double goal_position_;
|
||||
double goal_velocity_;
|
||||
double goal_current_;
|
||||
double goal_torque_;
|
||||
double position_p_gain_;
|
||||
|
||||
std::map<std::string, uint32_t> bulk_read_table_;
|
||||
@ -72,7 +72,7 @@ public:
|
||||
present_current_(0.0),
|
||||
goal_position_(0.0),
|
||||
goal_velocity_(0.0),
|
||||
goal_current_(0.0),
|
||||
goal_torque_(0.0),
|
||||
position_p_gain_(0.0),
|
||||
position_offset_(0.0)
|
||||
{
|
||||
|
@ -41,8 +41,8 @@ using namespace robotis_framework;
|
||||
|
||||
Dynamixel::Dynamixel(int id, std::string model_name, float protocol_version)
|
||||
: ctrl_module_name_("none"),
|
||||
current_ratio_(1.0),
|
||||
velocity_ratio_(1.0),
|
||||
torque_to_current_value_ratio_(1.0),
|
||||
velocity_to_value_ratio_(1.0),
|
||||
value_of_0_radian_position_(0),
|
||||
value_of_min_radian_position_(0),
|
||||
value_of_max_radian_position_(0),
|
||||
@ -128,20 +128,20 @@ int32_t Dynamixel::convertRadian2Value(double radian)
|
||||
|
||||
double Dynamixel::convertValue2Velocity(int32_t value)
|
||||
{
|
||||
return (double) value * velocity_ratio_;
|
||||
return (double) value / velocity_to_value_ratio_;
|
||||
}
|
||||
|
||||
int32_t Dynamixel::convertVelocity2Value(double velocity)
|
||||
{
|
||||
return (int32_t) (velocity / velocity_ratio_);;
|
||||
return (int32_t) (velocity * velocity_to_value_ratio_);;
|
||||
}
|
||||
|
||||
double Dynamixel::convertValue2Current(int16_t value)
|
||||
double Dynamixel::convertValue2Torque(int16_t value)
|
||||
{
|
||||
return (double) value * current_ratio_;
|
||||
return (double) value / torque_to_current_value_ratio_;
|
||||
}
|
||||
|
||||
int16_t Dynamixel::convertCurrent2Value(double current)
|
||||
int16_t Dynamixel::convertTorque2Value(double torque)
|
||||
{
|
||||
return (int16_t) (current / current_ratio_);
|
||||
return (int16_t) (torque * torque_to_current_value_ratio_);
|
||||
}
|
||||
|
@ -366,10 +366,10 @@ Dynamixel *Robot::getDynamixel(std::string path, int id, std::string port, float
|
||||
if (tokens.size() != 2)
|
||||
continue;
|
||||
|
||||
if (tokens[0] == "current_ratio")
|
||||
dxl->current_ratio_ = std::atof(tokens[1].c_str());
|
||||
else if (tokens[0] == "velocity_ratio")
|
||||
dxl->velocity_ratio_ = std::atof(tokens[1].c_str());
|
||||
if (tokens[0] == "torque_to_current_value_ratio")
|
||||
dxl->torque_to_current_value_ratio_ = std::atof(tokens[1].c_str());
|
||||
else if (tokens[0] == "velocity_to_value_ratio")
|
||||
dxl->velocity_to_value_ratio_ = std::atof(tokens[1].c_str());
|
||||
|
||||
else if (tokens[0] == "value_of_0_radian_position")
|
||||
dxl->value_of_0_radian_position_ = std::atoi(tokens[1].c_str());
|
||||
|
Reference in New Issue
Block a user