用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/MIUAV/vibe-coding-ros2 --skill sdf-xacro-model命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | sdf-xacro-model |
| description | 多旋翼无人机 SDF/XACRO 模型开发技能 - 四旋翼、六旋翼、八旋翼模型创建、飞行物理配置、环境风力仿真 |
| argument-hint | 创建无人机模型 OR 四旋翼 OR 六旋翼 OR 无人机仿真 |
| user-invocable | true |
用于创建多旋翼无人机的 SDF 和 XACRO 模型
当需要以下帮助时使用此技能:
四旋翼 (Quadrotor) - 简单、紧凑
六旋翼 (Hexrotor) - 更大负载、更稳定
八旋翼 (Octrotor) - 最大负载、高冗余
<?xml version="1.0" ?>
<sdf version="1.11">
<model name="quadrotor">
<static>false</static>
<self_collide>false</self_collide>
<!-- 机身 -->
<link name="base_link">
<pose>0 0 0.05 0 0 0</pose>
<inertial>
<mass>1.5</mass>
<inertia>
<ixx>0.01</ixx><ixy>0</ixy><ixz>0</ixz>
<iyy>0.01</iyy><iyz>0</iyz>
<izz>0.02</izz>
</inertia>
</inertial>
<!-- 碰撞体 -->
<collision name="base_collision">
<geometry>
<box>
<size>0.2 0.2 0.05</size>
</box>
</geometry>
</collision>
<!-- 视觉体 -->
<visual name="base_visual">
<geometry>
<box>
<size>0.2 0.2 0.05</size>
</box>
</geometry>
<material>
<ambient>0.3 0.3 0.3 1</ambient>
<diffuse>0.3 0.3 0.3 1</diffuse>
</material>
</visual>
<!-- 螺旋桨保护圈 -->
<visual name="prop_guard">
<pose>0 0 0.02 0 0 0</pose>
<geometry>
<cylinder>
<radius>0.15</radius>
<length>0.01</length>
</cylinder>
</geometry>
<material>
<ambient>0.5 0.5 0.8 1</ambient>
</material>
</visual>
</link>
<!-- 左前电机 (CW) -->
<link name="motor_fl">
<pose>0.15 0.15 0.03 0 0 0</pose>
<inertial>
<mass>0.05</mass>
<inertia>
<ixx>0.0001</ixx><ixy>0</ixy><ixz>0</ixz>
<iyy>0.0001</iyy><iyz>0</iyz>
<izz>0.0001</izz>
</inertia>
</inertial>
<collision name="motor_fl_collision">
<geometry>
<cylinder>
<radius>0.015</radius>
<height>0.02</height>
</cylinder>
</geometry>
</collision>
<visual name="motor_fl_visual">
<geometry>
<cylinder>
<radius>0.015</radius>
<height>0.02</height>
</cylinder>
</geometry>
<material>
<ambient>0.1 0.1 0.1 1</ambient>
</material>
</visual>
</link>
<joint name="motor_fl_joint" type="revolute">
<parent>base_link</parent>
<child>motor_fl</child>
<axis>
<xyz>0 0 1</xyz>
<limit>
<lower>-1000</lower>
<upper>1000</upper>
<effort>10</effort>
<velocity>1000</velocity>
</limit>
</axis>
</joint>
<!-- 右前电机 (CCW) -->
<link name="motor_fr">
<pose>0.15 -0.15 0.03 0 0 0</pose>
<inertial>
<mass>0.05</mass>
<inertia>
<ixx>0.0001</ixx><ixy>0</ixy><ixz>0</ixz>
<iyy>0.0001</iyy><iyz>0</iyz>
<izz>0.0001</izz>
</inertia>
</inertial>
<collision name="motor_fr_collision">
<geometry>
<cylinder>
<radius>0.015</radius>
<height>0.02</height>
</cylinder>
</geometry>
</collision>
<visual name="motor_fr_visual">
<geometry>
<cylinder>
<radius>0.015</radius>
<height>0.02</height>
</cylinder>
</geometry>
<material>
<ambient>0.1 0.1 0.1 1</ambient>
</material>
</visual>
</link>
<joint name="motor_fr_joint" type="revolute">
<parent>base_link</parent>
<child>motor_fr</child>
<axis>
<xyz>0 0 1</xyz>
</axis>
</joint>
<!-- 左后电机 (CCW) -->
<link name="motor_rl">
<pose>-0.15 0.15 0.03 0 0 0</pose>
<inertial>
<mass>0.05</mass>
<inertia>
<ixx>0.0001</ixx><ixy>0</ixy><ixz>0</ixz>
<iyy>0.0001</iyy><iyz>0</iyz>
<izz>0.0001</izz>
</inertia>
</inertial>
<collision name="motor_rl_collision">
<geometry>
<cylinder>
<radius>0.015</radius>
<height>0.02</height>
</cylinder>
</geometry>
</collision>
<visual name="motor_rl_visual">
<geometry>
<cylinder>
<radius>0.015</radius>
<height>0.02</height>
</cylinder>
</geometry>
<material>
<ambient>0.1 0.1 0.1 1</ambient>
</material>
</visual>
</link>
<joint name="motor_rl_joint" type="revolute">
<parent>base_link</parent>
<child>motor_rl</child>
<axis>
<xyz>0 0 1</xyz>
</axis>
</joint>
<!-- 右后电机 (CW) -->
<link name="motor_rr">
<pose>-0.15 -0.15 0.03 0 0 0</pose>
<inertial>
<mass>0.05</mass>
<inertia>
<ixx>0.0001</ixx><ixy>0</ixy><ixz>0</ixz>
<iyy>0.0001</iyy><iyz>0</iyz>
<izz>0.0001</izz>
</inertia>
</inertial>
<collision name="motor_rr_collision">
<geometry>
<cylinder>
<radius>0.015</radius>
<height>0.02</height>
</cylinder>
</geometry>
</collision>
<visual name="motor_rr_visual">
<geometry>
<cylinder>
<radius>0.015</radius>
<height>0.02</height>
</cylinder>
</geometry>
<material>
<ambient>0.1 0.1 0.1 1</ambient>
</material>
</visual>
</link>
<joint name="motor_rr_joint" type="revolute">
<parent>base_link</parent>
<child>motor_rr</child>
<axis>
<xyz>0 0 1</xyz>
</axis>
</joint>
<!-- 螺旋桨 (视觉) -->
<link name="prop_fl">
<pose>0.15 0.15 0.05 0 0 0</pose>
<inertial>
<mass>0.01</mass>
<inertia>
<ixx>0.00001</ixx><ixy>0</ixy><ixz>0</ixz>
<iyy>0.00001</iyy><iyz>0</iyz>
<izz>0.00001</izz>
</inertia>
</inertial>
<visual name="prop_fl_visual">
<geometry>
<cylinder>
<radius>0.08</radius>
<height>0.005</height>
</cylinder>
</geometry>
<material>
<ambient>0.8 0.8 0.8 0.5</ambient>
<transparency>0.5</transparency>
</material>
</visual>
</link>
<joint name="prop_fl_joint" type="fixed">
<parent>motor_fl</parent>
<child>prop_fl</child>
</joint>
<!-- 传感器 - 激光雷达 -->
<link name="laser_link">
<pose>0 0 0.05 0 0 0</pose>
<sensor name="laser" type="gpu_lidar">
<update_rate>20</update_rate>
<ray>
<scan>
<horizontal>
<samples>360</samples>
<resolution>1</resolution>
</horizontal>
</scan>
<range>
<min>0.1</min>
<max>50</max>
</range>
</ray>
<plugin filename="gz-sim-sensors-gpu-lidar" name="gz::sim::systems::GpuRaySensor">
<ros>
<namespace>/uav</namespace>
</ros>
</plugin>
</sensor>
</link>
<joint name="laser_joint" type="fixed">
<parent>base_link</parent>
<child>laser_link</child>
</joint>
<!-- GPS -->
<link name="gps_link">
<pose>0 0.1 0.05 0 0 0</pose>
<sensor name="gps" type="gps">
<update_rate>10</update_rate>
<plugin filename="gz-sim-sensors-gps-system" name="gz::sim::systems::Gps">
<ros>
<namespace>/uav</namespace>
</ros>
</plugin>
</sensor>
</link>
<joint name="gps_joint" type="fixed">
<parent>base_link</parent>
<child>gps_link</child>
</joint>
<!-- IMU -->
<link name="imu_link">
<pose>0 0 0.02 0 0 0</pose>
<sensor name="imu" type="imu">
<update_rate>100</update_rate>
<plugin filename="gz-sim-sensors-imu-system" name="gz::sim::systems::Imu">
<ros>
<namespace>/uav</namespace>
</ros>
</plugin>
</sensor>
</link>
<joint name="imu_joint" type="fixed">
<parent>base_link</parent>
<child>imu_link</child>
</joint>
<!-- 多旋翼控制器插件 -->
<plugin filename="gz-sim-multirotor-physics-plugin" name="gz::sim::systems::MultirotorPhysics">
<robotNamespace>uav</robotNamespace>
<robotName>quadrotor</robotName>
<motors>
<motor>
<name>motor_fl</name>
<link>prop_fl</link>
<direction>clockwise</direction>
<thrust_coefficient>8.548e-6</thrust_coefficient>
<torque_coefficient>1e-5</torque_coefficient>
</motor>
<motor>
<name>motor_fr</name>
<link>prop_fr</link>
<direction>counter_clockwise</direction>
<thrust_coefficient>8.548e-6</thrust_coefficient>
<torque_coefficient>1e-5</torque_coefficient>
</motor>
<motor>
<name>motor_rl</name>
<link>prop_rl</link>
<direction>counter_clockwise</direction>
<thrust_coefficient>8.548e-6</thrust_coefficient>
<torque_coefficient>1e-5</torque_coefficient>
</motor>
<motor>
<name>motor_rr</name>
<link>prop_rr</link>
<direction>clockwise</direction>
<thrust_coefficient>8.548e-6</thrust_coefficient>
<torque_coefficient>1e-5</torque_coefficient>
</motor>
</motors>
<control>
<type>velocity</type>
<takeoff>true</takeoff>
<land>true</land>
</control>
</plugin>
</model>
</sdf>
<?xml version="1.0" ?>
<sdf version="1.11">
<model name="hexrotor">
<static>false</static>
<!-- 机身 -->
<link name="base_link">
<pose>0 0 0.08 0 0 0</pose>
<inertial>
<mass>3.0</mass>
<inertia>
<ixx>0.02</ixx><ixy>0</ixy><ixz>0</ixz>
<iyy>0.02</iyy><iyz>0</iyz>
<izz>0.04</izz>
</inertia>
</inertial>
<collision name="base_collision">
0.25 0.25 0.08
0.25 0.25 0.08
0.2 0.2 0.4 1
0.2 0.115 0.05 0 0 0
0.08
0.000200
0.00020
0.0002
0.02
0.025
base_link
motor_1
0 0 1
0.1 0.23 0.05 0 0 0
0.08
0.000200
0.00020
0.0002
0.02
0.025
base_link
motor_2
0 0 1
-0.1 0.23 0.05 0 0 0
0.08
0.000200
0.00020
0.0002
base_link
motor_3
0 0 1
-0.2 0.115 0.05 0 0 0
0.08
0.000200
0.00020
0.0002
base_link
motor_4
0 0 1
-0.2 -0.115 0.05 0 0 0
0.08
0.000200
0.00020
0.0002
base_link
motor_5
0 0 1
-0.1 -0.23 0.05 0 0 0
0.08
0.000200
0.00020
0.0002
base_link
motor_6
0 0 1
uav
motor_1clockwise1.2e-5
motor_2counter_clockwise1.2e-5
motor_3clockwise1.2e-5
motor_4counter_clockwise1.2e-5
motor_5clockwise1.2e-5
motor_6counter_clockwise1.2e-5
<!-- 空气阻力 -->
<gazebo reference="base_link">
<velocity_decay>
<linear>0.1</linear>
<angular>0.1</angular>
</velocity_decay>
</gazebo>
<!-- 螺旋桨气动参数 -->
<plugin filename="gz-sim-multirotor-physics-plugin" name="gz::sim::systems::MultirotorPhysics">
<!-- 推力系数 (N/(rad/s)^2) -->
<thrust_coefficient>8.548e-6</thrust_coefficient>
<!-- 扭矩系数 (Nm/(rad/s)^2) -->
<torque_coefficient>1e-5</torque_coefficient>
<!-- 电机时间常数 -->
<motor_time_constant>0.05</motor_time_constant>
<!-- 螺旋桨直径 (m) -->
<propeller_diameter>0.15</propeller_diameter>
<!-- 电机常数 -->
<motor_constant>2827.0</motor_constant>
</plugin>
<!-- 世界文件添加风力 -->
<?xml version="1.0" ?>
<sdf version="1.11">
<world name="windy_world">
<!-- 风力系统 -->
<plugin filename="gz-sim-wind-system" name="gz::sim::systems::Wind">
<frame_id>world</frame_id>
<namespace>wind</namespace>
<!-- 基础风向 (北偏东30度) -->
<direction>
<x>0.5</x>
<y>0.866</y>
<z>0</z>
</direction>
<!-- 基础风速 (m/s) -->
<magnitude>
<type>constant</type>
<value>5.0</value>
</magnitude>
<!-- 风速变化 (湍流) -->
<variation>
gaussian
0
1.5
2.0
5.0
3.0
1
0
0.2
pulse
3.0
8.0
<!-- 在无人机模型中添加风力响应 -->
<gazebo reference="base_link">
<!-- 风力扰动系数 -->
<wind>
<linear_drag>0.1</linear_drag>
<angular_drag>0.05</angular_drag>
</wind>
</gazebo>
<!-- 云台连接 -->
<link name="gimbal_link">
<pose>0 0 -0.05 0 0 0</pose>
<inertial>
<mass>0.3</mass>
<inertia>
<ixx>0.0001</ixx><ixy>0</ixy><ixz>0</ixz>
<iyy>0.0001</iyy><iyz>0</iyz>
<izz>0.0001</izz>
</inertia>
</inertial>
<visual name="gimbal_visual">
<geometry>
<box>
<size>0.08 0.06 0.04</size>
</box>
</geometry>
</visual>
< =>
0.08 0.06 0.04
base_link
gimbal_link
1 0 0
-1.57
1.57
gimbal_link
gimbal_camera_link
0 1 0
-3.14
3.14
<!-- 货物挂钩 -->
<link name="cargo_hook">
<pose>0 0 -0.15 0 0 0</pose>
<inertial>
<mass>0.1</mass>
</inertial>
<visual name="cargo_hook_visual">
<geometry>
<sphere>
<radius>0.02</radius>
</sphere>
</geometry>
</visual>
</link>
<joint name="cargo_hook_joint" type="fixed">
<parent>base_link</parent>
<child>cargo_hook</child>
</joint>
<!-- 向下测距传感器 -->
<link name="range_link">
<pose>0 0 -0.1 0 0 0</pose>
<sensor name="range" type="ray">
<update_rate>50</update_rate>
<ray>
<scan>
<horizontal>
<samples>1</samples>
<resolution>1</resolution>
</horizontal>
<vertical>
<samples>1</samples>
</vertical>
</scan>
<range>
<min>0.1</min>
<max>5.0</max>
<resolution>0.01</resolution>
</range>
</>
/uav
/range:=sensor/range
0 0.1 -0.02 0 0 0
30
0 0.06 0 0 0 0
1.047
640
480
0 -0.06 0 0 0 0
1.047
640
480
/uav
<!-- 垂直起降配置 -->
<plugin filename="gz-sim-multirotor-physics-plugin" name="gz::sim::systems::MultirotorPhysics">
<control>
<type>velocity</type>
<takeoff>
<vertical_speed>0.5</vertical_speed>
<takeoff_altitude>1.5</takeoff_altitude>
</takeoff>
<land>
<vertical_speed>0.3</vertical_speed>
<descent_angle>0.1</descent_angle>
</land>
</control>
</plugin>
解决方案:
解决方案:
解决方案:
基于 SOC 职业分类