Fixed converting rotations to radians
This commit is contained in:
@ -101,8 +101,8 @@ hardware_interface::return_type mg_wheel_interface::MgOdriveInterface::read(cons
|
|||||||
odrive_serial_interface.ReadLine(resp_l,'\n',10);
|
odrive_serial_interface.ReadLine(resp_l,'\n',10);
|
||||||
odrive_serial_interface.Write("f 0\n");
|
odrive_serial_interface.Write("f 0\n");
|
||||||
odrive_serial_interface.ReadLine(resp_r,'\n',10);
|
odrive_serial_interface.ReadLine(resp_r,'\n',10);
|
||||||
left_wheel_pos_state = std::stod(resp_l);
|
left_wheel_pos_state = std::stod(resp_l)*2*M_PI;
|
||||||
right_wheel_pos_state = -std::stod(resp_r);
|
right_wheel_pos_state = -std::stod(resp_r)*2*M_PI;
|
||||||
return hardware_interface::return_type::OK ;
|
return hardware_interface::return_type::OK ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,8 +113,8 @@ hardware_interface::return_type mg_wheel_interface::MgOdriveInterface::write(con
|
|||||||
std::string cmd_right;
|
std::string cmd_right;
|
||||||
int hash;
|
int hash;
|
||||||
|
|
||||||
cmd_left = "v 1 " + std::to_string(left_wheel_vel_cmd/M_PI) + " ";
|
cmd_left = "v 1 " + std::to_string(left_wheel_vel_cmd/2*M_PI) + " ";
|
||||||
cmd_right = "v 0 " + std::to_string(-right_wheel_vel_cmd/M_PI) + " ";
|
cmd_right = "v 0 " + std::to_string(-right_wheel_vel_cmd/2*M_PI) + " ";
|
||||||
|
|
||||||
hash = 0;
|
hash = 0;
|
||||||
for(const auto &c: cmd_left) {
|
for(const auto &c: cmd_left) {
|
||||||
|
|||||||
Reference in New Issue
Block a user