ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Create a pool in Gazebo

asked 2011-12-15 23:40:26 -0500

Penny gravatar image

updated 2011-12-16 01:06:10 -0500

DimitriProsser gravatar image
<?xml version="1.0" ?> 
  <robot name="my_robot">

   <link name="base_link">   
     <inertial>    
       <origin xyz="0 0 0" rpy="0 0 0"  />    
       <mass value="100.0" />  
     <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="100.0" iyz="0.0" izz="1.0" />         
   </inertial>   

   <visual> 
     <origin xyz="0 0 0" rpy="0 0 0" />    
     <geometry>
        <box size="-4.8 3 0.1" />     
     </geometry>  
     <material name="white">       
        <color rgba="1 1 1 1"/>    
     </material> 
   </visual>     

   <collision>
     <origin xyz="0 0 0" rpy="0 0 0" />    
     <geometry> 
       <box size="-4.8 3 0.1" />     
     </ geometry> 
   </collision>  
 </link> 

 <link name="child_link">

   <inertial> 
      <origin xyz="2.45 0 0.75" /> 
      <mass value="10.0" />     
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="100.0" iyz="0.0" izz="1.0" /> 
   </inertial>  

   <visual> 
     <geometry>
       <box size="0.1 3 1.5"/>  
     </geometry>  
     <origin xyz="2.45 0.75" />  
     <material name="white">    
       <color rgba="1 1 1 1"/>  
     </material>   
   </visual> 

   <collision>  
     <origin xyz="2.45 0 0.75" />    
     <geometry> 
        <box size="0.1 3 1.5" />     
     </ geometry> 
   </collision>    
 </link>  

 <joint name="base_link_to_child_link" type="fixed">
   <parent link="base_link" /> 
   <child link="child_link" /> 
   <axis="0 1 0" />
   <calibration rising="0.0" /> 
 </joint> 
</robot>

Hello.

I am new in ros. This is my urdf, I want to create a pool, and i tried to make a rectangular for a base and with joints to unite each other rectangular which will represent one of the four frames. In this urdf i wrote the base which is the first link and the left frame which is the second link, and i unite them with a joint. When i run this urdf, only the base (the first link) is showed in gazebo, what is the problem??? Is there any other way to create a pool without joints, only with one link?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2011-12-16 01:03:43 -0500

DimitriProsser gravatar image

updated 2012-01-11 01:50:18 -0500

The easiest way would be to create a mesh instead of using the default Gazebo geometries. Meshes for Gazebo can be created with a number of different programs, but personally, I prefer Blender. It's a free 3D modeling and animation program that has the ability to export to COLLADA (.dae) files that you can then import into Gazebo. Other programs include Meshlab, 3dMax, Maya, etc.

Also, in your urdf, you did not specify an <origin> for your joint. It should have an <origin> tag, just like links.

EDIT: To import your Blender model, first export the model to COLLADA (.dae). Then, you simply make a link like so:

<link name="base_link">
  <inertial>
    <mass value="10.0" />
    <origin xyz="0 0 0" />
    <inertia  ixx="1.0" ixy="0.0"  ixz="0.0"  iyy="1.0"  iyz="0.0"  izz="1.0" />
  </inertial>
  <visual>
   <origin xyz="0 0 0" rpy="0 0 0" />
   <geometry>
     <mesh filename="package://your_package/meshes/body.dae"/>
   </geometry>
  </visual>
  <collision>
   <origin xyz="0 0 0" rpy="0 0 0 " />
   <geometry>
     <mesh filename="package://your_package/meshes/body.dae"/>
   </geometry>
  </collision>     
</link>
edit flag offensive delete link more

Comments

Thanks a lot, it really helped, this program (Blender) is brilliant!!
Penny gravatar image Penny  ( 2012-01-18 05:27:55 -0500 )edit
I did the exporting and a link as above, yes my file opened in gazebo but, it does not look like in blender, in blender I have created an empty pool, but in gazebo it looks like two different shapes.What can I do?
Penny gravatar image Penny  ( 2012-01-22 20:52:22 -0500 )edit
Sometimes I've noticed that Gazebo has a difficult time rendering certain images. Is the shape wrong, or does it look like it could just be rendered incorrectly?
DimitriProsser gravatar image DimitriProsser  ( 2012-01-23 00:36:03 -0500 )edit
The shape in gazebo is completely wrong, model is not recognizable at all, there are a few polygon here and there.
Penny gravatar image Penny  ( 2012-01-23 01:16:38 -0500 )edit
Oh yes, I've received that error before. The problem comes from Blender > 2.49b. I don't know what's different in the COLLADA exporter, but it doesn't work. Thus, I still use Blender 2.49b. I have a "build" machine to do the exporting, so I can still use 2.6 on my main machine.
DimitriProsser gravatar image DimitriProsser  ( 2012-01-23 08:29:27 -0500 )edit
I managed to install 2.49b on the same machine as 2.61. I can successfully open my .blend files coming from 2.61, but exporting to COLLADA 1.4 I still get mangled meshes in gazebo. I tried both the "polygon" and "triangles" export options. Do you have any other hints?
Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2012-01-24 03:39:47 -0500 )edit
My settings are: Triangles, Only Export Selection, Disable Physics, and Use Relative Paths. Give that a try and let me know.
DimitriProsser gravatar image DimitriProsser  ( 2012-01-24 04:31:28 -0500 )edit
I really need some help because I am desperate!! i have a .dae file from blender 2.6 which i transformed to .urdf as u explained above.. i post this part to tell me what do u think:
Penny gravatar image Penny  ( 2012-01-24 06:18:46 -0500 )edit
0

answered 2012-01-24 06:22:12 -0500

Penny gravatar image

<robot name="my_pool">

<link name="base_link"> <inertial> <mass value="100.0"/> <origin xyz="0 0 0"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> <visual> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <mesh filename="package://home/phadjic/ros_workspace/pool_party/meshes/test.dae"/> </geometry> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0 "/> <geometry> <mesh filename="package://home/phadjic/ros_workspace/pool_party/meshes/test.dae"/> </geometry> </collision>
</link>

</robot>

edit flag offensive delete link more
0

answered 2012-01-24 06:48:24 -0500

hsu gravatar image

updated 2012-01-24 06:51:43 -0500

There are some errors in your xml,

  • box size is negative

    <box size="-4.8 3 0.1" />
    
  • one of the origin tag missing one element

    <origin xyz="2.45 0.75"/>

  • the links are not static, so once the simulation is unpaused, the links flies off. But you can fix this by adding a static tag. See working model below:


<?xml version="1.0"?>
<robot name="my_robot">
  <link name="base_link">
    <inertial>
       <origin xyz="0 0 0" rpy="0 0 0"  />
       <mass value="100.0" />  
     <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="100.0" iyz="0.0" izz="1.0" />         
   </inertial>
   <visual> 
     <origin xyz="0 0 0.05" rpy="0 0 0" />    
     <geometry>
        <box size="4.8 3 0.1" />     
     </geometry>  
     <material name="white">       
        <color rgba="1 1 1 1"/>    
     </material> 
   </visual>     
   <collision>
     <origin xyz="0 0 0.05" rpy="0 0 0" />    
     <geometry> 
       <box size="4.8 3 0.1" />     
     </geometry> 
   </collision>  
 </link> 
 <link name="child_link">

   <inertial> 
      <origin xyz="2.45 0 0.75" /> 
      <mass value="10.0" />     
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="100.0" iyz="0.0" izz="1.0" /> 
   </inertial>  

   <visual> 
     <geometry>
       <box size="0.1 3 1.5"/>  
     </geometry>  
     <origin xyz="2.45 0 0.75" />  
     <material name="white">    
       <color rgba="1 1 1 1"/>  
     </material>   
   </visual> 

   <collision>  
     <origin xyz="2.45 0 0.75" />    
     <geometry> 
        <box size="0.1 3 1.5" />     
     </geometry> 
   </collision>    
 </link>  

 <joint name="base_link_to_child_link" type="continuous">
   <parent link="base_link" /> 
   <child link="child_link" /> 
   <axis xyz="0 1 0" />
   <calibration rising="0.0" /> 
 </joint> 

 <gazebo>
   <static>true</static>
 </gazebo>
 <gazebo reference="child_link">
   <turnGravityOff>true</turnGravityOff>
 </gazebo>
 <gazebo reference="base_link">
   <turnGravityOff>true</turnGravityOff>
 </gazebo>
</robot>
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2011-12-15 23:40:26 -0500

Seen: 978 times

Last updated: Jan 24 '12