<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Assist-as-Needed on Mahdi Sarfarazi</title>
    <link>https://mahdisf.github.io/tags/assist-as-needed/</link>
    <description>Recent content in Assist-as-Needed on Mahdi Sarfarazi</description>
    <image>
      <title>Mahdi Sarfarazi</title>
      <url>https://mahdisf.github.io/images/papermod-cover.png</url>
      <link>https://mahdisf.github.io/images/papermod-cover.png</link>
    </image>
    <generator>Hugo</generator>
    <language>en</language>
    <copyright>©2026 - Mahdi Sarfarazi</copyright>
    <lastBuildDate>Sat, 23 Aug 2025 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://mahdisf.github.io/tags/assist-as-needed/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Fuzzy Assist-as-Needed Control for the FUM-NEXA Knee Exoskeleton</title>
      <link>https://mahdisf.github.io/projects/fuzzy-aan-knee-exoskeleton/</link>
      <pubDate>Sat, 23 Aug 2025 00:00:00 +0000</pubDate>
      <guid>https://mahdisf.github.io/projects/fuzzy-aan-knee-exoskeleton/</guid>
      <description>Real-time ROS2 and CAN control for a knee exoskeleton that adapts sit-to-stand assistance to measured user motion.</description>
      <content:encoded><![CDATA[<h2 id="executive-summary">Executive summary</h2>
<p>I served as project manager and first author for the FUM-NEXA sit-to-stand control project at FUM-CARE. The engineering problem was specific: provide enough torque for a user to complete a sit-to-stand (STS) transition without replacing the user&rsquo;s contribution or requiring a high-power, sensor-heavy system. I led the development of a fuzzy Assist-As-Needed (AAN) controller that estimates a real-time Strength Index from hip and knee velocity errors plus torque feedback, then scales the desired knee torque accordingly. The controller was deployed on a custom exoskeleton through a Raspberry Pi 4B, ROS2, and CAN motor interfaces. In the reported engineering evaluation, four healthy subjects performed STS transfers at three speeds. With the 50% assistance setting, average EMG IRMS reduction relative to the no-exoskeleton baseline was 30.34% at slow speed, 13.20% at normal speed, and 7.59% at fast speed. These results support prototype feasibility and a clear speed-dependent trade-off; they do not constitute clinical validation.</p>
<h2 id="project-snapshot">Project snapshot</h2>
<table>
	<thead>
			<tr>
					<th>Dimension</th>
					<th>Evidence-based summary</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>Product</td>
					<td>FUM-NEXA lower-limb exoskeleton with one passive hip joint and one actuated knee joint per leg</td>
			</tr>
			<tr>
					<td>User task</td>
					<td>Sit-to-stand transition from a 46 cm chair</td>
			</tr>
			<tr>
					<td>Control concept</td>
					<td>Fuzzy Strength Index driving Assist-As-Needed torque</td>
			</tr>
			<tr>
					<td>Runtime platform</td>
					<td>Raspberry Pi 4B, ROS2, Python/C++, and CAN</td>
			</tr>
			<tr>
					<td>Evaluation</td>
					<td>Four healthy subjects, three movement speeds, and three device conditions</td>
			</tr>
			<tr>
					<td>Research status</td>
					<td>Manuscript prepared for consideration by <em>Robotics and Autonomous Systems</em> in August 2025; acceptance or publication was not present in the supplied evidence</td>
			</tr>
	</tbody>
</table>
<h2 id="problem-and-challenge">Problem and challenge</h2>
<p>Fixed torque profiles are simple to deploy, but they cannot distinguish a user who is moving faster than the reference from one who needs substantial assistance. A rehabilitation device also has to avoid the opposite failure mode: applying so much torque that the user becomes passive. The project therefore had to satisfy several constraints at the same time:</p>
<ul>
<li>estimate assistance need from signals available on the robot rather than relying on continuous EMG control;</li>
<li>adapt torque during the movement, not only between sessions;</li>
<li>run on a Raspberry Pi-class computer with a small sensor and actuator stack;</li>
<li>trigger assistance at the correct point in the STS sequence, close to chair lift-off;</li>
<li>measure whether the device actually reduces human effort after accounting for the mass and inertia of the unpowered exoskeleton.</li>
</ul>
<p>The last constraint mattered in the experiments. Wearing FUM-NEXA without torque increased measured muscle effort relative to the no-exoskeleton baseline. The product value therefore depends on the controller offsetting the mechanical burden of the device, not merely on the controller producing a plausible torque curve.</p>
<h2 id="my-role-and-responsibilities">My role and responsibilities</h2>
<p>The supplied accomplishment record identifies me as project manager and main author, and the manuscript lists me as first author. The available code and project documents indicate hands-on responsibility across the following workstreams:</p>
<ul>
<li><strong>Control ownership:</strong> defined and implemented the fuzzy Strength Index concept, membership functions, nine-rule inference base, and torque-scaling policy.</li>
<li><strong>Robotic software integration:</strong> connected the controller to ROS2 data and motor paths, CAN-based sensors and actuators, real-time filtering, and data logging.</li>
<li><strong>System coordination:</strong> coordinated the control, mechanical, experiment, and manuscript work needed to move the idea from a research concept to a working FUM-NEXA prototype.</li>
<li><strong>Validation planning:</strong> helped structure the no-exoskeleton, exoskeleton-without-torque, and exoskeleton-with-AAN conditions across slow, normal, and fast STS profiles.</li>
<li><strong>Technical communication:</strong> first-authored the manuscript, figures, results narrative, and submission package.</li>
</ul>
<p>This was a team research project at FUM-CARE. The materials do not support claiming that I was the sole designer, fabricator, or experimenter.</p>
<h2 id="key-technologies-and-stack">Key technologies and stack</h2>
<ul>
<li><strong>Robot:</strong> custom FUM-NEXA knee exoskeleton; two T-Motor BLDC knee actuators rated up to 48 Nm in the manuscript; magnetic joint encoders.</li>
<li><strong>Compute and middleware:</strong> Raspberry Pi 4B and ROS2.</li>
<li><strong>Software:</strong> Python, C++, NumPy, SciPy, and scikit-fuzzy.</li>
<li><strong>Communication:</strong> CAN for sensor acquisition and motor commands; SocketCAN in the inspected C++ motor and CAN-reader nodes.</li>
<li><strong>Control layers:</strong> high-level fuzzy AAN controller and a lower-level PID torque controller on the motor driver.</li>
<li><strong>Evaluation:</strong> EMG recordings from Vastus Lateralis, Semimembranosus, and Hamstrings; IRMS, standard deviation, and a relative performance index.</li>
</ul>
<h2 id="solution-and-implementation">Solution and implementation</h2>
<h3 id="1-convert-movement-quality-into-a-strength-index">1. Convert movement quality into a Strength Index</h3>
<p>The controller represents the user&rsquo;s instantaneous ability with a scalar <code>I_s</code> in the range 0 to 1. The assistance policy is:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">assistive torque = desired torque * (1 - I_s)
</span></span></code></pre></div><p>When the measured motion and torque behavior indicate that the user is keeping up with the reference, <code>I_s</code> increases and assistance falls. When the user lags the reference or the robot is not delivering the expected torque, <code>I_s</code> decreases and the controller provides more help.</p>
<p>The fuzzy system uses three inputs:</p>
<ol>
<li>knee angular-velocity error;</li>
<li>hip angular-velocity error; and</li>
<li>the difference between desired and assistive torque.</li>
</ol>
<p>Each input is mapped to Negative, Zero, or Positive fuzzy sets. The output uses five assistance/strength bands. A nine-rule Mamdani inference system combines the inputs; rule firing uses the minimum membership value and the final crisp index uses centroid defuzzification. This gives the controller a compact rule base instead of a large learned model or a continuous EMG classifier.</p>
<h3 id="2-track-a-normal-sts-trajectory-without-hard-coding-one-users-motion">2. Track a normal STS trajectory without hard-coding one user&rsquo;s motion</h3>
<p>The desired hip and knee velocity profiles are sixth-degree polynomials fitted to 20 normal STS transfer shapes from able-bodied data. A normalized knee torque-angle profile supplies the full-assistance reference. The fuzzy index scales that reference rather than replacing it, so the controller retains a consistent movement target while changing the amount of help.</p>
<h3 id="3-trigger-assistance-from-the-sts-phase">3. Trigger assistance from the STS phase</h3>
<p>The manuscript divides STS into flexion, transition, extension, and stabilization phases. Assistance starts near lift-off from the chair. The reported trigger criterion uses the combination of stable knee motion and the hip velocity/acceleration pattern observed immediately before lift-off; analysis of 20 STS transfers was used to identify this event.</p>
<p><img alt="STS phases and the assistance trigger point" loading="lazy" src="/projects/fuzzy-aan-knee-exoskeleton/sts-trigger-phases.jpg"></p>
<p><em>The four STS phases and the reported trigger point near chair lift-off.</em></p>
<h3 id="4-run-the-loop-on-the-robot">4. Run the loop on the robot</h3>
<p>The runtime architecture separates four functional responsibilities:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">CAN sensor data
</span></span><span class="line"><span class="cl">      |
</span></span><span class="line"><span class="cl">      v
</span></span><span class="line"><span class="cl">filter joint velocity and torque signals
</span></span><span class="line"><span class="cl">      |
</span></span><span class="line"><span class="cl">      v
</span></span><span class="line"><span class="cl">compute motion/torque errors
</span></span><span class="line"><span class="cl">      |
</span></span><span class="line"><span class="cl">      v
</span></span><span class="line"><span class="cl">fuzzy Strength Index -&gt; scale desired torque
</span></span><span class="line"><span class="cl">      |
</span></span><span class="line"><span class="cl">      v
</span></span><span class="line"><span class="cl">motor-driver PID -&gt; CAN -&gt; knee BLDC actuators
</span></span><span class="line"><span class="cl">      |
</span></span><span class="line"><span class="cl">      v
</span></span><span class="line"><span class="cl">log sensor, motor, and controller data
</span></span></code></pre></div><p>The implementation source contains a Python fuzzy controller and C++ ROS2 nodes for CAN reading and motor commands. Its real-time filters are second-order Butterworth filters configured with a 400 Hz sampling assumption: 5 Hz for hip velocity and 10 Hz for knee velocity and torque feedback. That configuration is an implementation detail, not a claim that every end-to-end path was measured at 400 Hz.</p>
<p><img alt="ROS2 control architecture" loading="lazy" src="/projects/fuzzy-aan-knee-exoskeleton/ros2-architecture.svg"></p>
<p><em>Functional ROS2 architecture used for sensor acquisition, fuzzy control, motor commands, and logging.</em></p>
<h2 id="experimental-design">Experimental design</h2>
<p>The reported evaluation used four healthy subjects, a 46 cm chair, and three target speeds:</p>
<ul>
<li>slow: 20 deg/s;</li>
<li>normal: 35 deg/s;</li>
<li>fast: 60 deg/s.</li>
</ul>
<p>Each subject completed three conditions:</p>
<ol>
<li><strong>No Exo:</strong> baseline STS without the device.</li>
<li><strong>Exo Without Torque:</strong> the device was worn but delivered no assistive torque.</li>
<li><strong>Exo With Torque:</strong> the AAN controller was enabled with the 50% assistance setting.</li>
</ol>
<p>The primary analysis used EMG IRMS as a measure of aggregate muscle effort and signal standard deviation as a variability measure. The manuscript defines the performance index as the percentage change from the No Exo baseline; positive values mean lower measured effort and negative values mean higher effort.</p>
<h2 id="results-and-impact">Results and impact</h2>
<p>The following values are the manuscript&rsquo;s averages across the four subjects. They are percentage changes relative to No Exo, not clinical effect sizes.</p>
<table>
	<thead>
			<tr>
					<th>Condition</th>
					<th>Speed</th>
					<th style="text-align: right">IRMS change</th>
					<th style="text-align: right">SD change</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>Exo With Torque</td>
					<td>Slow</td>
					<td style="text-align: right">30.34% reduction</td>
					<td style="text-align: right">33.81% reduction</td>
			</tr>
			<tr>
					<td>Exo With Torque</td>
					<td>Normal</td>
					<td style="text-align: right">13.20% reduction</td>
					<td style="text-align: right">16.45% reduction</td>
			</tr>
			<tr>
					<td>Exo With Torque</td>
					<td>Fast</td>
					<td style="text-align: right">7.59% reduction</td>
					<td style="text-align: right">14.10% reduction</td>
			</tr>
			<tr>
					<td>Exo Without Torque</td>
					<td>Slow</td>
					<td style="text-align: right">41.21% increase</td>
					<td style="text-align: right">30.09% increase</td>
			</tr>
			<tr>
					<td>Exo Without Torque</td>
					<td>Normal</td>
					<td style="text-align: right">38.70% increase</td>
					<td style="text-align: right">36.17% increase</td>
			</tr>
			<tr>
					<td>Exo Without Torque</td>
					<td>Fast</td>
					<td style="text-align: right">40.87% increase</td>
					<td style="text-align: right">42.53% increase</td>
			</tr>
	</tbody>
</table>
<p><img alt="AAN torque compared with the full desired torque profile" loading="lazy" src="/projects/fuzzy-aan-knee-exoskeleton/aan-torque-profile.png"></p>
<p><em>The AAN torque follows the desired profile shape at a lower magnitude across slow, fast, and normal STS speeds.</em></p>
<p>The main product and engineering conclusions are:</p>
<ul>
<li>the assistance setting reduced measured effort at all three tested speeds;</li>
<li>the largest average reduction occurred at slow speed, where assistance is most relevant to users who cannot generate the reference motion easily;</li>
<li>the benefit weakened at fast speed, so &ldquo;adaptive&rdquo; does not mean equally effective in every movement regime;</li>
<li>the passive mechanical load was large enough to increase effort when torque was disabled, making the no-torque control condition essential;</li>
<li>the torque trace behaved as intended qualitatively, but the supplied manuscript does not report latency, confidence intervals, statistical significance, actuator safety margins, or long-term reliability.</li>
</ul>
<p><img alt="Processed EMG examples across speeds and device conditions" loading="lazy" src="/projects/fuzzy-aan-knee-exoskeleton/emg-results.png"></p>
<p><em>Processed Vastus Lateralis EMG examples for the nine speed/condition combinations reported in the manuscript.</em></p>
<blockquote>
<p><strong>Scope limitation:</strong> the experiment involved four healthy subjects. The paper uses labels such as &ldquo;low-strength&rdquo; and &ldquo;moderate-strength&rdquo; for controller output categories, but the tested group was not a clinical cohort of elderly, post-stroke, or mobility-impaired participants. The results should therefore be presented as an engineering prototype evaluation, not as proof of rehabilitation efficacy.</p>
</blockquote>
<h2 id="key-learnings-and-takeaways">Key learnings and takeaways</h2>
<ol>
<li><strong>Assistance is a control policy, not a constant torque value.</strong> Estimating the user&rsquo;s current tracking ability makes the same hardware useful across different movement capabilities.</li>
<li><strong>The mechanical baseline matters.</strong> A wearable robot can increase effort before its controller helps; product evaluation must isolate the device burden from the controller benefit.</li>
<li><strong>Trigger timing is a product requirement.</strong> A correct torque magnitude delivered at the wrong STS phase is still a poor user experience and can destabilize the movement.</li>
<li><strong>Low-power deployment changes the design.</strong> A compact fuzzy rule base, filtered kinematic signals, and a Raspberry Pi/ROS2 stack are practical when compute, sensing, and wiring are constrained.</li>
<li><strong>The next validation step is not another plot from the same cohort.</strong> The project needs larger and more diverse participants, comfort and safety measures, latency and repeatability data, and longer-term evaluation before making rehabilitation or clinical claims.</li>
</ol>
<h2 id="visuals-to-add-next">Visuals to add next</h2>
<p>The supplied manuscript provides the architecture, trigger, torque, and EMG figures embedded above. A stronger public case study would add:</p>
<ul>
<li>a short, consented video showing the three experimental conditions;</li>
<li>a system-level timing diagram with sensor-to-actuator latency and fault handling;</li>
<li>an anonymized aggregate results plot with uncertainty intervals and per-subject points;</li>
<li>a public repository or reproducible package, if the team decides to release one.</li>
</ul>
<p>No public source-code, demo-video, or acceptance link was present in the supplied project files, so none is fabricated here.</p>
<h2 id="publication-and-project-status">Publication and project status</h2>
<p>The available package contains a manuscript and cover letter dated August 2025 that were prepared for submission to <em>Robotics and Autonomous Systems</em>. It does not contain evidence of acceptance, publication, or a public DOI. The October 2023 start date reflects the earliest dated project report found, not a formal project kickoff. The inspected implementation files also include experiment-specific constants, so this page describes a working research prototype rather than claiming production-release maturity.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
