用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/MIUAV/vibe-coding-ros2 --skill motion-control命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | motion-control |
| description | 机械臂运动控制 - 逆运动学、轨迹规划、力控、协作控制 |
| argument-hint | 机械臂控制 OR 轨迹规划 OR 力控 OR 协作 |
| user-invocable | true |
用于开发机械臂的运动控制和规划系统
当需要以下帮助时使用此技能:
manipulator_control:
# 控制模式
mode: position / velocity / torque / hybrid
# 轨迹参数
trajectory:
max_velocity: 1.0 # m/s
max_acceleration: 2.0 # m/s²
planner: OMPL / CHOMP
# 力控
force_control:
stiffness: 1000.0 # N/m
damping: 50.0 # N*s/m
class NumericalIK:
def __init__(self, link_lengths):
self.links = link_lengths
self.max_iterations = 100
self.tolerance = 1e-4
def solve(self, target_pose, initial_joints=None):
"""数值迭代求解 IK"""
if initial_joints is None:
joints = np.zeros(len(self.links))
for i in range(self.max_iterations):
# 正运动学
current_pose = self.forward_kinematics(joints)
# 误差
error = target_pose - current_pose
if np.linalg.norm(error) < self.tolerance:
return joints
# 雅可比
J = self.compute_jacobian(joints)
# 关节增量
delta_joints = np.linalg.pinv(J) @ error
joints += delta_joints
return joints # 可能未收敛
class TrajectoryPlanner:
def __init__(self):
self.velocity_limits = np.array([1.0, 1.0, 1.5, 1.5, 2.0, 2.0]) # rad/s
self.acceleration_limits = np.array([2.0, 2.0, 3.0, 3.0, 4.0, 4.0])
def plan(self, waypoints):
"""时间最优轨迹规划"""
# 1. 空间轨迹 (样条插值)
spatial = self.spatial_interpolation(waypoints)
# 2. 时间最优分配
temporal = self.time_optimization(spatial)
return temporal
def compute_torque(self, trajectory):
"""计算所需扭矩"""
torques = []
for t in trajectory:
q, qd, qdd = trajectory.sample(t)
tau = self.inertia_matrix(q) @ qdd + self.coriolis(q, qd) + self.gravity(q)
torques.append(tau)
return np.array(torques)
class ImpedanceController:
def __init__(self, M, B, K):
# 惯性、阻尼、刚度矩阵
self.M = np.diag(M)
self.B = np.diag(B)
self.K = np.diag(K)
def compute_torque(self, error, error_dot, error_ddot):
"""阻抗控制扭矩"""
# M * (error_ddot - desired_ddot) + B * error_dot + K * error
tau = self.M @ error_ddot + self.B @ error_dot + self.K @ error
# 添加重力补偿
tau += self.gravity_compensation()
return tau
./manipulator/perception/SKILL.md - 感知系统./manipulator/localization/SKILL.md - 定位系统./manipulator/skill-planning/SKILL.md - 技能规划