Configure Gazebo and Simulink for Co-simulation of a Manipulator Robot

12 views (last 30 days)
Hello,
I am planning to connect my Simulink model to the Gazebo robot using Ubuntu 18.04 and Gazebo 9, and I have found that building a world setup is required to perform co-simulation between Gazebo and Simulink for Co-simulation of a Manipulator Robot and I refer to this link ( MathWorks). I did these steps:
1-opened my Xacro file using the roslaunch command.
2-Saved the newly created world to a .world file and added it in /usr/share/gazebo-9/worlds. (created file ,as shown below,did not include <?xml version="1.0"> and i added my self(do not know if it is right.)
3- Added mesh files into /usr/share/gazebo-9/models.
now my questions are?
1-I tried to open the .world file using the command gazebo my_robot.world --verbose but i got this " You must call ros::init() before creating the first NodeHandle".what is the problem?
2-In this website teaches us to" add .sdf file to an existing world, manually or via the Gazebo GUI".I do not understand what does this statement means and do not know where should I add this. sdf file. could anyone please explain it to me?
3-In this website teaches us to " Execute the following commands on the Gazebo machine to clone the linked repository"..where should I clone it exactly?
4-I have installed my package in-home/i-gadget/scripts and installed GazeboPlugIn in usr/src directory,and added my .world file in where gazebo models are located /usr/share/gazebo-9/worlds. could you please tell me where I should install GazeboCoSimPlugin ?.Should i install it in my robot package?.
my sdf file :
<sdf version='1.6'>
<world name='default'>
<light name='sun' type='directional'>
<cast_shadows>1</cast_shadows>
<pose frame=''>0 0 10 0 -0 0</pose>
<diffuse>0.8 0.8 0.8 1</diffuse>
<specular>0.2 0.2 0.2 1</specular>
<attenuation>
<range>1000</range>
<constant>0.9</constant>
<linear>0.01</linear>
<quadratic>0.001</quadratic>
</attenuation>
<direction>-0.5 0.1 -0.9</direction>
</light>
<model name='ground_plane'>
<static>1</static>
<link name='link'>
<collision name='collision'>
<geometry>
<plane>
<normal>0 0 1</normal>
<size>100 100</size>
</plane>
</geometry>
<surface>
<contact>
<collide_bitmask>65535</collide_bitmask>
<ode/>
</contact>
<friction>
<ode>
<mu>100</mu>
<mu2>50</mu2>
</ode>
<torsional>
<ode/>
</torsional>
</friction>
<bounce/>
</surface>
<max_contacts>10</max_contacts>
</collision>
<visual name='visual'>
<cast_shadows>0</cast_shadows>
<geometry>
<plane>
<normal>0 0 1</normal>
<size>100 100</size>
</plane>
</geometry>
<material>
<script>
<uri>file://media/materials/scripts/gazebo.material</uri>
<name>Gazebo/Grey</name>
</script>
</material>
</visual>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
</link>
</model>
<gravity>0 0 -9.8</gravity>
<magnetic_field>6e-06 2.3e-05 -4.2e-05</magnetic_field>
<atmosphere type='adiabatic'/>
<physics name='default_physics' default='0' type='ode'>
<max_step_size>0.001</max_step_size>
<real_time_factor>1</real_time_factor>
<real_time_update_rate>1000</real_time_update_rate>
</physics>
<scene>
<ambient>0.4 0.4 0.4 1</ambient>
<background>0.7 0.7 0.7 1</background>
<shadows>1</shadows>
</scene>
<audio>
<device>default</device>
</audio>
<wind/>
<spherical_coordinates>
<surface_model>EARTH_WGS84</surface_model>
<latitude_deg>0</latitude_deg>
<longitude_deg>0</longitude_deg>
<elevation>0</elevation>
<heading_deg>0</heading_deg>
</spherical_coordinates>
<model name='robot1'>
<link name='panda_link0'>
<pose frame=''>0 0 0 0 -0 0</pose>
<inertial>
<pose frame=''>0 0 0 0 -0 0</pose>
<mass>3.06</mass>
<inertia>
<ixx>0.3</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>0.3</iyy>
<iyz>0</iyz>
<izz>0.3</izz>
</inertia>
</inertial>
<collision name='panda_link0_collision'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/collision/link0.stl</uri>
</mesh>
</geometry>
<surface>
<contact>
<ode/>
</contact>
<friction>
<ode>
<mu>0.2</mu>
<mu2>0.2</mu2>
</ode>
<torsional>
<ode/>
</torsional>
</friction>
<bounce/>
</surface>
<max_contacts>10</max_contacts>
</collision>
<visual name='panda_link0_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/visual/link0.dae</uri>
</mesh>
</geometry>
<material>
<script>
<uri>__default__</uri>
<name>__default__</name>
</script>
</material>
</visual>
<gravity>1</gravity>
<velocity_decay/>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
</link>
<joint name='robot_to_world' type='fixed'>
<child>panda_link0</child>
<parent>world</parent>
</joint>
<link name='panda_link1'>
<pose frame=''>0 0 0.333 0 -0 0</pose>
<inertial>
<pose frame=''>0.003875 0.002081 -0.175 0 -0 0</pose>
<mass>4.97068</mass>
<inertia>
<ixx>0.70337</ixx>
<ixy>-0.000139</ixy>
<ixz>0.006772</ixz>
<iyy>0.70661</iyy>
<iyz>0.019169</iyz>
<izz>0.009117</izz>
</inertia>
</inertial>
<collision name='panda_link1_collision'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/collision/link1.stl</uri>
</mesh>
</geometry>
<surface>
<contact>
<ode/>
</contact>
<friction>
<ode>
<mu>0.2</mu>
<mu2>0.2</mu2>
</ode>
<torsional>
<ode/>
</torsional>
</friction>
<bounce/>
</surface>
<max_contacts>10</max_contacts>
</collision>
<visual name='panda_link1_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/visual/link1.dae</uri>
</mesh>
</geometry>
<material>
<script>
<uri>__default__</uri>
<name>__default__</name>
</script>
</material>
</visual>
<gravity>1</gravity>
<velocity_decay/>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
</link>
<joint name='panda_joint1' type='revolute'>
<child>panda_link1</child>
<parent>panda_link0</parent>
<axis>
<xyz>0 0 1</xyz>
<limit>
<lower>-2.8973</lower>
<upper>2.8973</upper>
<effort>87</effort>
<velocity>2.175</velocity>
</limit>
<dynamics>
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<link name='panda_link2'>
<pose frame=''>0 0 0.333 -1.5708 0 0</pose>
<inertial>
<pose frame=''>-0.003141 -0.02872 0.003495 0 -0 0</pose>
<mass>0.646926</mass>
<inertia>
<ixx>0.007962</ixx>
<ixy>-0.003925</ixy>
<ixz>0.010254</ixz>
<iyy>0.02811</iyy>
<iyz>0.000704</iyz>
<izz>0.025995</izz>
</inertia>
</inertial>
<collision name='panda_link2_collision'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/collision/link2.stl</uri>
</mesh>
</geometry>
<surface>
<contact>
<ode/>
</contact>
<friction>
<ode>
<mu>0.2</mu>
<mu2>0.2</mu2>
</ode>
<torsional>
<ode/>
</torsional>
</friction>
<bounce/>
</surface>
<max_contacts>10</max_contacts>
</collision>
<visual name='panda_link2_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/visual/link2.dae</uri>
</mesh>
</geometry>
<material>
<script>
<uri>__default__</uri>
<name>__default__</name>
</script>
</material>
</visual>
<gravity>1</gravity>
<velocity_decay/>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
</link>
<joint name='panda_joint2' type='revolute'>
<child>panda_link2</child>
<parent>panda_link1</parent>
<axis>
<xyz>0 1 0</xyz>
<limit>
<lower>-1.7628</lower>
<upper>1.7628</upper>
<effort>87</effort>
<velocity>2.175</velocity>
</limit>
<dynamics>
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<link name='panda_link3'>
<pose frame=''>0 -0 0.649 0 -0 0</pose>
<inertial>
<pose frame=''>0.027518 0.039252 -0.066502 0 -0 0</pose>
<mass>3.2286</mass>
<inertia>
<ixx>0.037242</ixx>
<ixy>-0.004761</ixy>
<ixz>-0.011396</ixz>
<iyy>0.036155</iyy>
<iyz>-0.012805</iyz>
<izz>0.01083</izz>
</inertia>
</inertial>
<collision name='panda_link3_collision'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/collision/link3.stl</uri>
</mesh>
</geometry>
<surface>
<contact>
<ode/>
</contact>
<friction>
<ode>
<mu>0.2</mu>
<mu2>0.2</mu2>
</ode>
<torsional>
<ode/>
</torsional>
</friction>
<bounce/>
</surface>
<max_contacts>10</max_contacts>
</collision>
<visual name='panda_link3_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/visual/link3.dae</uri>
</mesh>
</geometry>
<material>
<script>
<uri>__default__</uri>
<name>__default__</name>
</script>
</material>
</visual>
<gravity>1</gravity>
<velocity_decay/>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
</link>
<joint name='panda_joint3' type='revolute'>
<child>panda_link3</child>
<parent>panda_link2</parent>
<axis>
<xyz>0 0 1</xyz>
<limit>
<lower>-2.8973</lower>
<upper>2.8973</upper>
<effort>87</effort>
<velocity>2.175</velocity>
</limit>
<dynamics>
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<link name='panda_link4'>
<pose frame=''>0.0825 -0 0.649 1.5708 -0 0</pose>
<inertial>
<pose frame=''>-0.05317 0.104419 0.027454 0 -0 0</pose>
<mass>3.5879</mass>
<inertia>
<ixx>0.025853</ixx>
<ixy>0.007796</ixy>
<ixz>-0.001332</ixz>
<iyy>0.019552</iyy>
<iyz>0.008641</iyz>
<izz>0.028323</izz>
</inertia>
</inertial>
<collision name='panda_link4_collision'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/collision/link4.stl</uri>
</mesh>
</geometry>
<surface>
<contact>
<ode/>
</contact>
<friction>
<ode>
<mu>0.2</mu>
<mu2>0.2</mu2>
</ode>
<torsional>
<ode/>
</torsional>
</friction>
<bounce/>
</surface>
<max_contacts>10</max_contacts>
</collision>
<visual name='panda_link4_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/visual/link4.dae</uri>
</mesh>
</geometry>
<material>
<script>
<uri>__default__</uri>
<name>__default__</name>
</script>
</material>
</visual>
<gravity>1</gravity>
<velocity_decay/>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
</link>
<joint name='panda_joint4' type='revolute'>
<child>panda_link4</child>
<parent>panda_link3</parent>
<axis>
<xyz>0 -1 0</xyz>
<limit>
<lower>-3.0718</lower>
<upper>-0.0698</upper>
<effort>87</effort>
<velocity>2.175</velocity>
</limit>
<dynamics>
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<link name='panda_link5'>
<pose frame=''>-0 0 1.033 0 -0 0</pose>
<inertial>
<pose frame=''>-0.011953 0.041065 -0.038437 0 -0 0</pose>
<mass>1.22595</mass>
<inertia>
<ixx>0.035549</ixx>
<ixy>-0.002117</ixy>
<ixz>-0.004037</ixz>
<iyy>0.029474</iyy>
<iyz>0.000229</iyz>
<izz>0.008627</izz>
</inertia>
</inertial>
<collision name='panda_link5_collision'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/collision/link5.stl</uri>
</mesh>
</geometry>
<surface>
<contact>
<ode/>
</contact>
<friction>
<ode>
<mu>0.2</mu>
<mu2>0.2</mu2>
</ode>
<torsional>
<ode/>
</torsional>
</friction>
<bounce/>
</surface>
<max_contacts>10</max_contacts>
</collision>
<visual name='panda_link5_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/visual/link5.dae</uri>
</mesh>
</geometry>
<material>
<script>
<uri>__default__</uri>
<name>__default__</name>
</script>
</material>
</visual>
<gravity>1</gravity>
<velocity_decay/>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
</link>
<joint name='panda_joint5' type='revolute'>
<child>panda_link5</child>
<parent>panda_link4</parent>
<axis>
<xyz>0 0 1</xyz>
<limit>
<lower>-2.8973</lower>
<upper>2.8973</upper>
<effort>12</effort>
<velocity>2.61</velocity>
</limit>
<dynamics>
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<link name='panda_link6'>
<pose frame=''>-0 0 1.033 1.5708 -0 0</pose>
<inertial>
<pose frame=''>0.060149 -0.014117 -0.010517 0 -0 0</pose>
<mass>1.66656</mass>
<inertia>
<ixx>0.001964</ixx>
<ixy>0.000109</ixy>
<ixz>-0.001158</ixz>
<iyy>0.004354</iyy>
<iyz>0.000341</iyz>
<izz>0.005433</izz>
</inertia>
</inertial>
<collision name='panda_link6_collision'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/collision/link6.stl</uri>
</mesh>
</geometry>
<surface>
<contact>
<ode/>
</contact>
<friction>
<ode>
<mu>0.2</mu>
<mu2>0.2</mu2>
</ode>
<torsional>
<ode/>
</torsional>
</friction>
<bounce/>
</surface>
<max_contacts>10</max_contacts>
</collision>
<visual name='panda_link6_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/visual/link6.dae</uri>
</mesh>
</geometry>
<material>
<script>
<uri>__default__</uri>
<name>__default__</name>
</script>
</material>
</visual>
<gravity>1</gravity>
<velocity_decay/>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
</link>
<joint name='panda_joint6' type='revolute'>
<child>panda_link6</child>
<parent>panda_link5</parent>
<axis>
<xyz>0 -1 0</xyz>
<limit>
<lower>-0.0175</lower>
<upper>3.7525</upper>
<effort>12</effort>
<velocity>2.61</velocity>
</limit>
<dynamics>
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<link name='panda_link7'>
<pose frame=''>0.088 0 1.033 3.14159 -0 0</pose>
<inertial>
<pose frame=''>0.005465 -0.002209 0.083408 0 -0 0</pose>
<mass>1.41552</mass>
<inertia>
<ixx>0.115251</ixx>
<ixy>-0.000412199</ixy>
<ixz>-0.00102728</ixz>
<iyy>0.112794</iyy>
<iyz>-0.000809213</iyz>
<izz>0.10686</izz>
</inertia>
</inertial>
<collision name='panda_link7_collision'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/collision/link7.stl</uri>
</mesh>
</geometry>
<surface>
<contact>
<ode/>
</contact>
<friction>
<ode>
<mu>0.2</mu>
<mu2>0.2</mu2>
</ode>
<torsional>
<ode/>
</torsional>
</friction>
<bounce/>
</surface>
<max_contacts>10</max_contacts>
</collision>
<collision name='panda_link7_fixed_joint_lump__panda_hand_collision_1'>
<pose frame=''>0 0 0.107 0 0 -0.785398</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/collision/hand.stl</uri>
</mesh>
</geometry>
<surface>
<contact>
<ode/>
</contact>
<friction>
<ode>
<mu>0.2</mu>
<mu2>0.2</mu2>
</ode>
<torsional>
<ode/>
</torsional>
</friction>
<bounce/>
</surface>
<max_contacts>10</max_contacts>
</collision>
<visual name='panda_link7_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/visual/link7.dae</uri>
</mesh>
</geometry>
<material>
<script>
<uri>__default__</uri>
<name>__default__</name>
</script>
</material>
</visual>
<visual name='panda_link7_fixed_joint_lump__panda_hand_visual_1'>
<pose frame=''>0 0 0.107 0 0 -0.785398</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/visual/hand.dae</uri>
</mesh>
</geometry>
<material>
<script>
<uri>__default__</uri>
<name>__default__</name>
</script>
</material>
</visual>
<velocity_decay/>
<velocity_decay/>
<gravity>1</gravity>
<velocity_decay/>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
</link>
<joint name='panda_joint7' type='revolute'>
<child>panda_link7</child>
<parent>panda_link6</parent>
<axis>
<xyz>0 -0 -1</xyz>
<limit>
<lower>-2.8973</lower>
<upper>2.8973</upper>
<effort>12</effort>
<velocity>2.61</velocity>
</limit>
<dynamics>
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<link name='panda_leftfinger'>
<pose frame=''>0.088 -0 0.8676 3.14159 -0 0.785398</pose>
<inertial>
<pose frame=''>0 0 0 0 -0 0</pose>
<mass>0.01</mass>
<inertia>
<ixx>0.1</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>0.1</iyy>
<iyz>0</iyz>
<izz>0.1</izz>
</inertia>
</inertial>
<collision name='panda_leftfinger_collision'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/collision/finger.stl</uri>
</mesh>
</geometry>
<surface>
<contact>
<ode/>
</contact>
<friction>
<ode>
<mu>0.2</mu>
<mu2>0.2</mu2>
</ode>
<torsional>
<ode/>
</torsional>
</friction>
<bounce/>
</surface>
<max_contacts>10</max_contacts>
</collision>
<visual name='panda_leftfinger_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/visual/finger.dae</uri>
</mesh>
</geometry>
<material>
<script>
<uri>__default__</uri>
<name>__default__</name>
</script>
</material>
</visual>
<gravity>1</gravity>
<velocity_decay/>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
</link>
<joint name='panda_finger_joint1' type='prismatic'>
<child>panda_leftfinger</child>
<parent>panda_link7</parent>
<axis>
<xyz>0.707107 -0.707107 0</xyz>
<limit>
<lower>0</lower>
<upper>0.04</upper>
<effort>20</effort>
<velocity>0.2</velocity>
</limit>
<dynamics>
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<link name='panda_rightfinger'>
<pose frame=''>0.088 -0 0.8676 3.14159 -0 0.785398</pose>
<inertial>
<pose frame=''>0 0 0 0 -0 0</pose>
<mass>0.0001</mass>
<inertia>
<ixx>0.1</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>0.1</iyy>
<iyz>0</iyz>
<izz>0.1</izz>
</inertia>
</inertial>
<collision name='panda_rightfinger_collision'>
<pose frame=''>0 0 0 0 -0 -3.14159</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/collision/finger.stl</uri>
</mesh>
</geometry>
<surface>
<contact>
<ode/>
</contact>
<friction>
<ode>
<mu>0.2</mu>
<mu2>0.2</mu2>
</ode>
<torsional>
<ode/>
</torsional>
</friction>
<bounce/>
</surface>
<max_contacts>10</max_contacts>
</collision>
<visual name='panda_rightfinger_visual'>
<pose frame=''>0 0 0 0 -0 -3.14159</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>/home/i-gadget/script/catkin_ws/src/franka_description/meshes/visual/finger.dae</uri>
</mesh>
</geometry>
<material>
<script>
<uri>__default__</uri>
<name>__default__</name>
</script>
</material>
</visual>
<gravity>1</gravity>
<velocity_decay/>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
</link>
<joint name='panda_finger_joint2' type='prismatic'>
<child>panda_rightfinger</child>
<parent>panda_link7</parent>
<axis>
<xyz>-0.707107 0.707107 -0</xyz>
<limit>
<lower>0</lower>
<upper>0.04</upper>
<effort>20</effort>
<velocity>0.2</velocity>
</limit>
<dynamics>
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<static>0</static>
<plugin name='gazebo_ros_control' filename='libgazebo_ros_control.so'>
<legacyModeNS>0</legacyModeNS>
<robotNamespace>/robot1/</robotNamespace>
</plugin>
<pose frame=''>0 0 0 0 -0 0</pose>
</model>
<state world_name='default'>
<sim_time>373 583000000</sim_time>
<real_time>463 540604208</real_time>
<wall_time>1633338584 273120046</wall_time>
<iterations>373583</iterations>
<model name='ground_plane'>
<pose frame=''>0 0 0 0 -0 0</pose>
<scale>1 1 1</scale>
<link name='link'>
<pose frame=''>0 0 0 0 -0 0</pose>
<velocity>0 0 0 0 -0 0</velocity>
<acceleration>0 0 0 0 -0 0</acceleration>
<wrench>0 0 0 0 -0 0</wrench>
</link>
</model>
<model name='robot1'>
<pose frame=''>-0 0 3.3e-05 -3.2e-05 -0 0</pose>
<scale>1 1 1</scale>
<link name='panda_leftfinger'>
<pose frame=''>0.384315 -0.032452 0.95659 1.66594 -1.36537 1.38983</pose>
<velocity>-8.3e-05 -0.002881 0.002186 -0.000121 -0.000603 0.001979</velocity>
<acceleration>-0.099046 -9.87291 1.6 0.004345 -0.389409 1.2345</acceleration>
<wrench>-0.00099 -0.098729 0.016 0 -0 0</wrench>
</link>
<link name='panda_link0'>
<pose frame=''>-0 0 3.3e-05 -3.2e-05 -0 0</pose>
<velocity>-2e-06 0 0.006652 -0.006447 2.3e-05 1.7e-05</velocity>
<acceleration>-0.004817 0.000746 13.305 -0.327541 0.045471 0.034905</acceleration>
<wrench>-0.014741 0.002284 40.7132 0 -0 0</wrench>
</link>
<link name='panda_link1'>
<pose frame=''>1e-06 1.1e-05 0.333033 -3.1e-05 2e-06 -0.004832</pose>
<velocity>0.000124 0.002123 0.006565 -0.006248 0.000294 0.015168</velocity>
<acceleration>0.069893 2.20441 13.1006 0.062739 0.594635 -0.296301</acceleration>
<wrench>0.347415 10.9574 65.119 0 -0 0</wrench>
</link>
<link name='panda_link2'>
<pose frame=''>-0 9e-06 0.333033 -1.57086 -0.578751 -0.004802</pose>
<velocity>-2.7e-05 0.0018 0.00659 -0.009439 -0.01037 0.014797</velocity>
<acceleration>-0.752145 3.34779 12.6472 2.17734 1.1425 1.95253</acceleration>
<wrench>-0.486582 2.16577 8.18183 0 -0 0</wrench>
</link>
<link name='panda_link3'>
<pose frame=''>-0.172835 0.000859 0.597565 -0.005521 -0.578756 0.005298</pose>
<velocity>-0.001735 0.002717 0.004 0.012941 -0.014854 -0.001644</velocity>
<acceleration>-3.06338 5.29873 10.4843 2.2843 -0.025937 -2.54741</acceleration>
<wrench>-9.89043 17.1075 33.8496 0 -0 0</wrench>
</link>
<link name='panda_link4'>
<pose frame=''>-0.10377 0.001225 0.64269 1.5587 1.17884 -0.008856</pose>
<velocity>-0.002205 0.002065 0.004872 0.013362 0.011643 0.006153</velocity>
<acceleration>-2.85374 0.499818 6.09079 3.1076 -0.639525 -0.449654</acceleration>
<wrench>-10.2389 1.7933 21.8531 0 -0 0</wrench>
</link>
<link name='panda_link5'>
<pose frame=''>0.219596 0.003007 0.865611 -0.498282 1.12092 -0.539258</pose>
<velocity>0.000339 0.001156 0.001149 -0.004943 0.011073 -0.000586</velocity>
<acceleration>0.653205 -1.03381 0.278389 0.742809 -1.23025 2.34379</acceleration>
<wrench>0.800796 -1.2674 0.341291 0 -0 0</wrench>
</link>
<link name='panda_link6'>
<pose frame=''>0.219596 0.003007 0.865611 0.092977 -1.36053 1.39205</pose>
<velocity>0.000307 0.001214 0.001152 -0.006117 -0.000348 0.001718</velocity>
<acceleration>0.71867 -0.280046 -0.638608 0.821416 -1.09543 -2.64668</acceleration>
<wrench>1.19771 -0.466714 -1.06428 0 -0 0</wrench>
</link>
<link name='panda_link7'>
<pose frame=''>0.222861 0.021082 0.951673 -1.6061 -0.989635 -1.6291</pose>
<velocity>0.000236 0.001761 0.001045 -0.000122 -0.00062 0.001978</velocity>
<acceleration>0.712141 0.211058 -0.555632 0.013705 -0.427725 1.14417</acceleration>
<wrench>1.00805 0.298757 -0.786509 0 -0 0</wrench>
</link>
<link name='panda_rightfinger'>
<pose frame=''>0.390944 0.046476 0.940164 1.66594 -1.36537 1.38983</pose>
<velocity>0.085037 1.01225 -0.209079 -0.000121 -0.000609 0.00198</velocity>
<acceleration>99.1284 1172.56 -244.473 0.003039 -0.402752 1.2355</acceleration>
<wrench>0.009913 0.117256 -0.024447 0 -0 0</wrench>
</link>
</model>
<light name='sun'>
<pose frame=''>0 0 10 0 -0 0</pose>
</light>
</state>
<gui fullscreen='0'>
<camera name='user_camera'>
<pose frame=''>5 -5 2 0 0.275643 2.35619</pose>
<view_controller>orbit</view_controller>
<projection_type>perspective</projection_type>
</camera>
</gui>
<plugin name="GazeboPlugin" filename="lib/libGazeboCoSimPlugin.so"><portNumber>14581</portNumber></plugin>
</world>
</sdf>

Accepted Answer

Gaurav Bhosale
Gaurav Bhosale on 6 Oct 2021
Edited: Gaurav Bhosale on 6 Oct 2021
Hi Maryam,
" add .sdf file to an existing world, manually or via the Gazebo GUI" means, once you launched Gazebo with your SDF models, you can save that Gazebo world as .world using GUI as follows,
You can save as my_robot.world. Further, you need to follow steps provided in the same example.
Basically, my_robot.world links SDF models which you loads with Gazebo. Further, generally, /home/user/.gazebo/models is the location used to add new models ( Tutorial )
You can keep your models in this location.
In addition, as per your shared SDF file, "/home/i-gadget/script/catkin_ws/src/franka_description/meshes" is the location where mesh should be present.
Further, you can execute following command to link lib/libGazeboCoSimPlugin.so
export GAZEBO_PLUGIN_PATH=${GAZEBO_PLUGIN_PATH}:/usr/src/GazeboPlugin/export
You can get more details about linking lib/libGazeboCoSimPlugin.so in this example.
Let me know, if you face further issue.
Thanks
  1 Comment
Maryam Mohammadipilehvar
Maryam Mohammadipilehvar on 8 Oct 2021
Thank you for your answer.when I lunch my_robot.lunch file and save it as a .world, it saved as a .sdf (XML ) file and also is simple text not a bunch of codes.
and if I want to open it, I get " You must call ros::init() before creating the first NodeHandle".
Regarding this tutorial, to solve this error, i think i should do steps represented in the "Model Database" Robot Spawn Method part pf this tutorial.Am i right?
to have an interface between MatLab/Simulink and gazebo, is it only possible with a .world file? can I do this somehow with the .xacro file?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by