Skip to content
This repository was archived by the owner on Dec 1, 2020. It is now read-only.

Commit a3a9e71

Browse files
committed
Added current control bandwith to the json and updated the format.
1 parent c6531b6 commit a3a9e71

File tree

4 files changed

+13
-19
lines changed

4 files changed

+13
-19
lines changed

march_hardware/config/march_odrive.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
"type":"float",
3535
"value":50000.0
3636
},
37+
{
38+
"name":"axis0.motor.config.current_control_bandwidth",
39+
"type":"float",
40+
"value":100.0
41+
},
42+
3743
{
3844
"name":"axis0.motor.config.motor_type",
3945
"type":"uint8",
@@ -54,11 +60,6 @@
5460
"type":"uint8",
5561
"value":1
5662
},
57-
{
58-
"name":"axis0.motor.config.direction",
59-
"type":"int32",
60-
"value":0
61-
},
6263
{
6364
"name":"axis0.sensorless_estimator.config.pm_flux_linkage",
6465
"type":"float",

march_hardware/src/odrive/odrive.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,17 +323,17 @@ int Odrive::json_string_write(const Json::Value& json_parameter_object)
323323
}
324324
else if (type_name == "int8")
325325
{
326-
int8_t casted_value = value.asUInt();
326+
int8_t casted_value = value.asInt();
327327
return this->write(parameter_name, casted_value);
328328
}
329329
else if (type_name == "int16")
330330
{
331-
int16_t casted_value = value.asUInt();
331+
int16_t casted_value = value.asInt();
332332
return this->write(parameter_name, casted_value);
333333
}
334334
else if (type_name == "int32")
335335
{
336-
int32_t casted_value = value.asUInt();
336+
int32_t casted_value = value.asInt();
337337
return this->write(parameter_name, casted_value);
338338
}
339339
else if (type_name == "float")

march_hardware/src/odrive/odrive_motor.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ void OdriveMotor::actuateRad(double target_rad)
109109
void OdriveMotor::actuateTorque(double target_torque_ampere)
110110
{
111111
float target_torque_ampere_float = (float)target_torque_ampere;
112-
ROS_INFO("target torque: %f", target_torque_ampere_float);
113112

114113
std::string command_name_ = this->create_command(O_PM_DESIRED_MOTOR_CURRENT);
115114
if (this->write(command_name_, target_torque_ampere_float) == 1)
@@ -211,12 +210,10 @@ float OdriveMotor::getMotorCurrent()
211210
std::string command_name_ = this->create_command(O_PM_ACTUAL_MOTOR_CURRENT);
212211
if (this->read(command_name_, motor_current) == 1)
213212
{
214-
ROS_ERROR("Could not retrieve motor courrent");
213+
ROS_ERROR("Could not retrieve motor current");
215214
return ODRIVE_ERROR;
216215
}
217216

218-
ROS_INFO("actual torque: %f", motor_current);
219-
220217
return motor_current;
221218
}
222219

@@ -235,10 +232,7 @@ float OdriveMotor::getMotorVoltage()
235232

236233
double OdriveMotor::getTorque()
237234
{
238-
double motor_current = this->getMotorCurrent();
239-
double motor_torque = CURRENT_TO_TORQUE_CONVERSION * motor_current / MOTOR_KV;
240-
241-
return motor_torque;
235+
return this->getMotorCurrent();
242236
}
243237

244238
int OdriveMotor::getAngleCountsAbsolute()
@@ -268,7 +262,7 @@ int OdriveMotor::getAngleCountsIncremental()
268262
if (this->read(command_name_, iu_position) == 1)
269263
{
270264
ROS_ERROR("Could not retrieve incremental position of the encoder");
271-
return ODRIVE_ERROR;
265+
return ODRIVE_ERROR
272266
}
273267
return iu_position;
274268
}
@@ -286,7 +280,7 @@ double OdriveMotor::getVelocityRadIncremental()
286280
if (this->read(command_name_, iu_velocity) == 1)
287281
{
288282
ROS_ERROR("Could not retrieve incremental velocity of the encoder");
289-
return ODRIVE_ERROR;
283+
return ODRIVE_ERROR
290284
}
291285

292286
double angle_rad = iu_velocity * PI_2 / (std::pow(2, 12) * 101);

march_hardware_builder/include/march_hardware_builder/allowed_robot.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class AllowedRobot
2424
AllowedRobot() = default;
2525
explicit AllowedRobot(const std::string& robot_name)
2626
{
27-
ROS_WARN("Used robot %s", robot_name);
2827
if (robot_name == "march4")
2928
{
3029
this->value = march4;

0 commit comments

Comments
 (0)