gazebo velocity controller

asked 2018-07-31 04:49:15 -0500

623921767@qq.com gravatar image

updated 2018-07-31 20:22:41 -0500

jayess gravatar image

I tried to simulate my car model in the gazebo, I built the front and rear wheel of the car, I tried to use the velocity controller in the ros_control to control my car front wheel and rear wheels respectively. had been loaded out of Wheel1_velocity_controller and Wheel2_velocity_controller:

Test "rostopic pub-1/rrbot/wheel1_velocity_controller/command std_msgs/float64 data:1.5" "Rostopic pub-1/rrbot/wheel1_velocity_controller/command std_msgs/float64 data:1.0"

The car can be movement, theoretically should be driven in a straight line, and the result of the simulation is turning movement, why?

Supplementary questions: when i run

rostopic pub-1/rrbot/wheel1_velocity_controller/command std_msgs/float64  data:1.0
rostopic pub-1/rrbot/wheel1_velocity_controller/command std_msgs/float64  data:1.0

The car is going to swerve, isn't it supposed to be a straight motion?

this is my urdf file:

<?xml version="1.0"?>
<robot name="rrbot" xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:property name="length_wheel" value="0.05" />
<xacro:property name="radius_wheel" value="0.05" />
<xacro:property name="camera_link" value="0.05" /> 
<xacro:macro name="default_inertial" params="mass">
  <inertial>
    <mass value="${mass}" />
    <inertia ixx="1.0" ixy="0.0" ixz="0.0"
      iyy="1.0" iyz="0.0"
      izz="1.0" />
    </inertial>
  </xacro:macro>

  <xacro:include filename="$(find rrbot_description)/urdf/mytest.gazebo" />
  <xacro:include filename="$(find rrbot_description)/urdf/materials.xacro" />

  <link name="base_link">
    <visual>
      <geometry>
        <box size="0.2 .3 .1"/>
      </geometry>
      <origin rpy="0 0 1.54" xyz="0 0 0.05"/>
      <material name="orange">
        <color rgba="1 1 1 1"/>
      </material>
    </visual>
    <collision>
      <geometry>
        <box size="0.2 .3 0.1"/>
      </geometry>
    </collision>
    <xacro:default_inertial mass="10"/>
  </link>

  <link name="wheel_1">
    <visual>
      <geometry>
        <cylinder length="${length_wheel}" radius="${radius_wheel}"/>
      </geometry>
      <!-- <origin rpy="0 1.5 0" xyz="0.1 0.1 0"/> -->
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <material name="black">
        <color rgba="0 0 0 1"/>
      </material>
    </visual>
    <collision>
      <geometry>
        <cylinder length="${length_wheel}" radius="${radius_wheel}"/>
      </geometry>
    </collision>
    <xacro:default_inertial mass="1"/>
  </link>

  <link name="wheel_2">
    <visual>
      <geometry>
        <cylinder length="${length_wheel}" radius="${radius_wheel}"/>
      </geometry>
      <!-- <origin rpy="0 1.5 0" xyz="-0.1 0.1 0"/> -->
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <material name="black"/>
    </visual>
    <collision>
      <geometry>
        <cylinder length="${length_wheel}" radius="${radius_wheel}"/>
      </geometry>
    </collision>
    <xacro:default_inertial mass="1"/>
  </link>

  <joint name="wheel1_joint" type="continuous">
    <parent link="base_link"/>
    <child link="wheel_1"/>
    <origin rpy="-1.5707 0 0" xyz="0.1 0 0"/>
    <axis xyz="0 0 1" />
  </joint>

  <joint name="wheel2_joint" type="continuous">
    <axis xyz="0 0 1" />
    <anchor xyz="0 0 0" />
    <limit effort="100" velocity="100" />
    <parent link="base_link"/>
    <child link="wheel_2"/>
    <origin rpy="-1.5707 0 0" xyz="-0.1 0 0"/>
  </joint>

  <joint name="camera_joint" type="fixed">
    <axis xyz="0 1 0" />
    <origin xyz="0.125 0 0.125" rpy="0 0 0"/>
    <parent link="base_link"/>
    <child link="camera_link"/>
  </joint>

  <link name="camera_link">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <box size="0.05 0.05 0.05"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 ...
(more)
edit retag flag offensive close merge delete

Comments

1

can you post the URDF for your car? What version of Gazebo are you using? At first look, it seems like you would need to set both wheel velocities.

KothariA gravatar image KothariA  ( 2018-07-31 13:55:47 -0500 )edit

gazebo 2.2.6 My car model diagram and URDF as shown in the question

623921767@qq.com gravatar image 623921767@qq.com  ( 2018-07-31 19:40:24 -0500 )edit

Can you please update your question with the exact commands that you're using (those will not work as is)? Also, there's no URDF file.

jayess gravatar image jayess  ( 2018-07-31 19:53:35 -0500 )edit

Supplementary questions: when i run "rostopic pub-1/rrbot/wheel1_velocity_controller/command std_msgs/float64 data:1.5" "rostopic pub-1/rrbot/wheel1_velocity_controller/command std_msgs/float64 data:1.0" The car is going to swerve, isn't it supposed to be a straight motion?

623921767@qq.com gravatar image 623921767@qq.com  ( 2018-07-31 20:11:45 -0500 )edit