社区,
\n我正在尝试使用 Open3D 将点云与检测到的地板对齐。到目前为止,我实施了以下步骤(此答案的一部分):
\nget_rotation_matrix_from_axis_angle(参见3)结果还不错,但我必须在最后使用优化因子以获得更好的结果。是否有错误或更简单/更精确的对齐方式?
\n# See functions below\n\n# Get the plane equation of the floor \xe2\x86\x92 ax+by+cz+d = 0\nfloor = get_floor_plane(pcd)\na, b, c, d = floor\n\n# Translate plane to coordinate center\npcd.translate((0,-d/c,0))\n\n# Calculate rotation angle between plane normal & z-axis\nplane_normal = tuple(floor[:3])\nz_axis = (0,0,1)\nrotation_angle = vector_angle(plane_normal, z_axis)\n\n# Calculate rotation axis\nplane_normal_length = …Run Code Online (Sandbox Code Playgroud) 每当我创建/实例化 pydantic 对象时,是否有一种干净的方法来触发函数调用?
目前我正在root_validator为此“滥用”:
from pydantic import BaseModel
class PydanticClass(BaseModel):
name: str
@root_validator()
def on_create(cls, values):
print("Put your logic here!")
return values
Run Code Online (Sandbox Code Playgroud)
因此PydanticClass(name="Test")执行我的逻辑并简单地返回相同的对象值。
这可行,但我有两个问题,这就是为什么我对更干净的解决方案感兴趣:
所以我很高兴了解任何更好的方法/解决方案。
我想使用Overpass API查找特定区域中的所有酒吧,并使用geocodeArea选择区域。
在overpass-turbo.eu上测试以下查询给了我想要的结果:
{{geocodeArea:berlin}}->.searchArea;
(
node["amenity"="pub"](area.searchArea);
way["amenity"="pub"](area.searchArea);
relation["amenity"="pub"](area.searchArea);
);
out body;
>;
out skel qt;
Run Code Online (Sandbox Code Playgroud)
但是当我使用overpy在 python 中实现该查询时......
import overpy
api = overpy.Overpass()
result = api.query("""
{{geocodeArea:berlin}}->.searchArea;
(
node["amenity"="pub"](area.searchArea);
way["amenity"="pub"](area.searchArea);
relation["amenity"="pub"](area.searchArea);
);
out body;
>;
out skel qt;
""")
print("Amenities in nodes: %d" % len(result.nodes))
print("Amenities in ways: %d" % len(result.ways))
Run Code Online (Sandbox Code Playgroud)
...我收到以下错误:
Traceback (most recent call last):
File "testOP.py", line 15, in <module>
""")
File "/usr/local/lib/python2.7/dist-packages/overpy/__init__.py", line 119, in query
msgs=msgs
overpy.exception.OverpassBadRequest: …Run Code Online (Sandbox Code Playgroud)