← 返回 Skills 市场
wu-uk

pid-controller

作者 wu-uk · GitHub ↗ · v0.1.0 · MIT-0
cross-platform ✓ 安全检测通过
102
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install adaptive-cruise-control-pid-controller
功能描述
Use this skill when implementing PID control loops for adaptive cruise control, vehicle speed regulation, throttle/brake management, or any feedback control...
使用说明 (SKILL.md)

PID Controller Implementation

Overview

A PID (Proportional-Integral-Derivative) controller is a feedback control mechanism used in industrial control systems. It continuously calculates an error value and applies a correction based on proportional, integral, and derivative terms.

Control Law

output = Kp * error + Ki * integral(error) + Kd * derivative(error)

Where:

  • error = setpoint - measured_value
  • Kp = proportional gain (reacts to current error)
  • Ki = integral gain (reacts to accumulated error)
  • Kd = derivative gain (reacts to rate of change)

Discrete-Time Implementation

class PIDController:
    def __init__(self, kp, ki, kd, output_min=None, output_max=None):
        self.kp = kp
        self.ki = ki
        self.kd = kd
        self.output_min = output_min
        self.output_max = output_max
        self.integral = 0.0
        self.prev_error = 0.0

    def reset(self):
        """Clear controller state."""
        self.integral = 0.0
        self.prev_error = 0.0

    def compute(self, error, dt):
        """Compute control output given error and timestep."""
        # Proportional term
        p_term = self.kp * error

        # Integral term
        self.integral += error * dt
        i_term = self.ki * self.integral

        # Derivative term
        derivative = (error - self.prev_error) / dt if dt > 0 else 0.0
        d_term = self.kd * derivative
        self.prev_error = error

        # Total output
        output = p_term + i_term + d_term

        # Output clamping (optional)
        if self.output_min is not None:
            output = max(output, self.output_min)
        if self.output_max is not None:
            output = min(output, self.output_max)

        return output

Anti-Windup

Integral windup occurs when output saturates but integral keeps accumulating. Solutions:

  1. Clamping: Limit integral term magnitude
  2. Conditional Integration: Only integrate when not saturated
  3. Back-calculation: Reduce integral when output is clamped

Tuning Guidelines

Manual Tuning:

  1. Set Ki = Kd = 0
  2. Increase Kp until acceptable response speed
  3. Add Ki to eliminate steady-state error
  4. Add Kd to reduce overshoot

Effect of Each Gain:

  • Higher Kp -> faster response, more overshoot
  • Higher Ki -> eliminates steady-state error, can cause oscillation
  • Higher Kd -> reduces overshoot, sensitive to noise
安全使用建议
This skill is coherent and appears safe from a permissions/credential perspective — it is a documentation/example-only PID implementation. Before using it in any real vehicle or safety-critical system, review and adapt the code for your platform: add sampling-rate handling, unit consistency, sensor noise filtering (e.g., derivative filtering), robust anti-windup, saturation-safe integration, bounds and failsafes, thread/real-time considerations, testing (unit, HIL, SIL), and safety validation. The SKILL.md contains no hidden network calls or credential requests, but treat the code as a starting point, not a certified production controller.
功能分析
Type: OpenClaw Skill Name: adaptive-cruise-control-pid-controller Version: 0.1.0 The skill bundle provides a standard, textbook implementation of a PID (Proportional-Integral-Derivative) controller in Python within SKILL.md. The code is purely mathematical, focusing on control loop logic for vehicle speed regulation or similar feedback systems, and contains no network calls, file system access, or instructions that could be interpreted as prompt injection or malicious behavior.
能力评估
Purpose & Capability
The name/description (PID controller for vehicle control and feedback systems) aligns with the provided content: a conceptual overview, discrete-time implementation in Python, anti-windup approaches, and tuning guidance. Nothing requested or described is extraneous to implementing a PID controller.
Instruction Scope
SKILL.md contains only explanatory text and a self-contained Python class; it does not instruct the agent to read files, call external services, or access environment variables. Note: the document is example code and lacks production-safety guidance (e.g., sensor filtering, unit conventions, real-time constraints, verification) which is important for safety-critical vehicle deployment.
Install Mechanism
This is an instruction-only skill with no install spec, no downloads, and no code files beyond SKILL.md — minimal disk/write risk.
Credentials
No environment variables, credentials, or config paths are requested. The skill does not require any unrelated secrets or external service access.
Persistence & Privilege
The skill does not request persistent/system-level privileges and always:false. It does not modify other skills or system settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install adaptive-cruise-control-pid-controller
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /adaptive-cruise-control-pid-controller 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
Bulk register from skillsbench tasks.
元数据
Slug adaptive-cruise-control-pid-controller
版本 0.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

pid-controller 是什么?

Use this skill when implementing PID control loops for adaptive cruise control, vehicle speed regulation, throttle/brake management, or any feedback control... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 102 次。

如何安装 pid-controller?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install adaptive-cruise-control-pid-controller」即可一键安装,无需额外配置。

pid-controller 是免费的吗?

是的,pid-controller 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

pid-controller 支持哪些平台?

pid-controller 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 pid-controller?

由 wu-uk(@wu-uk)开发并维护,当前版本 v0.1.0。

💬 留言讨论