Skip to content

Two Controllers in one yaml with different update rate #517

@ghost

Description

I'm working with mobile manipulator platform. The base is controlled with slower rate (i.e. 50Hz) and the manipulator runs at a higher rate (i.e. 500Hz). I need to control them separately but I'm not able to combine them in one yaml. This is my file

husky_joint_publisher:
  type: "joint_state_controller/JointStateController"
  publish_rate: 50

husky_velocity_controller:
  type: "diff_drive_controller/DiffDriveController"
  left_wheel: ['front_left_wheel', 'rear_left_wheel']
  right_wheel: ['front_right_wheel', 'rear_right_wheel']
  publish_rate: 50
  pose_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.03]
  twist_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.03]
  cmd_vel_timeout: 0.25
  velocity_rolling_window_size: 2

  # Base frame_id
  base_frame_id: base_link

  # Odometry fused with IMU is published by robot_localization, so
  # no need to publish a TF based on encoders alone.
  enable_odom_tf: false

  # Wheel separation and radius multipliers
  wheel_separation_multiplier: 1.875 # default: 1.0
  wheel_radius_multiplier    : 1.0 # default: 1.0

  # Velocity and acceleration limits
  # Whenever a min_* is unspecified, default to -max_*
  linear:
    x:
      has_velocity_limits    : true
      max_velocity           : 1.0   # m/s
      has_acceleration_limits: true
      max_acceleration       : 3.0   # m/s^2
  angular:
    z:
      has_velocity_limits    : true
      max_velocity           : 2.0   # rad/s
      has_acceleration_limits: true
      max_acceleration       : 6.0   # rad/s^2


ur5:
  # Publish all joint states -----------------------------------
  joint_state_controller:
    type: joint_state_controller/JointStateController
    publish_rate: 500 
  
  # Velocity Controllers ----------------------------
  joints_group_velocity_controller:
    type: velocity_controllers/JointGroupVelocityController
    joints:
       - shoulder_pan_joint
       - shoulder_lift_joint
       - elbow_joint
       - wrist_1_joint
       - wrist_2_joint
       - wrist_3_joint

The launch file I have so far covers the base (i.e. the top controller in the yaml file).

  <!-- Spawn controllers -->
  <node name="base_controller_spawner" pkg="controller_manager" type="spawner"
        args="husky_joint_publisher husky_velocity_controller"/>
  <rosparam param="wheel_radius_multiplier" ns="husky_velocity_controller" subst_value="True">
        $(optenv HUSKY_WHEEL_MULTIPLIER 1.0)
  </rosparam>

How can I modify my launch file to include the second controller with its namespace (i.e. ur5 in the yaml file) so it runs at 500Hz?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions