Ok now i got it. By using single hardware interface multiple actuators can be controlled with the help of different ros controllrs. Eg. right now i have two controllers on diff drive controller which controls the base of robot and another joint position controller which controls the head rotation of robot.
Here is my example configuration file for the controller and hardware interface both. I'm using ros control boilerplate package for faster development.
# ros_control_boilerplate Settings -----------------------
# Settings for ros_control control loop
generic_hw_control_loop:
loop_hz: 300
cycle_time_error_threshold: 0.01
# Settings for ros_control hardware interface
hardware_interface:
joints:
- wheel_left_joint
- wheel_right_joint
- camera_joint
sim_control_mode: 1 # 0: position, 1: velocity
# Publish all joint states ----------------------------------
# Creates the /joint_states topic necessary in ROS
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50
# Position Controllers ---------------------------------------
turtlebot3_waffle_head_controller:
type: effort_controllers/JointPositionController
joint: camera_joint
pid: {p: 100.0, i: 0.01, d: 10.0}
base_controller:
type : "diff_drive_controller/DiffDriveController"
left_wheel : 'wheel_left_joint'
right_wheel : 'wheel_right_joint'
publish_rate: 50.0 # default: 50
enable_odom_tf: True
pose_covariance_diagonal : [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
twist_covariance_diagonal: [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
# Wheel separation and diameter. These are both optional.
# diff_drive_controller will attempt to read either one or both from the
# URDF if not specified as a parameter
wheel_separation : 0.35
wheel_radius : 0.085
# Wheel separation and radius multipliers
wheel_separation_multiplier: 1.0 # default: 1.0
wheel_radius_multiplier : 1.0 # default: 1.0
# Velocity commands timeout [s], default 0.5
cmd_vel_timeout: 0.25
# Base frame_id
base_frame_id: base_footprint #default: base_link
# Velocity and acceleration limits
# Whenever a min_* is unspecified, default to -max_*
linear:
x:
has_velocity_limits : true
max_velocity : 0.5 # m/s
min_velocity : -0.5 # m/s
has_acceleration_limits: false
max_acceleration : 0.2 # m/s^2
min_acceleration : -0.2 # m/s^2
has_jerk_limits : false
max_jerk : 0.01 # m/s^3
angular:
z:
has_velocity_limits : true
max_velocity : 1.75 # rad/s
has_acceleration_limits: false
max_acceleration : 0.5 # rad/s^2
has_jerk_limits : false
max_jerk : 0.01 # rad/s^3
Beauty of this design as if found is that modbus, ethercat based multiple motor drivers can be intefaced from single ros node called hardware interface.