No real UR5e run exists: this arm is MuJoCo Menagerie's UR5e model under its own PD position servos (website/ur5e_sim.py), following a joint-space pick-and-place at three speeds, as shipped and with model feed-forward. It shows a six-joint arm going in as plain robot_msgs streams.
The code, as it ran (1.0 s)
One script, top to bottom, run from a clone's root: each step continues the one before
it. It needs pip install mujoco and MuJoCo Menagerie: set MENAGERIE to a mujoco_menagerie clone, or pip install robot_descriptions, which fetches it. Nothing private.
1. what goes in: robot_msgs streams
SIMULATED. MuJoCo Menagerie's UR5e follows a joint-space pick-and-place under its own PD position servos. The arrays become robot_msgs streams, and the streams a Run.
import sys
sys.path.insert(0, "website") # website/ur5e_sim.py, in a clone of this repo
import ur5e_sim # MuJoCo + Menagerie's UR5e (pip install mujoco)
from robot_msgs.trajectory import JointTrajectory, PoseTrajectory
from robot_metrics import DEGREES, Alias, Collection, Objective, Run
from robot_metrics import StopStat, TimeOffset, View, catalog, summarize
from robot_metrics.views import plot
sim = ur5e_sim.simulate(speed=1.0, controller="pd") # numpy arrays from MuJoCo
sim.t.shape
(980,)
sim.target_q.shape
(980, 6)
target = JointTrajectory(
t=sim.t, joint_names=ur5e_sim.JOINTS, positions=sim.target_q, velocities=sim.target_qd
)
state = JointTrajectory(
t=sim.t, joint_names=ur5e_sim.JOINTS, positions=sim.state_q, velocities=sim.state_qd
)
flange = "flange"
tool_target = PoseTrajectory.from_matrices(sim.t, sim.target_flange, child_frame_id=flange)
tool_state = PoseTrajectory.from_matrices(sim.t, sim.state_flange, child_frame_id=flange)
streams = {
"target": target,
"state": state,
"tool/target": tool_target,
"tool/state": tool_state,
}
labels = {"station": "ur5e-sim", "controller": "pd", "speed": 1.0}
run = Run("ur5e-sim:pd:x1", streams=streams, labels=labels, provenance="sim")
runRun(sim station=ur5e-sim · target 980, state 980, tool/target 980, tool/state 980)
2. a six-joint arm's metrics
The catalog's rigid chain over six joints, plus each joint's worst stop and the lag: new rows are stock metrics with new settings, never new functions.
chain = catalog.rigid_chain(ur5e_sim.JOINTS)
worst_stops = []
for index, joint in enumerate(ur5e_sim.JOINTS):
worst_stop = StopStat(of="error", statistic="max", joint=index)
worst_stops.append(Alias(f"{joint}/worst stop", worst_stop, unit="deg", scale=DEGREES))
lag = Alias("lag", TimeOffset(), unit="ms", scale=1e3, across="median")
ur5e = Collection([*chain.collection().aliases.values(), *worst_stops, lag])
list(ur5e.aliases) # the numbers this arm reports['shoulder_pan/tracking RMS', 'shoulder_lift/tracking RMS', 'elbow/tracking RMS', 'wrist_1/tracking RMS', 'wrist_2/tracking RMS', 'wrist_3/tracking RMS', 'tool tracking RMS', 'tool worst', 'shoulder_pan/worst stop', 'shoulder_lift/worst stop', 'elbow/worst stop', 'wrist_1/worst stop', 'wrist_2/worst stop', 'wrist_3/worst stop', 'lag']
scored = ur5e.fold(run) # run every sample of the run through them, once
values = ur5e.values(scored) # {name: number in its unit}
values["tool tracking RMS"]67.2876076265141
values["shoulder_lift/worst stop"]
0.9348128369346066
values["lag"]
159.99953182789665
3. two controllers, three speeds
The same path at half, full and double speed, with the PD servos as shipped and with model feed-forward added. summarize() by controller and speed; a 1 mm target on the worst tool error.
sweep = []
for controller in ("pd", "pd+ff"):
for speed in (0.5, 1.0, 2.0):
sweep.append(ur5e_sim.pick_and_place_run(speed, controller))
len(sweep)6
groups = summarize(ur5e, sweep, by=("controller", "speed")) # one group per cell
tool_gate = Objective("tool worst", "<=", 1.0, unit="mm", on="value")
for (controller, speed), group in sorted(groups.items()):
rms_mm = group.values["tool tracking RMS"]
worst_mm = group.values["tool worst"]
lag_ms = group.values["lag"]
verdict = tool_gate.judge(group).verdict
tool_text = f"tool RMS {rms_mm:6.2f} · worst {worst_mm:6.2f} mm"
print(f"{controller:<5} x{speed:<3g} | {tool_text} | lag {lag_ms:5.1f} ms | {verdict}")pd x0.5 | tool RMS 43.17 · worst 99.72 mm | lag 190.0 ms | fail
pd x1 | tool RMS 67.29 · worst 166.16 mm | lag 160.0 ms | fail
pd x2 | tool RMS 88.38 · worst 280.10 mm | lag 150.0 ms | fail
pd+ff x0.5 | tool RMS 0.42 · worst 0.91 mm | lag 0.4 ms | pass
pd+ff x1 | tool RMS 1.07 · worst 2.75 mm | lag 0.9 ms | fail
pd+ff x2 | tool RMS 1.88 · worst 7.34 mm | lag 1.4 ms | fail
4. pictures
Tool tracking RMS by speed for both controllers (log scale), and every stop of the shoulder lift joint at full speed.
speeds, tool_values, controllers = [], [], []
for (controller, speed), group in sorted(groups.items()):
speeds.append(speed)
tool_values.append(group.values["tool tracking RMS"])
controllers.append(controller)
speed_view = View(
title="UR5e (simulated) · tool tracking RMS by speed",
unit="mm",
hint="kpi_trend",
x=speeds,
y=tool_values,
group=controllers,
target=1.0,
target_label="1 mm",
x_label="speed (x the nominal path)",
)
figure, axes = plot(speed_view)
axes.set_yscale("log")
figure.savefig("ur5e-tool-rms-by-speed.png") # saved in this folder
full_speed = {}
for controller in ("pd", "pd+ff"):
full_speed[controller] = groups[(controller, 1.0)].merged # its runs, added up
stops_view = ur5e.view(
"shoulder_lift/worst stop",
full_speed,
title="UR5e (simulated) · every stop of the shoulder lift, full speed",
)
figure, axes = plot(stops_view, path="ur5e-shoulder-lift-stops.png")