Controller for robots

asked 2018-07-27 09:36:37 -0500

vonunwerth gravatar image

Hi, i found two ways to setup a controller to drive around with my mobile platform robot and am a bit confused. First I found the way to create a new xacro file and will it with a gazebo-tag and options for the controller:

<gazebo>
  <plugin name="skid_steer_drive_controller" filename="libgazebo_ros_skid_steer_drive.so">
    <updateRate>100.0</updateRate>
    <robotNamespace>/</robotNamespace>
    <leftFrontJoint>joint_base_wheel_front_left</leftFrontJoint>
    <rightFrontJoint>joint_base_wheel_front_right</rightFrontJoint>
    <leftRearJoint>joint_base_wheel_rear_left</leftRearJoint>
    <rightRearJoint>joint_base_wheel_rear_right</rightRearJoint>
    <wheelSeparation>${2*0.77}</wheelSeparation>
    <wheelDiameter>${2*wheel_radius}</wheelDiameter>
    <robotBaseFrame>heros_base_link</robotBaseFrame>
    <torque>130</torque>
    <commandTopic>cmd_vel</commandTopic>
    <odometryTopic>odom</odometryTopic>
    <odometryFrame>odom</odometryFrame>
    <broadcastTF>1</broadcastTF>
  </plugin>
</gazebo>

Whats this file libgazebo_ros_skid_steer_drive.so?

The second way is to load a controller in my gazebo launch file like that:

<rosparam command="load" file="$(find robot_description)/urdf/ROS/control.yaml" />
  <node name="controller_spawner" pkg="controller_manager" type="spawner" 
args="robot_joint_publisher robot_velocity_controller"/>

Then I had this .yaml file for all the settings:

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

robot_velocity_controller:
  type: "diff_drive_controller/DiffDriveController"
  left_wheel: ['joint_base_wheel_front_left', 'joint_base_wheel_rear_left']
  right_wheel: ['joint_base_wheel_front_right', 'joint_base_wheel_front_right']
  publish_rate: 100
  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

  # Base frame_id
  base_frame_id: robot_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: 0.580
  wheel_radius_multiplier    : 0.32

  # Velocity and acceleration limits
  linear:
    x:
      has_velocity_limits    : true
      max_velocity           : 0.9   # 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

In option 1 I added the topic to publish the odometry and so on. In the second way i didnt. Where does ROS know how to publish those things?

To use all of this I have to add a transmission tag to my wheels like that. Is that right?

 <transmission name="trans_wheel_${front_rear}_${left_right}">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="joint_base_wheel_${front_rear}_${left_right}">
      <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
      <!--<hardwareInterface>VelocityJointInterface</hardwareInterface>-->
    </joint>
    <actuator name="motor_wheel_${front_rear}_${left_right}">
      <mechanicalReduction>100</mechanicalReduction>
    </actuator>
  </transmission>

Are this two described ways the same thing or does it make any difference to do it like one of this ways? Are these ways common to setup the control setting for a robot or did i do incorrect things?

Thanks for your help Max

edit retag flag offensive close merge delete

Comments

1

Not a complete answer, but: your "first way" is using the skid_steer_drive_controller plugin provided by Gazebo, while the "second way" is using the DiffDriveController plugin from ros_control (hosted by gazebo_ros_control in Gazebo).

Those are definitely not the same.

gvdhoorn gravatar image gvdhoorn  ( 2018-07-27 10:28:08 -0500 )edit