Factor-Robotics / odrive_ros2_control

ODrive driver for ros2_control
Apache License 2.0
250 stars 82 forks source link

One motor runs in wrong direction with diff drive #29

Open davidstart09 opened 1 year ago

davidstart09 commented 1 year ago

I have probably missed something but the problem i have is with a diff drive robot using ros2 control under ros2 foxy. rviz shows wheels rotating correctly but when going forward both motors rotate in the same direction which means one wheel is going in the wrong direction due to motors bing mirrored.

davidstart09 commented 1 year ago

Also when trying to rotate robot the motors don't really move

borongyuan commented 1 year ago

Hi, if you set up transformations according to the convention, the reference frames of wheels should all be parallel. This means that all wheel joints should rotate in the same direction as the robot moves forward. tf_full_tree Of course, if you use a symmetrical motor layout, the motors on both sides should rotate in opposite directions. However, the ros2_control framework hopes that upper-level developers can look at problems from the perspective of joints, without considering the specific implementation of actuators. There was a PR (#23) that added the rotation direction configuration, but I don't quite agree with this approach. The mapping between actuator and joint space should be handled by transmission interface.

avibrown commented 1 year ago

Hi, if you set up transformations according to the convention, the reference frames of wheels should all be parallel. This means that all wheel joints should rotate in the same direction as the robot moves forward. tf_full_tree Of course, if you use a symmetrical motor layout, the motors on both sides should rotate in opposite directions. However, the ros2_control framework hopes that upper-level developers can look at problems from the perspective of joints, without considering the specific implementation of actuators. There was a PR (#23) that added the rotation direction configuration, but I don't quite agree with this approach. The mapping between actuator and joint space should be handled by transmission interface.

Hi,

Could you please offer a clear guide as to how to use transmissions? For someone new to this stuff it is pretty hard to grasp at first. I personally have been stuck on this issue for hours trying to get the wheel directions to match those of my physical robot (they are reversed as in the case of OP).

If you can show a simple setup for a differential drive robot it would be super helpful. Thank you!

borongyuan commented 1 year ago

Sorry for the late reply. The ros2_control_demos packages are restructed and have quite a few updates. A demo for transmission interface was added in https://github.com/ros-controls/ros2_control_demos/pull/226. I'll check compatibility and update demos later.

MichaelT800 commented 10 months ago

I have the same problem, when I change right_wheel_radius_multiplier to -1 in the file diff_drive_controller.yaml then the motor can rotate in reverse and -0.1 will respond correctly to the speed control according to the 1:10 reduction ratio. Hope this helps!