control — Tension Controllers¶
The control package implements closed-loop line-tension regulation for the
2-DOF fishing arm. It maps measured tension (from sensors — Line Tension Sensing) to joint
trajectory commands consumed by position_trajectory_controller.
Source: software/src/control/control/
Python API: control
Parameters: bringup/config/params.yaml (keyed by node name)
Architecture¶
The package separates pure control math from ROS 2 I/O:
flowchart LR
subgraph core["fishing_control_core.py (pure Python)"]
ADM["AdmittanceControllerCore"]
FFB["ForceFeedbackControllerCore"]
SM["get_fishing_state()"]
end
subgraph ros["fishing_controller_node.py"]
BASE["FishingControllerBase"]
ADN["AdmittanceControllerNode"]
FFN["ForceFeedbackControllerNode"]
end
subgraph entry["entry points"]
E1["admittance_controller.py"]
E2["force_feedback_controller.py"]
end
E1 --> ADN
E2 --> FFN
ADN --> BASE
FFN --> BASE
ADN --> ADM
FFN --> FFB
ADM --> SM
FFB --> SM
Module |
Responsibility |
|---|---|
|
State machine, tension filtering, admittance & force-feedback algorithms (notebook ports) |
|
ROS subscriptions, safety checks, trajectory publishing, config loading |
|
Thin |
|
Thin |
|
Standalone open-loop sinusoid for motor validation (not launched by bringup) |
Executables¶
Command |
Node name |
Description |
|---|---|---|
|
|
Julie’s virtual admittance controller |
|
|
Chaoyi’s asymmetric P controller |
|
|
Manual motor sweep test |
Select at launch: controller_type:=admittance|force_feedback|none.
ROS 2 interfaces¶
Subscriptions¶
Topic |
Type |
Callback |
Purpose |
|---|---|---|---|
|
|
|
Measured line tension (N) |
|
|
|
Current |
Publications¶
Topic |
Type |
Content |
|---|---|---|
|
|
Position setpoints for active joints |
In 1-DOF mode (control_dof:=1, default), each trajectory point sets
Joint_1 = joint_1_hold (locked base yaw) and Joint_2 = pitch_cmd.
Control loop timing¶
FishingControllerBase runs a timer at control_rate_hz (default 50 Hz):
Safety gate — if no tension received yet, or
|tension| > safety_tension_limit, hold position (E-stop).State machine —
get_fishing_state(t)→MONITOR,HOOK_SET, orREGULATE.Tension filter — exponential smoothing (
tension_filter_alpha).Controller update — algorithm-specific; produces pitch command.
Publish —
JointTrajectorywith 100 ms horizon.
See the state machine diagram in Package Guide.
State machine¶
State |
Time window |
Behaviour |
|---|---|---|
|
|
Hold |
|
|
Smoothstep from |
|
thereafter |
Track |
Parameters bite_time, hook_duration, and angle setpoints (q_init, q_hook,
q_neutral, q_min, q_max) are shared between both controllers.
Admittance controller (Julie)¶
Class: AdmittanceControllerCore in fishing_control_core.py
Origin: scripts/mojocowithJulieController.ipynb
Virtual mass–spring–damper outer loop with a force–Jacobian mapping:
Compute force error
f_desired - f_measured.Estimate scalar Jacobian
∂(line length)/∂θ(geometry from TF when available, elserod_length * |cos θ|fallback for hardware).Virtual dynamics:
m_v θ̈ = τ_force + τ_spring - b_v θ̇.Integrate to
theta_cmd, clip to joint limits.Inner PD loop computes diagnostic torque (not sent directly —
position_trajectory_controllertracks position).
Key parameters: m_v, b_v, k_v, k_f, kp_track, kd_track, rod_length, j_alpha.
Force-feedback controller (Chaoyi)¶
Class: ForceFeedbackControllerCore
Origin: scripts/mojocowithchaoyi'scontroller.ipynb
Asymmetric proportional mapping from tension error to equilibrium pitch:
Below target (
tension_error < 0): raise rod with gainraise_gain.Above target: lower rod with gain
lower_gain.Output smoothed via
qeq_alphawith per-step limitmax_qeq_step.
Key parameters: tension_to_angle_gain, qeq_alpha, max_qeq_step, raise_gain, lower_gain.
Configuration loading¶
Parameters are declared in load_admittance_config() / load_force_feedback_config()
by iterating dataclass fields. The node name in launch (admittance_controller or
force_feedback_controller) must match the key in params.yaml:
admittance_controller:
ros__parameters:
target_tension: 3.5
...
force_feedback_controller:
ros__parameters:
target_tension: 3.5
...
Interactions¶
Upstream |
Provides measured tension and joint feedback |
|---|---|
|
Publishes |
|
Publishes |
Downstream |
Executes motion commands |
|
Subscribes to |
|
Selects which controller executable to launch; suppresses control during |
|
|
|
Imports |
Future: 2-DOF control¶
control_dof:=2 is declared but not yet implemented — the node logs a warning
and continues in 1-DOF pitch-only mode. The trajectory publisher already has a
stub code path for 2-DOF joint lists.