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])
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.
The function accepts inputs in the range [0, 1] and internally maps them to the search domain [-pi, pi] for each joint angle (radians).
| 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 |
| Name | Type | Description |
|---|---|---|
| np.ndarray | np.ndarray: Cost values (Weighted sum of Distance + Penalty). Shape (n_samples,). |
| Name | Type | Description |
|---|---|---|
| ValueError | If input dimensions do not match 10. |
Single point evaluation:
array([60.85746763])
Batch evaluation: