Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

It looks live you've made the URDF for this okay, but you'll need to start a few more components to be able to drive this with the /cmd_vel topic. At the moment you've just spawned a robot with controllable joints but without anything controlling them.

You'll need to create a yaml file which contains the configuration of the differential driver controller itself, and optionally a joint_state_controller so that ROS can know the angle of the wheel joints.

The launch file that starts the simulation will need to load the configuration from this yaml file and start the ros_control controllers.

The YAML file should look something like this:

# Publish all joint states -----------------------------------
joint_state_controller:
  type: joint_state_controller/JointStateController
  publish_rate: 50  

# Differential Drive Controller
diff_drive_controller:
  type: "diff_drive_controller/DiffDriveController"
  left_wheel: ['left_wheel_hinge']
  right_wheel: ['right_wheel_hinge'']

  wheel_separation: 0.66
  wheel_radius: 0.1

  cmd_vel_timeout: 0.25
  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]

You'll need to add the following lines to your launch file to start the controllers:

  <!-- Load joint controller configurations from YAML file to parameter server -->
  <rosparam file="$(find rorover_skid_steer)/config/rorover_control.yaml" command="load"/>

  <!-- load the controllers -->
  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
    output="screen" args="joint1_position_controller diff_drive_controller joint_state_controller"/>

You will have to change the joint names to match your robot, but this should get this working for you.