0
$\begingroup$

I published a topic just to let the bot rotate through Z-axis with

rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{linear: {x: 0, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0.5}}'

but it just moves along the X-axis. I cannot figure out where the problem lies

Screenshot

and here is my Solidworks model

Solidworks model

Here are my code added behind the URDF I exported through Solidworks

<robot
  name="rob">
  <link
    name="base_link">
    <inertial>
      <origin
        xyz="0.0181955450675129 0.00264778974166714 0.0354981750694477"
        rpy="0 0 0" />
      <mass
        value="5.02769335902724" />
      <inertia
        ixx="0.00458593296077325"
        ixy="-0.000344900493267936"
        ixz="3.49549548447417E-05"
        iyy="0.0113520369436714"
        iyz="9.70530058607076E-06"
        izz="0.0136460990408087" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://rob/meshes/base_link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="1 0.949019607843137 0.909803921568627 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://rob/meshes/base_link.STL" />
      </geometry>
    </collision>
  </link>
  <link
    name="w1_Link">
    <inertial>
      <origin
        xyz="-0.000435869461384089 0.00865087864124144 -2.77555756156289E-16"
        rpy="0 0 0" />
      <mass
        value="0.01626314885479" />
      <inertia
        ixx="3.1605064215026E-06"
        ixy="-1.26696862977015E-07"
        ixz="-6.91163857134756E-21"
        iyy="5.66872709157297E-06"
        iyz="3.01541699439101E-21"
        izz="3.15412287415282E-06" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://rob/meshes/w1_Link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.792156862745098 0.819607843137255 0.933333333333333 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://rob/meshes/w1_Link.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="w1"
    type="continuous">
    <origin
      xyz="-0.0614795629725991 -0.0715080024226812 0.0100000000000001"
      rpy="0 0 0" />
    <parent
      link="base_link" />
    <child
      link="w1_Link" />
    <axis
      xyz="-0.0503205840456661 0.998733116914275 0" />
  </joint>
  <link
    name="w2_Link">
    <inertial>
      <origin
        xyz="-0.000435869461383964 0.00865087864124141 1.11022302462516E-16"
        rpy="0 0 0" />
      <mass
        value="0.0162631488547895" />
      <inertia
        ixx="3.16050642150262E-06"
        ixy="-1.26696862977009E-07"
        ixz="1.53229762940778E-20"
        iyy="5.66872709157279E-06"
        iyz="1.9400821980721E-21"
        izz="3.15412287415261E-06" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://rob/meshes/w2_Link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.792156862745098 0.819607843137255 0.933333333333333 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://rob/meshes/w2_Link.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="w2"
    type="continuous">
    <origin
      xyz="0.0683557422262566 -0.0649663264967437 0.0100000000000001"
      rpy="0 0 0" />
    <parent
      link="base_link" />
    <child
      link="w2_Link" />
    <axis
      xyz="-0.0503205840456793 0.998733116914274 0" />
  </joint>
  <link
    name="w3_Link">
    <inertial>
      <origin
        xyz="2.22044604925031E-16 -0.00866187043298536 3.33066907387547E-16"
        rpy="0 0 0" />
      <mass
        value="0.0162631488547891" />
      <inertia
        ixx="3.1541228741526E-06"
        ixy="9.13207396258543E-22"
        ixz="-2.73967994144141E-20"
        iyy="5.67511063892259E-06"
        iyz="5.27385059995947E-22"
        izz="3.15412287415258E-06" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://rob/meshes/w3_Link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.792156862745098 0.819607843137255 0.933333333333333 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://rob/meshes/w3_Link.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="w3"
    type="continuous">
    <origin
      xyz="0.0615228810515716 0.0706482508746517 0.0100000000000001"
      rpy="0 0 0.0503418449190096" />
    <parent
      link="base_link" />
    <child
      link="w3_Link" />
    <axis
      xyz="0 -1 0" />
  </joint>
  <link
    name="w4_Link">
    <inertial>
      <origin
        xyz="-3.05311331771918E-16 -0.00866187043298537 -1.11022302462516E-16"
        rpy="0 0 0" />
      <mass
        value="0.0162631488547895" />
      <inertia
        ixx="3.15412287415265E-06"
        ixy="3.16313866240278E-21"
        ixz="-4.07258367438855E-20"
        iyy="5.67511063892274E-06"
        iyz="-4.3276135007511E-22"
        izz="3.15412287415267E-06" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://rob/meshes/w4_Link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.792156862745098 0.819607843137255 0.933333333333333 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://rob/meshes/w4_Link.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="w4"
    type="continuous">
    <origin
      xyz="-0.0683124241472841 0.0641065749487143 0.0100000000000001"
      rpy="0 0 0.0503418449190096" />
    <parent
      link="base_link" />
    <child
      link="w4_Link" />
    <axis
      xyz="0 -1 0" />
  </joint>
        <link name="base_footprint">
                <visual>
                    <origin xyz="0 0 0" rpy="0 0 0" />
                    <geometry>
                        <box size="0.001 0.001 0.001" />
                    </geometry>
                </visual>
            </link>
    
            <joint name="base_footprint_joint" type="fixed">
                <origin xyz="0 0 0.00053122" rpy="0 0 0" />        
                <parent link="base_footprint"/>
                <child link="base_link" />
            </joint>
    
    <transmission name="w1_trans">
      <type>transmission_interface/SimpleTransmission</type>
      <joint name="w1">
        <hardwareInterface>EffortJointInterface</hardwareInterface>
      </joint>
      <actuator name="w1_motor">
        <mechanicalReduction>50</mechanicalReduction>
        <hardwareInterface>EffortJointInterface</hardwareInterface>
      </actuator>
    </transmission>
    <transmission name="w2_trans">
      <type>transmission_interface/SimpleTransmission</type>
      <joint name="w2">
        <hardwareInterface>EffortJointInterface</hardwareInterface>
      </joint>
      <actuator name="w2_motor">
        <mechanicalReduction>50</mechanicalReduction>
        <hardwareInterface>EffortJointInterface</hardwareInterface>
      </actuator>
    </transmission>
    <transmission name="w3_trans">
      <type>transmission_interface/SimpleTransmission</type>
      <joint name="w3">
        <hardwareInterface>EffortJointInterface</hardwareInterface>
      </joint>
      <actuator name="w3_motor">
        <mechanicalReduction>50</mechanicalReduction>
        <hardwareInterface>EffortJointInterface</hardwareInterface>
      </actuator>
    </transmission>
    <transmission name="w4_trans">
      <type>transmission_interface/SimpleTransmission</type>
      <joint name="w4">
        <hardwareInterface>EffortJointInterface</hardwareInterface>
      </joint>
      <actuator name="w4_motor">
        <mechanicalReduction>50</mechanicalReduction>
        <hardwareInterface>EffortJointInterface</hardwareInterface>
      </actuator>
    </transmission>
    
    <gazebo>
      <plugin name="skid_steer_drive_controller" filename="libgazebo_ros_skid_steer_drive.so">
        <updateRate>100.0</updateRate>
        <robotNamespace>/</robotNamespace>
        <leftFrontJoint>w3</leftFrontJoint>
        <rightFrontJoint>w2</rightFrontJoint>
        <leftRearJoint>w4</leftRearJoint>
        <rightRearJoint>w1</rightRearJoint>
        <wheelSeparation>0.13579</wheelSeparation>
        <wheelDiameter>0.0571</wheelDiameter>
        <robotBaseFrame>base_link</robotBaseFrame>
        <torque>20</torque>
        <topicName>cmd_vel</topicName>
        <broadcastTF>false</broadcastTF>
      </plugin>
    </gazebo>
$\endgroup$
7
  • 1
    $\begingroup$ The urdf you included in the post does not look complete. It is completely missing the lines where the links are defined. Please edit the post to include the complete urdf as your issues could be linked to that. $\endgroup$
    – Luca
    Feb 26 at 13:57
  • $\begingroup$ Thank you for your valuable advice!I will edit the question. My ability of expression is not so good,and I will learn to do better. $\endgroup$
    – yz x
    Feb 27 at 1:57
  • $\begingroup$ I think base_link frame is is oriented as expected.I have added code of URDF in the question you recommend.Thank you for your guidance! $\endgroup$
    – yz x
    Feb 27 at 2:21
  • $\begingroup$ I agree with you that the urdf looks good. Next suspect: the controller. How did you defined the controller and which parameters did you set? The image you posted looks like the robot is actually "trying" to steer to the left (positive rotation around the Z axis), though this movement is coupled with a forward movement. In the end, if you have rear drive wheels and front steering wheels, this is the expected behavior when the front wheels cannot turn by 90 degrees. $\endgroup$
    – Luca
    Feb 27 at 8:09
  • $\begingroup$ I uesd the skid_steer_drive_controller plugin,this plugin only needs the 4 wheels' link names. I have checked these parameters and ensure they are correct. $\endgroup$
    – yz x
    Feb 27 at 9:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.