Robotics StackExchange | Archived questions

I am trying to simulate a snake robot, error: "joint_1 is not in gazebo mode". Please tell me how to make link_1 move freely w.r.to. the origin.

I am trying to simulate a snake robot, I created an .urdf, .yaml, and position control files. In URDF file I have started links from link1 and given a topic command to each joint. But the link1 is not moving at all. I tried to create a dummy link and a dummy joint to move link1 but it is not working. When I created a dummy joint with type='fixed' then it was not giving any error. Since I don't want to fix the link1, I created a floating joint between dummylink and link1. But it was giving an error 'this robot has a joint named "joint1" which is not in the gazebo mode". Can anyone help me with this. I tried for many hours but it is not working. Please tell me how to make link1 move freely w.r.to. the origin.<?xml version="1.0"?>

<xacro:property name="link_length" value = "0.14" />  <!--0.14, 0.05, 0.05 -->
<xacro:property name="link_width" value = "0.05" />
<xacro:property name="link_height" value = "0.05" />
<xacro:property name="link_mass" value = "1" />
<xacro:property name="next_link_with_gap" value = "0.10" />
<xacro:property name="next_link_cg_with_gap" value = "0.17" />

<material name="Grey">
    <color rgba="0.5 0.5 0.5 1.0"/>
</material>
<material name="White">
    <color rgba="1.0 1.0 1.0 1.0"/>
</material>
<material name="blue">
 <color rgba="0.2 0.2 1 1"/>

<xacro:macro name="inertial_box" params="mass x y z *origin">
  <inertial>
      <xacro:insert_block name="origin"/>
      <mass value="${mass}" />
      <inertia 
           ixx = "${(1/12)* mass * (y*y+z*z)}" ixy ="0" ixz ="0"
           iyy = "${(1/12)* mass * (x*x+z*z)}" iyz ="0" 
           izz = "${(1/12)* mass * (x*x+y*y)}" />
      </inertial>

/xacro:macro

<!-- macros for transmission -->
<xacro:macro name="transmission_block" params="joint_name idx">
  <transmission name="tran_${idx}">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="${joint_name}">
      <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor_${idx}">
      <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>

/xacro:macro

<!--Define Gazebo colors-->
<xacro:macro name="gazebo_grey_link_color_block" params="link_name">
<gazebo reference="${link_name}">
<visual>
  <material>
    <ambient>0.5 0.5 0.5 1.0</ambient>
    <diffuse>0.56666695 0.56666695 0.56666695 1.0</diffuse>
    <specular>0.6000003 0.6000003 0.6000003 1.0</specular>
  </material>
</visual>
</gazebo>

/xacro:macro

<!--=============================================================================-->
<link name="link_dummy">  
</link>
<gazebo reference="link_dummy">
  <turnGravityOff>false</turnGravityOff>
</gazebo>
<joint name="link_dummy_joint" type="fixed">
  <parent link="link_dummy"/>
  <child link="link_1" />
</joint>

<link name="link_1">
  <visual>
    <origin xyz="${link_length/2} 0 ${link_height/2}" rpy="0 0 0" />
    <geometry>
       <box size="${link_length} ${link_width} ${link_height}"/>
    </geometry>
    <material name="blue"/>
  </visual>
  <collision>
     <origin xyz="${link_length/2} 0 ${link_height/2}" rpy="0 0 0"/>
     <geometry>
       <box size="${link_length} ${link_width} ${link_height}"/>
    </geometry>
  </collision>
  <xacro:inertial_box mass="${link_mass}" x="${link_length}" y="${link_width}" z="${link_height}">
        <origin xyz="${link_length/2} 0 ${link_height/2}" rpy="0 0 0" />
  </xacro:inertial_box>
</link>

<xacro:gazebo_blue_link_color_block link_name="link_1"/>

<joint name="joint_1" type="revolute">
  <parent link="link_1"/>
  <child link="link_2"/>
  <origin xyz="${link_length} 0.0 ${link_height/2}" rpy= "0 0 0" />
  <axis xyz = "0 0 1"/>
  <limit lower="${-pi/3}" upper ="${pi/3}" velocity = "100" effort= "100"/>      
</joint>

<!--=============================================================================-->
<!--link_1-->

/xacro:inertial_box

<xacro:gazebo_grey_link_color_block link_name="link_2"/>
<!-- <xacro:gazebo_grey_link_color_block link_name="link_1"> -->

<joint name="joint_2" type="revolute">
  <parent link="link_2"/>
  <child link="link_3"/>
  <origin xyz="${next_link_cg_with_gap} 0.0 0.0" rpy= "0 0 0" />
  <axis xyz = "0 0 1"/>
  <limit lower="${-pi/3}" upper ="${pi/3}" velocity = "100" effort= "100"/>      
</joint>

<!-- Transmissions for ros control --> <!-- -->

<!-- ros_control plugin -->
<gazebo>
    <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
    <robotNamespace>/rrr_arm</robotNamespace>
    </plugin>
</gazebo>
<gazebo reference="link_1">
  <mu1 value="1.0"/>
  <mu2 value="1.0"/>
  <kp value="10000000.0" />
  <kd value="1.0" />
  <fdir1 value="1 0 0"/>
</gazebo>
<gazebo reference="link_2">
  <mu1 value="1.0"/>
  <mu2 value="1.0"/>
  <kp value="10000000.0" />
  <kd value="1.0" />
  <fdir1 value="1 0 0"/>
</gazebo>
<gazebo reference="link_3">
  <mu1 value="1.0"/>
  <mu2 value="1.0"/>
  <kp value="10000000.0" />
  <kd value="1.0" />
  <fdir1 value="1 0 0"/>
</gazebo>

`

Asked by Hareesh_Chitikena on 2023-03-14 19:44:17 UTC

Comments

Answers