Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Enhancement: SE3 constructor should accept an (N, 4, 4) ndarray as N poses

未关闭
#236 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
66/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
numpy, python

调研方向

Start by reading the SE3 constructor and its existing tests for single matrices and lists of matrices. Run those tests, then add coverage for stacked (N, 4, 4) arrays and unsupported shapes, including the check=False behavior. Done means stacked arrays produce N poses like SE3(list(arr)), while unsupported shapes raise a useful error.

由索引模型根据 Issue 内容生成。

描述

Summary

SE3 can be built from a single 4x4 array, from a list of 4x4 arrays (its own internal representation for a sequence of poses), or from other SE3 objects, but not from a stacked (N, 4, 4) ndarray. That is the natural way to hold a pose sequence in NumPy-based code (for example the output of np.stack, or a trajectory loaded from a file), and it is the form that a number of Robotics Toolbox for Python (RTB) functions accept for pose trajectories.

Reproduction

import numpy as np
from spatialmath import SE3

A = SE3.Rx(0.3).A
arr = np.array([A, A, A])        # shape (3, 4, 4)

SE3(arr)
# ValueError: bad argument to constructor

s = SE3(arr, check=False)
len(s), s.A.shape
# (1, (3, 4, 4))   <- silently a malformed object: length 1, but .A is (3, 4, 4)

len(SE3([A, A, A]))              # 3, a list of matrices works

Tested with spatialmath-python 1.1.18.

Why it matters

  • With the default check=True the error message does not say what is accepted.
  • With check=False the constructor silently returns a malformed object. In RTB this turned a user's (N, 4, 4) trajectory into an object that failed deep inside an IK solver with ValueError: operands could not be broadcast together with shapes (3,4) (3,), far from the cause.

Suggested behaviour

  1. Accept an ndarray with ndim == 3 and shape[1:] == (4, 4) as a sequence of N poses, equivalent to SE3(list(arr)).
  2. For other unsupported shapes, raise an error that says which forms are accepted. Ideally this validation of the array shape (not the matrix contents) would also happen with check=False, which would skip only the expensive checks that the matrices are valid SE(3).

This is an enhancement request, not a regression. RTB works around it by converting the array to a list of matrices before calling the constructor, so there is no urgency.

主要语言
Python
星标
643
派生
102
平均合并
11 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rai-opensource/spatialmath-python 的其他 Issue

查看 rai-opensource/spatialmath-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。