function.so.robot_arm_obstacle

function.so.robot_arm_obstacle(X)

10-Link Planar Robot Arm Inverse Kinematics with Obstacle Avoidance.

The goal is to minimize the distance of the end-effector to a target point while avoiding collision with a set of circular obstacles. This problem mimics a real-world inverse kinematics solver for a redundant manipulator.

Input Domain Handling

The function accepts inputs in the range [0, 1] and internally maps them to the search domain [-pi, pi] for each joint angle (radians).

Parameters

Name Type Description Default
X np.ndarray Input angles (normalized). - Shape (n_samples, 10). The input contains the normalized relative angles for the 10 links. required

Returns

Name Type Description
np.ndarray np.ndarray: Cost values (Weighted sum of Distance + Penalty). Shape (n_samples,).

Raises

Name Type Description
ValueError If input dimensions do not match 10.

Note

  • Target: (5.0, 5.0)
  • Obstacles:
    • Order 1: (2,2), r=1
    • Order 2: (4,3), r=1.5
    • Order 3: (3,6), r=1
  • Dimensions: 10 (fixed)
  • Search domain: [-pi, pi]^10 (mapped from [0, 1])
  • Characteristics: Multimodal, disjoint feasible regions, constrained.

Examples

Single point evaluation:

from spotoptim.function.so import robot_arm_obstacle
import numpy as np
rng = np.random.default_rng(42)
X = rng.random(10)  # Random angles in [0, 1]
robot_arm_obstacle(X)
array([60.85746763])

Batch evaluation:

from spotoptim.function.so import robot_arm_obstacle
import numpy as np
X = rng.random((5, 10))
robot_arm_obstacle(X).shape
(5,)