headlight.urdf.xacro 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?xml version="1.0"?>
  2. <robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="headlight">
  3. <xacro:macro name="headlight" params="parent headlight_prefix xyz rpy">
  4. <gazebo>
  5. <model name="${headlight_prefix}_headlight">
  6. <pose>${xyz} ${rpy}</pose>
  7. <link name="body">
  8. <pose>0.0 0 0 0 0 0</pose>
  9. <light name="light_source" type="spot">
  10. <!--<pose>-0.025 0 0.0 0 1.573 0</pose>-->
  11. <pose>0.0 0 0.0 0 -1.573 0</pose>
  12. <attenuation>
  13. <range>25</range>
  14. <linear>0.3</linear>
  15. <constant>0.1</constant>
  16. <quadratic>0.04</quadratic>
  17. </attenuation>
  18. <diffuse>0.4 0.4 0.4 1</diffuse>
  19. <specular>0.01 0.01 0.01 1</specular>
  20. <spot>
  21. <inner_angle>0.8</inner_angle>
  22. <outer_angle>1.9</outer_angle>
  23. <falloff>1</falloff>
  24. </spot>
  25. <direction>0 0 -1</direction>
  26. </light>
  27. <inertial>
  28. <mass>0.00001</mass>
  29. <inertia>
  30. <ixx>0.00000001</ixx>
  31. <iyy>0.00000001</iyy>
  32. <izz>0.00000001</izz>
  33. </inertia>
  34. </inertial>
  35. <visual name="light_source_visual">
  36. <geometry>
  37. <!--<box size="10.001 0.001 0.001"/>-->
  38. <sphere>
  39. <radius>0.01</radius>
  40. </sphere>
  41. </geometry>
  42. <transparency>1</transparency>
  43. <material>
  44. <ambient>1 1 1 1</ambient>
  45. <diffuse>1 1 1 1</diffuse>
  46. <specular>1 1 1 1</specular>
  47. <emissive>0 0 0 1</emissive>
  48. </material>
  49. <plugin name='light_source_visualize' filename='libLightVisualPlugin.so'>
  50. <light>
  51. <id>light_source</id>
  52. <visualize>false</visualize>
  53. </light>
  54. </plugin>
  55. </visual>
  56. </link>
  57. <plugin name='light_control' filename='libRosFlashLightPlugin.so'>
  58. <service_name>enable</service_name>
  59. <light>
  60. <id>body/light_source</id>
  61. <enable>true</enable>
  62. <duration>1</duration>
  63. <interval>0</interval>
  64. <color>1 1 1</color>
  65. </light>
  66. </plugin>
  67. </model>
  68. </gazebo>
  69. <gazebo>
  70. <joint name="${headlight_prefix}_headlight" type="fixed">
  71. <parent>${parent}</parent>
  72. <child>${headlight_prefix}_headlight::body</child>
  73. </joint>
  74. </gazebo>
  75. </xacro:macro>
  76. </robot>