<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: pack petter</title>
    <description>The latest articles on DEV Community by pack petter (@pack_petter_73cbede229ec2).</description>
    <link>https://dev.to/pack_petter_73cbede229ec2</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4262780%2Fabc58211-6776-4b35-8c83-2c5f803610f0.webp</url>
      <title>DEV Community: pack petter</title>
      <link>https://dev.to/pack_petter_73cbede229ec2</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pack_petter_73cbede229ec2"/>
    <language>en</language>
    <item>
      <title>I benchmarked 5 ways to auto-tune a robot arm's PID gains. Random search broke the safety limits in 73.8% of trials. Safe BO: 1.8%.</title>
      <dc:creator>pack petter</dc:creator>
      <pubDate>Tue, 24 Nov 2026 13:34:22 +0000</pubDate>
      <link>https://dev.to/pack_petter_73cbede229ec2/i-benchmarked-5-ways-to-auto-tune-a-robot-arms-pid-gains-random-search-broke-the-safety-limits-in-njj</link>
      <guid>https://dev.to/pack_petter_73cbede229ec2/i-benchmarked-5-ways-to-auto-tune-a-robot-arms-pid-gains-random-search-broke-the-safety-limits-in-njj</guid>
      <description>&lt;p&gt;Hand-tuning PID gains is slow, and every payload change means starting over. Letting an optimiser explore on the real machine is tempting — but a "trial" there isn't a wasted data point, it's a torque spike into a joint limit. So I built a small testbed to ask a simple question: how much does safety-aware optimisation actually buy you?&lt;/p&gt;

&lt;p&gt;Setup: a simulated two-link arm (friction, torque limits, noisy 16-bit encoder, control delay), an industrial-style 500 Hz PID with anti-windup, and six gains to tune. Five methods, same budget, 20 independent runs each:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Random search — 73.8% of trials unsafe&lt;/li&gt;
&lt;li&gt;Standard BO (EI) — 36.8% unsafe&lt;/li&gt;
&lt;li&gt;CMA-ES — 12.7% unsafe&lt;/li&gt;
&lt;li&gt;Safe BO (GP models of both performance &lt;em&gt;and&lt;/em&gt; safety; only confidently-safe gains ever get tested) — &lt;strong&gt;1.8% unsafe&lt;/strong&gt;, and still ends within 4.1% of the reference optimum after 50 trials&lt;/li&gt;
&lt;li&gt;Contextual Safe BO — for payload changes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two results I didn't expect:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The tuned controller halves RMS tracking error vs. commissioning gains (1.12° → 0.60°) &lt;em&gt;without&lt;/em&gt; adding torque ripple. Safety didn't cost performance here; it mostly cost patience.&lt;/li&gt;
&lt;li&gt;Payload changes (1.0 → 2.5 → 1.75 → 0.5 → 2.0 kg): re-using past experiments as context gets within 13–17% of optimum with 10 trials per change, vs 18–29% for a cold start. After just 3 trials in later stages it's at 20–25% vs 44–50%. Warm-starting is worth more than a smarter acquisition function, at least here.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Honest limits: this is simulation only. No backlash, no flexible joints, no real hardware. The GP is written from scratch (Matérn-5/2 ARD) and cross-checked against scikit-learn, mostly because I wanted to see the safety logic without a library in between.&lt;/p&gt;

&lt;p&gt;If you want to reproduce or poke holes in it: I packaged the full project — code, raw results for every run, tuning handbook, tests — as a curated edition here: &lt;a href="https://gridlabnotes.gumroad.com/l/teusxx" rel="noopener noreferrer"&gt;https://gridlabnotes.gumroad.com/l/teusxx&lt;/a&gt; (full disclosure: that's my shop; it's how I fund spending more time on write-ups like this).&lt;/p&gt;

&lt;p&gt;Curious whether anyone running SafeOpt-style methods on real hardware sees the same "warm start &amp;gt; acquisition function" ordering.&lt;/p&gt;

</description>
      <category>robotics</category>
      <category>python</category>
      <category>machinelearning</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
