Gimbal not working in X4 robot

asked 2019-01-04 03:37:28 -0500

I tried to add gimbal mechanism in X4 robot by modifying some x4 robot xacro but i'm always getting msg" Controller Spawner couldn't find the expected controller_manager ROS interface."

In x4_with_sensors.xacro file i added transmission element and gazebo_ros_control plugin as:

  <xacro:if value="$(optenv X4_SENSOR_CONFIG_4 0)">
    <xacro:camera_macro
      namespace="${namespace}"
      parent_link="${namespace}/base_link"
      camera_suffix="front"
      frame_rate="20"
      horizontal_fov="2"
      image_width="1280"
      image_height="960"
  image_format="R8G8B8"
  min_distance="0.02"
  max_distance="100"
  noise_mean="0.0"
  noise_stddev="0.007"
  enable_visual="true">
  <box size="0.02 0.05 0.05" />
  <origin xyz="0.1 0 0" rpy="0 0 0" />
</xacro:camera_macro>

<planar_lidar 
  name="${namespace}/laser"
  topic="${namespace}/scan"
  mesh="package://subt_sensors/meshes/sick-lms1xx.dae"
  min_angle="-2.3562"
  max_angle="2.3562"
  min_range="0.5"
  max_range="20"
  update_rate="20"
/>

<joint name="front_laser_mount_joint" type="continuous">
  <origin xyz="0 0 -0.05" rpy="0 0 0" />
  <parent link="${namespace}/base_link" />
  <child link="${namespace}/laser" />
  <dynamics damping="0.7"/>
</joint>
  </xacro:if>

  <transmission name="tran1">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="front_laser_mount_joint">
      <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor1">
      <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>

  <gazebo>
    <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
      <robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
    </plugin>
  </gazebo>

than i loaded configuration for this joint from a file like: x4_with_sensors:

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

  # Position Controllers ---------------------------------------
  joint1_position_controller:
    type: effort_controllers/JointPositionController
    joint: front_laser_mount_joint
    pid: {p: 100.0, i: 0.01, d: 10.0}

than i loaded it from a launch file with lines:

  <rosparam file="$(find subt_seed)/config/gimbal.yaml" command="load"/>
 <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
    output="screen" args="joint_state_controller
                      joint1_position_controller"/>
edit retag flag offensive close merge delete