Gazebo URDF model vanishes
Hello,
I am trying to make a simple URDF model of a manipulator with 4 links and 3 joints (2 spherical and 1 revolute), but as I launch the model in gazebo, it crashes and all the links overlap at the origin. I tried remaking the model many times altering different values to get to the issue and have observed if I add the joint in the z axis, it crashes. I can add the y and x joints and it has no issues. What confuses me more is that I use the same joint parameters I have used in the first spherical joint.
Am I missing something or doing something wrong? Will appreciate any help and guidance. Here is my URDF file
<?xml version="1.0"?>
<robot name="pend_bot"
xmlns:xacro="http://www.ros.org/wiki/xacro">
<!-- <xacro:include filename="$(find robot)/urdf/my_robot.gazebo" /> -->
<!-- <xacro:include filename="$(find robot)/urdf/materials.xacro" /> -->
<!-- <robot name="pendulum_robot"> -->
<link name="world">
</link>
<joint name="base_joint" type="fixed">
<parent link="world"/>
<child link="body_link"/>
<axis xyz="0.0 0.0 0.0"/>
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
</joint>
<!-- First Link -->
<link name="body_link">
<visual>
<origin xyz="0 0 0.75" rpy="0 0 0"/>
<geometry>
<box size="0.1 0.1 1.5"/>
</geometry>
</visual>
<!-- <collision>
<origin xyz="0 0 0.75" rpy="0 0 0"/>
<geometry>
<box size="0.1 0.1 1.0"/>
</geometry>
</collision> -->
<inertial>
<origin xyz="0 0 0.75" rpy="0 0 0"/>
<mass value="1"/>
<inertia ixx="0.18833" ixy="0.0" ixz="0.0" iyy="0.18833" iyz="0.0" izz="0.001666667"/>
</inertial>
</link>
<!-- Shoulder Joint -->
<joint name="shoulder_y" type="continuous">
<parent link="body_link"/>
<child link="dummy_link_1"/>
<axis xyz="0 1 0" />
<origin xyz="0.0 0 1.55" rpy="0 0 0"/>
<!-- <limit effort="50" velocity="2.0"/> -->
<dynamics damping="0.2"/>
</joint>
<link name="dummy_link_1">
<inertial>
<mass value="0.025" />
<inertia ixx="5.8083e-4" ixy="0" ixz="0" iyy="3.0833e-5" iyz="0" izz="5.9083e-4" />
</inertial>
</link>
<joint name="shoulder_z" type="continuous">
<parent link="dummy_link_1"/>
<child link="dummy_link_2"/>
<axis xyz="0 0 1" />
<dynamics damping="0.2"/>
<!-- <limit effort="50" velocity="2.0"/> -->
</joint>
<link name="dummy_link_2">
<inertial>
<mass value="0.025" />
<inertia ixx="5.8083e-4" ixy="0" ixz="0" iyy="3.0833e-5" iyz="0" izz="5.9083e-4" />
</inertial>
</link>
<joint name="shoulder_x" type="continuous">
<parent link="dummy_link_2"/>
<child link="bicep_link"/>
<axis xyz="1 0 0" />
<dynamics damping="0.2"/>
<!-- <limit effort="50" velocity="2.0"/> -->
</joint>
<!-- Bicep Link-->
<link name="bicep_link">
<!-- <pose>0 0 0 0 0 0</pose> -->
<visual>
<origin xyz="0 0 0.525" rpy="0 0 0"/>
<geometry>
<box size="0.1 0.1 1"/>
</geometry>
</visual>
<!-- <collision>
<origin xyz="0 0 0.525" rpy="0 0 0"/>
<geometry>
<box size="0.1 0.1 0.8"/>
</geometry>
</collision> -->
<inertial>
<origin xyz="0 0 0.525" rpy="0 0 0"/>
<mass value="0.5"/>
<inertia ixx="0.04208" ixy="0.0" ixz="0.0" iyy="0.04208" iyz="0.0" izz="0.0008333"/>
</inertial>
</link>
<joint name="elbow" type="revolute">
<parent link="bicep_link"/>
<child link="forearm_link"/>
<axis xyz="1 0 0" />
<origin xyz="0 0 1.05" rpy="0 0 0"/>
<dynamics damping="0.2"/>
<limit effort="500" velocity="2.0" lower="-2.0" upper="2.0"/>
</joint>
<!-- Forearm Link-->
<link name="forearm_link">
<!-- <pose>0 0 0 0 0 0</pose> -->
<visual>
<origin xyz="0 0 0.525" rpy="0 0 0"/>
<geometry>
<box size="0.1 0.1 1"/>
</geometry>
</visual>
<!-- <collision>
<origin xyz="0 0 0.525" rpy="0 0 0"/>
<geometry>
<box size="0.1 0.1 0.8"/>
</geometry>
</collision> -->
<inertial>
<origin xyz="0 0 0.525" rpy="0 0 0"/>
<mass value="0.5"/>
<inertia ixx="0.04208" ixy="0.0" ixz="0.0" iyy="0.04208" iyz="0.0" izz="0.0008333"/>
</inertial>
</link>
<!-- Wrist Joint -->
<joint name="wrist_y" type="continuous">
<parent link="forearm_link"/>
<child link="dummy_link_3"/>
<axis xyz="0 1 0" />
<origin xyz="0.0 0 1.05" rpy="0 0 0"/>
<dynamics damping="0.2"/>
</joint>
<link name="dummy_link_3">
<inertial>
<mass value="0.025" />
<inertia ixx="5.8083e-4" ixy="0" ixz="0" iyy="3.0833e-5" iyz="0" izz="5.9083e-4" />
</inertial>
</link>
<joint name="wrist_x" type="continuous">
<parent link="dummy_link_3"/>
<child link="hand"/>
<!-- <child link="dummy_link_4"/> -->
<axis xyz="1 0 0" />
<dynamics damping="0.2"/>
</joint>
<!-- <link name="dummy_link_4">
<inertial>
<mass value="0.025" />
<inertia ixx="5.8083e-4" ixy="0" ixz="0" iyy="3.0833e-5" iyz="0" izz="5.9083e-4" />
</inertial>
</link>
<joint name="wrist_z" type="continuous">
<parent link="dummy_link_4"/>
<child link="hand"/>
<axis xyz="0 0 1" />
<dynamics damping="0.2"/>
</joint> -->
<link name="hand">
<visual>
<origin xyz="0 0 0.11" rpy="0 0 0"/>
<geometry>
<box size="0.1 0.1 0.2"/>
</geometry>
</visual>
<inertial>
<origin xyz="0 0 0.11" rpy="0 0 0"/>
<mass value="0.5"/>
<inertia ixx="0.04208" ixy="0.0" ixz="0.0" iyy="0.04208" iyz="0.0" izz="0.0008333"/>
</inertial>
</link>
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
</plugin>
</gazebo>
<transmission name="trans_shoulder_y">
<type>transmission_interface/SimpleTransmission</type>
<joint name="shoulder_y">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</joint>
<actuator name="actuator_shoulder_y">
<mechanicalReduction>1.0</mechanicalReduction>
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</actuator>
</transmission>
<transmission name="trans_shoulder_z">
<type>transmission_interface/SimpleTransmission</type>
<joint name="shoulder_z">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</joint>
<actuator name="actuator_shoulder_z">
<mechanicalReduction>1.0</mechanicalReduction>
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</actuator>
</transmission>
<transmission name="trans_shoulder_x">
<type>transmission_interface/SimpleTransmission</type>
<joint name="shoulder_x">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</joint>
<actuator name="actuator_shoulder_x">
<mechanicalReduction>1.0</mechanicalReduction>
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</actuator>
</transmission>
<transmission name="trans_elbow">
<type>transmission_interface/SimpleTransmission</type>
<joint name="elbow">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</joint>
<actuator name="actuator_elbow">
<mechanicalReduction>1.0</mechanicalReduction>
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</actuator>
</transmission>
<transmission name="trans_wrist_y">
<type>transmission_interface/SimpleTransmission</type>
<joint name="wrist_y">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</joint>
<actuator name="actuator_wrist_y">
<mechanicalReduction>1.0</mechanicalReduction>
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</actuator>
</transmission>
<transmission name="trans_wrist_x">
<type>transmission_interface/SimpleTransmission</type>
<joint name="wrist_x">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</joint>
<actuator name="actuator_wrist_x">
<mechanicalReduction>1.0</mechanicalReduction>
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</actuator>
</transmission>
<!-- <transmission name="trans_wrist_z">
<type>transmission_interface/SimpleTransmission</type>
<joint name="wrist_z">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</joint>
<actuator name="actuator_wrist_z">
<mechanicalReduction>1.0</mechanicalReduction>
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</actuator>
</transmission> -->
</robot>
And this is the config file I am using
--- # Publish all joint states -----------------------------------
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 1000
joints:
- shoulder_y
- shoulder_z
- shoulder_x
- elbow
- wrist_y
- wrist_x
# - wrist_z
# # Group Position Controllers ---------------------------------------
joint_group_position_controller:
type: effort_controllers/JointGroupPositionController
joints:
- shoulder_y
- shoulder_z
- shoulder_x
- elbow
- wrist_y
- wrist_x
# - wrist_z
shoulder_y:
pid: { p: 500.0, i: 0.0, d: 5.0 }
shoulder_z:
pid: { p: 500.0, i: 0.0, d: 5.0 }
shoulder_x:
pid: { p: 500.0, i: 0.0, d: 5.0 }
elbow:
pid: { p: 500.0, i: 0.0, d: 5.0 }
wrist_y:
pid: { p: 500.0, i: 0.0, d: 5.0 }
wrist_x:
pid: { p: 500.0, i: 0.0, d: 5.0 }
# wrist_z:
# pid: { p: 500.0, i: 0.0, d: 5.0 }
joint_group_effort_controller:
type: effort_controllers/JointGroupEffortController
joints:
- shoulder_y
- shoulder_z
- shoulder_x
- elbow
- wrist_y
- wrist_z
- wrist_x
And this is my launch file
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<group ns="/pend_bot">
<!-- Arguments for Robot Spawn -->
<arg name="paused" default="true"/>
<arg name="use_sim_time" default="true"/>
<arg name="gui" default="true"/>
<arg name="headless" default="false"/>
<arg name="debug" default="false"/>
<!-- We resume the logic in empty_world.launch -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(find pendulum_robot)/worlds/empty_world.world"/>
<arg name="debug" value="$(arg debug)" />
<arg name="gui" value="$(arg gui)" />
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
<arg name="headless" value="$(arg headless)"/>
</include>
<!-- Spawn Robot -->
<param name="robot_description" command="cat '$(find pendulum_robot)/urdf/robot_arm.urdf' " />
<arg name="x" default="0" />
<arg name="y" default="0" />
<arg name="z" default="0" />
<!-- Load Controller -->
<rosparam command="load" file="$(find pendulum_robot)/config/robot_joints.yaml"/>
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen">
</node>
<node name="spawn_pend_bot" pkg="gazebo_ros" type="spawn_model" output="screen"
args = "-urdf -param robot_description
-model pend_bot
-x $(arg x)
-y $(arg y)
-z $(arg z)
-gazebo_namespace /pend_bot/gazebo
-robot_namespace /pend_bot
-J shoulder_y 0.0
-J shoulder_z 0.0
-J shoulder_x 0.0
-J elbow 0.5
-J wrist_y 0.2
-J wrist_z 0.0
-J wrist_x 0.0" />
<!-- -J joint_link1_to_sphere1 0.0
-J joint_sphere1_to_link2 2.0
-J joint_link2_to_sphere2 0.0
-J joint_sphere2_to_link3 2.0 -->
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" ns="/pend_bot"
args="--namespace=/pend_bot joint_state_controller joint_group_position_controller">
<!-- joint1_position_controller
joint2_position_controller
joint3_position_controller
joint4_position_controller
joint5_position_controller
joint6_position_controller
joint7_position_controller -->
</node>
</group>
</launch>
Thank you.
Asked by A_J on 2023-04-29 10:24:29 UTC
Comments