Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to generate .sdf file from quadrotor.gazebo.xacro

Hi everyone

I meet with a issue for converting a .xacro file to a .sdf file for calling the service: spawn_sdf_model. I use Jade ros with gazebo 5. The robot model is hector_quadrotor. The package can be downloaded from the website: https://github.com/tu-darmstadt-ros-pkg/hector_quadrotor/tree/jade-devel. I try to generate a hector_quadrotor.sdf file from the file quadrotor.gazebo.xacro by using the following command:

rosrun xacro xacro --check-order quadrotor.gazebo.xacro > hector_quadrotor.sdf.

However, when I call the service spawn_sdf_model, the gazebo crashes for every trial. I try the same code with another .sdf (for spawning a box in the space). It works without any problem. I attached the code of sdf file as below. Hope anyone can give me some suggestions for correcting this conversion.

<robot name="quadrotor" xmlns:xacro="http://www.ros.org/wiki/xacro"> <link name="base_link"> <inertial> <mass value="1.477"/> <origin xyz="0 0 0"/> <inertia ixx="0.01152" ixy="0.0" ixz="0.0" iyy="0.01152" iyz="0.0" izz="0.0218"/> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://hector_quadrotor_description/meshes/quadrotor/quadrotor_base.dae"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://hector_quadrotor_description/meshes/quadrotor/quadrotor_base.stl"/> </geometry> </collision> </link> <joint name="sonar_joint" type="fixed"> <origin rpy="0 1.57079632679 0" xyz="-0.16 0.0 -0.012"/> <parent link="base_link"/> <child link="sonar_link"/> </joint> <link name="sonar_link"> <inertial> <mass value="0.001"/> <origin rpy="0 0 0" xyz="0 0 0"/> <inertia ixx="0.000000017" ixy="0" ixz="0" iyy="0.000000017" iyz="0" izz="0.000000017"/> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <mesh filename="package://hector_sensors_description/meshes/sonar_sensor/max_sonar_ez4.dae"/> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0"/> <geometry> <box size="0.01 0.01 0.01"/> </geometry> </collision> </link> <gazebo reference="sonar_link"> <sensor name="sonar" type="ray"> <always_on>true</always_on> <update_rate>10</update_rate> <pose>0 0 0 0 0 0</pose> <visualize>false</visualize> <ray> <scan> <horizontal> <samples>3</samples> <resolution>1</resolution> <min_angle>-0.349065850399</min_angle> <max_angle> 0.349065850399</max_angle> </horizontal> <vertical> <samples>3</samples> <resolution>1</resolution> <min_angle>-0.349065850399</min_angle> <max_angle> 0.349065850399</max_angle> </vertical> </scan> <range> <min>0.03</min> <max>3.0</max> <resolution>0.01</resolution> </range> </ray> <plugin filename="libhector_gazebo_ros_sonar.so" name="gazebo_ros_sonar_controller"> <gaussiannoise>0.005</gaussiannoise> <topicname>sonar_height</topicname> <frameid>sonar_link</frameid> </plugin> </sensor> </gazebo> <gazebo> <plugin filename="libhector_gazebo_ros_imu.so" name="quadrotor_imu_sim"> <updaterate>100.0</updaterate> <bodyname>base_link</bodyname> <frameid>base_link</frameid> <topicname>raw_imu</topicname> <rpyoffset>0 0 0</rpyoffset> <gaussiannoise>0</gaussiannoise> <acceldrift>0.5 0.5 0.5</acceldrift> <accelgaussiannoise>0.35 0.35 0.3</accelgaussiannoise> <ratedrift>0.1 0.1 0.1</ratedrift> <rategaussiannoise>0.05 0.05 0.015</rategaussiannoise> </plugin> <plugin filename="libhector_gazebo_ros_baro.so" name="quadrotor_baro_sim"> <updaterate>10.0</updaterate> <bodyname>base_link</bodyname> <frameid>base_link</frameid> <topicname>pressure_height</topicname> <altimetertopicname>altimeter</altimetertopicname> <offset>0</offset> <drift>10.0</drift> <gaussiannoise>0.1</gaussiannoise> </plugin> <plugin filename="libhector_gazebo_ros_magnetic.so" name="quadrotor_magnetic_sim"> <updaterate>10.0</updaterate> <bodyname>base_link</bodyname> <frameid>base_link</frameid> <topicname>magnetic</topicname> <offset>0 0 0</offset> <drift>0.0 0.0 0.0</drift> <gaussiannoise>1.3e-2 1.3e-2 1.3e-2</gaussiannoise> </plugin> <plugin filename="libhector_gazebo_ros_gps.so" name="quadrotor_gps_sim"> <updaterate>4.0</updaterate> <bodyname>base_link</bodyname> <frameid>base_link</frameid> <topicname>fix</topicname> <velocitytopicname>fix_velocity</velocitytopicname> <referencelatitude>49.860246</referencelatitude> <referencelongitude>8.687077</referencelongitude> <drift>5.0 5.0 5.0</drift> <gaussiannoise>0.01 0.01 0.01</gaussiannoise> <velocitydrift>0 0 0</velocitydrift> <velocitygaussiannoise>0.05 0.05 0.05</velocitygaussiannoise> </plugin> <plugin filename="libgazebo_ros_p3d.so" name="quadrotor_groundtruth_sim"> <updaterate>100.0</updaterate> <bodyname>base_link</bodyname> <topicname>ground_truth/state</topicname> <gaussiannoise>0.0</gaussiannoise> <framename>world</framename> </plugin> </gazebo> <gazebo> <plugin filename="libgazebo_ros_control.so" name="quadrotor_controller"> <controlperiod>0.01</controlperiod> <robotsimtype>hector_quadrotor_controller_gazebo/QuadrotorHardwareSim</robotsimtype> </plugin> </gazebo> <gazebo> <plugin filename="libhector_gazebo_quadrotor_propulsion.so" name="quadrotor_propulsion"> <alwayson>true</alwayson> <updaterate>0.0</updaterate> <bodyname>base_link</bodyname> <frameid>base_link</frameid> <controlrate>100.0</controlrate> <controldelay>0.01</controldelay> <motorstatusrate>100.0</motorstatusrate> </plugin> </gazebo> <gazebo> <plugin filename="libhector_gazebo_quadrotor_aerodynamics.so" name="quadrotor_aerodynamics"> <alwayson>true</alwayson> <updaterate>0.0</updaterate> <bodyname>base_link</bodyname> <frameid>base_link</frameid> </plugin> </gazebo> </robot>

Thanks for any information from you