dynamixel_hardware icon indicating copy to clipboard operation
dynamixel_hardware copied to clipboard

Using both position and velocity controller

Open BCaran opened this issue 1 year ago • 2 comments

I have eight motors (Dynamixel XH430-W210-T), 4 for steering and 4 for driving mobile robot. I would like to control steering motor with position controller and driving motor with velocity controller...is this possible? I tried using JointGroupPositionController and JointGroupVelocityController and when I send [0, 0, 0, 0] to position controller, steering motors go to 0 position, but then I try to send [0.5, 0.5, 0.5, 0.5] to velocity controller and driving motors start driving a bit and then return to 0...does anyone know why is that..am I missing something? I am using ROS2 Humble with ros2_controll, and my .yaml file is bellow:

controller_manager:
  ros__parameters:
    update_rate: 100  # Hz

    joint_state_broadcaster:
      type: joint_state_broadcaster/JointStateBroadcaster

    velocity_controller:
      type: velocity_controllers/JointGroupVelocityController

    position_controller:
      type: position_controllers/JointGroupPositionController

velocity_controller:
  ros__parameters:
    joints:
      - FL_wheel
      - BL_wheel
      - BR_wheel
      - FR_wheel

position_controller:
  ros__parameters:
    joints:
      - FL_steering
      - BL_steering
      - BR_steering
      - FR_steering

BCaran avatar Feb 28 '24 08:02 BCaran

I have noticed, that when control mode is changed, all the motors change their control mode. Is it possible to define specific control interface for each motor at the same time. For example to have 4 motors that are controlled using position control mode and 4 motors that are controlled using velocity control mode?

BCaran avatar Feb 28 '24 10:02 BCaran

The quick answer is no, this is not supported currently. It is assumed that all of the joints will be using the same controller type. That being said, I don't think there is anything preventing this from being implemented, and would be a good addition if anyone is interested in opening a PR.

ijnek avatar Mar 05 '24 03:03 ijnek