Robot joints doesn't move in gazebo

asked 2022-11-24 18:44:24 -0500

rishii gravatar image

Hi I am using Ubuntu 20.04.5 LTS ROS version is Noetic. I have created a .urdf.xacro file for my robot it has 6 joints and 3 legs. i have followed most of the tutorials to reach to this point where my robot is spawned in the gazebo but when ever i publish a message to move the joint it doesn't move. Please help please find the following code snippets.

code for single leg is as follows

        <!-- leg 1-->  
    <link name="leg1_1">
        <visual>
            <origin xyz="0.15 0 0"/>
            <geometry>
                <box size="0.3 0.08 0.05"/>
            </geometry> 
            <material name="orange"/>
        </visual>

        <collision>
            <origin xyz="0.15 0 0"/>
            <geometry>
                <box size="0.3 0.08 0.05"/>
            </geometry> 
        </collision>

        <xacro:inertial_box mass="0.3" x="0.3" y="0.08" z="0.05">
        <origin xyz="0.15 0 0" rpy="0 0 0"/>
        </xacro:inertial_box>
    </link>

    <gazebo reference="leg1_1">
        <material>Gazebo/Orange</material>
    </gazebo>

    <joint name="leg1_joint" type="revolute">
        <parent link="leg1_1"/>
        <child link="leg1_2"/>
        <origin xyz="0.3 0 0"/>
        <limit lower="-1.57" upper="1.57" effort="100" velocity="3"/>
        <axis xyz="0 0 1"/>
    </joint>


    <link name="leg1_2">
        <visual>
            <origin xyz="0.25 0 0"/>
            <geometry>
                <box size="0.5 0.08 0.05"/>
            </geometry> 
            <material name="yellow"/>
        </visual>

        <collision>
            <origin xyz="0.25 0 0"/>
            <geometry>
                <box size="0.5 0.08 0.05"/>
            </geometry> 
        </collision>
        <xacro:inertial_box mass="0.5" x="0.5" y="0.08" z="0.05">
        <origin xyz="0.25 0 0" rpy="0 0 0"/>
        </xacro:inertial_box>
    </link>

    <gazebo reference="leg1_2">
        <material>Gazebo/Yellow</material>
    </gazebo>

Transmission code for one joint is as follows

        <!-- transmission 6-->
    <transmission name="leg3_joint_trans">
        <type> transmission_interface/SimpleTransmission</type>
        <joint name="leg3_joint">
            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
        </joint>
        <actuator name="leg3_joint_motor">
            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
            <mechanicalReduction>1</mechanicalReduction>
        </actuator>
    </transmission>

    <!-- adding controler from gazebo-->

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

my launch file as follows

        <?xml version="1.0" encoding="UTF-8"?>
    <launch>

      <arg name="model" default="$(find three_leg_robot)/models/robot_6_joint/robot_6_joint.urdf.xacro"/>
      <param name="robot_description" command="$(find xacro)/xacro --inorder $(arg model)" />

      <rosparam file="$(find three_leg_robot)/models/robot_6_joint/motors_config.yaml"/>


      <include file="$(find gazebo_ros)/launch/empty_world.launch"> 
        <arg name="use_sim_time" value="true"/>
        <arg name="gui" value="true"/>
        <arg name="debug" value="false"/>
            <!--<arg name="world_name" value="$(arg world_file)"/>-->
      </include>

      <node name="mybot_spawn" pkg="gazebo_ros" type="spawn_model" output="screen" args="-urdf -param robot_description -model my_bot -x 0 -y 0 -z 0"/>

      <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="joint_state_controller" ns="/robot_6_joint"/>

      <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher ...
(more)
edit retag flag offensive close merge delete