feat: 生成逆运动学论文对比图
This commit is contained in:
@@ -256,3 +256,48 @@ def test_summarize_result_uses_report_metrics() -> None:
|
||||
assert actual.position_rmse_m == pytest.approx(0.0035355339)
|
||||
assert actual.orientation_rmse_rad == pytest.approx(0.0158113883)
|
||||
assert actual.max_joint_speed_deg_s == pytest.approx(180.0)
|
||||
|
||||
|
||||
def test_write_outputs_creates_consistent_files(tmp_path: Path) -> None:
|
||||
result = comparison.ReplayResult(
|
||||
method="qp",
|
||||
times_s=np.asarray([0.0, 0.1]),
|
||||
target_poses=np.tile(
|
||||
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0], (2, 1)
|
||||
),
|
||||
actual_poses=np.tile(
|
||||
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0], (2, 1)
|
||||
),
|
||||
joints=np.zeros((2, 7)),
|
||||
velocities=np.zeros((2, 7)),
|
||||
position_errors_m=np.asarray([0.001, 0.002]),
|
||||
orientation_errors_rad=np.asarray([0.001, 0.002]),
|
||||
joint_margins=np.asarray([0.2, 0.2]),
|
||||
solve_durations_ms=np.asarray([0.5, 0.6]),
|
||||
success=np.asarray([True, True]),
|
||||
command_limited=np.asarray([False, False]),
|
||||
)
|
||||
summary = comparison.summarize_result(result)
|
||||
|
||||
comparison.write_outputs(
|
||||
tmp_path,
|
||||
{"pinv": result, "dls": result, "qp": result},
|
||||
{"pinv": summary, "dls": summary, "qp": summary},
|
||||
selected_damping=0.03,
|
||||
source_path=Path("episode_0.hdf5"),
|
||||
git_commit="abc1234",
|
||||
)
|
||||
|
||||
expected = {
|
||||
"samples.csv",
|
||||
"summary.json",
|
||||
"figure_2_11_tracking_error.svg",
|
||||
"figure_2_11_tracking_error.png",
|
||||
"figure_2_12_joint_constraints.svg",
|
||||
"figure_2_12_joint_constraints.png",
|
||||
"figure_2_13_summary.svg",
|
||||
"figure_2_13_summary.png",
|
||||
"analysis_2.3.4.md",
|
||||
}
|
||||
assert expected == {path.name for path in tmp_path.iterdir()}
|
||||
assert all((tmp_path / name).stat().st_size > 0 for name in expected)
|
||||
|
||||
Reference in New Issue
Block a user