|
| 1 | +# Hector Ros Controllers |
| 2 | + |
| 3 | +A set of ROS 2 controllers focused on **safety**, **self-collision avoidance**, and **safe position command handling**. |
| 4 | +All controllers are compatible with **ros2_control** and can be inserted as **chain controllers**. |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +## 1. Safety Forward Controller |
| 9 | + |
| 10 | +Forwards incoming commands, but **resets the command to zero** if no message is received within a configured timeout. |
| 11 | +Useful for teleoperation and autonomy if the communication is unreliable or in case of node failures. |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## 2. Self Collision Avoidance Controller |
| 16 | + |
| 17 | +Monitors joint states and **prevents the robot from moving into a configuration close to self-collision**. |
| 18 | +Acts as a motion gatekeeper in real-time. |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## 3. Safety Position Controller |
| 23 | + |
| 24 | +A **chainable safety layer** for joint position commands. |
| 25 | + |
| 26 | +### Features |
| 27 | + |
| 28 | +* **Continuous joints unwrapped** to nearest equivalent angle. |
| 29 | +* **Joint limits enforced** directly from URDF. |
| 30 | +* **Target-only self-collision check** (Pinocchio + hpp-fcl). |
| 31 | +* **Block-if-too-far:** prevents large unsafe jumps and makes collision checking meaningful. |
| 32 | +* Optional **compliant / stiff current limiting** per joint. |
| 33 | + |
| 34 | +### Collision Checking Limitation - target-only collision checking |
| 35 | + |
| 36 | +If used **behind a trajectory controller**, target updates are **small steps**, so checking only the target pose is sufficient when using a **small collision padding**. |
| 37 | + |
| 38 | +If the parent controller is a raw position controller (large jumps), **block-if-too-far** ensures targets stay close → prevents missing intermediate collisions. |
| 39 | + |
| 40 | +**Future improvement:** continuous / path collision checking. |
| 41 | + |
| 42 | + |
| 43 | +## Parameters (Safety Position Controller) |
| 44 | + |
| 45 | +| Parameter | Type | Default | Description | |
| 46 | +| ---------------------------------- | ---------- | ---------- | ---------------------------------------------------------------------------------------------------- | |
| 47 | +| `joints` | `string[]` | `[]` | Names of joints controlled. Must match URDF. *(read-only)* | |
| 48 | +| `unwrap_continuous_joints` | `bool` | `true` | Unwrap continuous joints to maintain continuity in commanded angle. | |
| 49 | +| `enforce_position_limits` | `bool` | `true` | Clamp joint commands to URDF limits. | |
| 50 | +| `check_self_collisions` | `bool` | `true` | Run self-collision check on the **target** pose before sending commands. | |
| 51 | +| `collision_padding` | `double` | `0.0` | Minimum allowed link-to-link distance [m] — distances ≤ padding count as collision. | |
| 52 | +| `collision_cache_epsilon` | `double` | `0.000001` | Threshold for reusing last collision check result (skip compute if target change is small). | |
| 53 | +| `block_if_too_far` | `bool` | `true` | Blocks commands that are too far from current state. Auto-enabled if `check_self_collisions = true`. | |
| 54 | +| `block_velocity_scaling` | `double` | `1.5` | Scales maximum per-cycle motion: blocked if ` | |
| 55 | +| `debug_visualize_collisions` | `bool` | `false` | Publishes collision debug markers for RViz. | |
| 56 | +| `set_current_limits` | `bool` | `false` | Enables per-joint current limit control. *(read-only)* | |
| 57 | +| `current_limits.*.compliant_limit` | `double` | `3.0` | Current limit in **compliant** mode [A]. | |
| 58 | +| `current_limits.*.stiff_limit` | `double` | `5.0` | Current limit in **stiff** mode [A]. | |
| 59 | + |
| 60 | +> Note: When using dynamic reconfigure to change the parameters the controller must be deactivated and reactivated for changes to take effect! |
| 61 | +
|
| 62 | + |
| 63 | +## Example Configuration |
| 64 | + |
| 65 | +```yaml |
| 66 | +/**: |
| 67 | + controller_manager: |
| 68 | + ros__parameters: |
| 69 | + update_rate: 50 |
| 70 | + |
| 71 | + joint_state_broadcaster: |
| 72 | + type: joint_state_broadcaster/JointStateBroadcaster |
| 73 | + |
| 74 | + arm_trajectory_controller: |
| 75 | + type: joint_trajectory_controller/JointTrajectoryController |
| 76 | + |
| 77 | + arm_safety_position_controller: |
| 78 | + type: safety_position_controller/SafetyPositionController |
| 79 | + |
| 80 | + arm_safety_position_controller: |
| 81 | + ros__parameters: |
| 82 | + joints: [arm_joint_1, arm_joint_2, arm_joint_3, arm_joint_4, arm_joint_5, arm_joint_6, arm_joint_7] |
| 83 | + unwrap_continuous_joints: true |
| 84 | + enforce_position_limits: true |
| 85 | + check_self_collisions: true |
| 86 | + collision_padding: 0.01 |
| 87 | + debug_visualize_collisions: false |
| 88 | + block_velocity_scaling: 3.0 |
| 89 | + set_current_limits: true |
| 90 | + current_limits: |
| 91 | + arm_joint_1: {compliant_limit: 3.0, stiff_limit: 9.0} |
| 92 | + arm_joint_2: {compliant_limit: 5.0, stiff_limit: 9.0} |
| 93 | + arm_joint_3: {compliant_limit: 5.0, stiff_limit: 9.0} |
| 94 | + arm_joint_4: {compliant_limit: 3.0, stiff_limit: 4.9} |
| 95 | + arm_joint_5: {compliant_limit: 2.5, stiff_limit: 5.5} |
| 96 | + arm_joint_6: {compliant_limit: 0.5, stiff_limit: 3.5} |
| 97 | + arm_joint_7: {compliant_limit: 0.5, stiff_limit: 3.5} |
| 98 | + |
| 99 | + arm_trajectory_controller: |
| 100 | + ros__parameters: |
| 101 | + joints: [arm_joint_1, arm_joint_2, arm_joint_3, arm_joint_4, arm_joint_5, arm_joint_6, arm_joint_7] |
| 102 | + command_joints: |
| 103 | + - arm_safety_position_controller/arm_joint_1 |
| 104 | + - arm_safety_position_controller/arm_joint_2 |
| 105 | + - arm_safety_position_controller/arm_joint_3 |
| 106 | + - arm_safety_position_controller/arm_joint_4 |
| 107 | + - arm_safety_position_controller/arm_joint_5 |
| 108 | + - arm_safety_position_controller/arm_joint_6 |
| 109 | + - arm_safety_position_controller/arm_joint_7 |
| 110 | + command_interfaces: [position] |
| 111 | + state_interfaces: [position, velocity] |
| 112 | +``` |
0 commit comments