Four Wheeled Robot doesn't turn but keep going straigth with a PID Controller

asked 2021-03-03 12:27:18 -0500

dries gravatar image

Hi everyone, I'm new with Gazebo and ROS. I'm trying to control a 4 wheeled robot using a PI controller, with Velocity Controller. During the simulation, if I set the same velocity for all wheels the robot moves in the right way (forward or backward). Instead, if I try a steering maneuver (a skid steering maneuver, increasing/decerasing left or right velocity) the robot doesn't turn and keep going straight, even tough the velocity that I read on /my_robot/joint_states are ok, as in the next picture (trying to turn right) image description

I've tried to control the robot with planar move plugin and it works fine. Instead, using the skid steeering plugin I always have the same problem.

I'm not sure if the problem is the controller implementation, but I have the feeling that the problem is due to some physical parameters. I've tried to increase or decrease mu1 and mu2 and to increase the mass of the wheels but nothing has changed. Any suggestions?

This is all my code. The urdf are taken from here. Thank you all!


Control config

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

  # Position Controllers ---------------------------------------
  joint_fl_effort_controller:
    type: velocity_controllers/JointVelocityController
    joint: summit_front_left_wheel_joint
    pid: {p: 1.0, i: 0.01, d: 0}
  joint_fr_effort_controller:
    type: velocity_controllers/JointVelocityController
    joint: summit_front_right_wheel_joint
    pid: {p: 1.0, i: 0.01, d: 0}
  joint_rl_effort_controller:
    type: velocity_controllers/JointVelocityController
    joint: summit_back_left_wheel_joint
    pid: {p: 1.0, i: 0.01, d: 0}
  joint_rr_effort_controller:
    type: velocity_controllers/JointVelocityController
    joint: summit_back_right_wheel_joint
    pid: {p: 1.0, i: 0.01, d: 0}

Control launch

<launch>

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

  <!-- load the controllers -->
  <node name="controller_spawner"
    pkg="controller_manager"
    type="spawner" respawn="false"
    output="screen" ns="/summit"
    args="joint_state_controller
    joint_fl_effort_controller
    joint_fr_effort_controller
    joint_rl_effort_controller
    joint_rr_effort_controller"
  />

  <!-- convert joint states to TF transforms for rviz, etc -->
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"
    respawn="false" output="screen">
    <remap from="/joint_states" to="/summit/joint_states" />
  </node>


</launch>

Robot

<robot name="summit_xl" xmlns:xacro="http://www.ros.org/wiki/xacro">

    <!-- Import summit XL wheels -->
    <xacro:include filename="$(find summit_description)/urdf/wheels/omni_wheel.urdf.xacro" />
    <xacro:include filename="$(find summit_description)/urdf/base/summit_base.urdf.xacro" />

    <!-- Wheel parameters -->
    <xacro:property name="wheel_offset_x" value="0.2225" />    <!-- x,y,z in translation from base_link to the center of the wheel -->
    <xacro:property name="wheel_offset_y" value="0.2045" />
    <xacro:property name="wheel_offset_z" value="0.0" />

    <xacro:macro name="robot">
        <xacro:summit_base/>

        <xacro:omni_wheel prefix="summit_front_left" parent="summit_base_link" reflect="true">
            <origin xyz="${wheel_offset_x} ${wheel_offset_y} ${wheel_offset_z}" rpy="0 0 0"/>
        </xacro:omni_wheel>

        <xacro:omni_wheel prefix="summit_front_right" parent="summit_base_link" reflect="false">
            <origin xyz="${wheel_offset_x} -${wheel_offset_y} ${wheel_offset_z}" rpy="0 0 0"/>
        </xacro:omni_wheel>

        <xacro:omni_wheel prefix="summit_back_left" parent="summit_base_link" reflect="true">
            <origin xyz="-${wheel_offset_x} ${wheel_offset_y} ${wheel_offset_z}" rpy="0 0 0"/>
        </xacro:omni_wheel>

        <xacro:omni_wheel prefix="summit_back_right" parent="summit_base_link" reflect="false">
            <origin xyz="-${wheel_offset_x} -${wheel_offset_y} ${wheel_offset_z}" rpy="0 0 0"/>
        </xacro:omni_wheel>
   </xacro:macro>

   <xacro:robot/>

    <gazebo>
        <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
                <robotNamespace>/summit</robotNamespace>
        </plugin ...
(more)
edit retag flag offensive close merge delete