Skip to content

Workspace Visualization

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

# Define workspace limits (in meters)
reach_min = 0.3
reach_max = 1.3

# Generate 2D ring section in the XZ plane
angles = np.linspace(0, np.pi, 180)
radii = np.linspace(reach_min, reach_max, 100)
plane_points = []

for r in radii:
for a in angles:
x = r * np.cos(a)
z = r * np.sin(a)
plane_points.append([x, 0, z])
plane_points = np.array(plane_points)

# Revolve around Z axis to build 3D workspace
workspace = []
for theta in np.linspace(0, 2*np.pi, 180):
R = np.array([
[np.cos(theta), -np.sin(theta), 0],
[np.sin(theta), np.cos(theta), 0],
[0, 0, 1]
])
rotated = plane_points @ R.T
workspace.extend(rotated)

workspace = np.array(workspace)

# Plot
fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(111, projection='3d')
ax.scatter(workspace[:, 0], workspace[:, 1], workspace[:, 2], s=0.5, alpha=0.6)
ax.set_title("UR10e Approximated Reachable Workspace")
ax.set_xlabel("X [m]")
ax.set_ylabel("Y [m]")
ax.set_zlabel("Z [m]")
ax.set_box_aspect([1, 1, 1])
plt.tight_layout()
plt.show()


Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.