Zivid SDK 상호 운용성
이 문서에서는 Zivid SDK와 Zivid Motion을 동일한 애플리케이션에서 함께 사용하는 방법을 설명합니다. 향후 더욱 원활한 사용자 경험을 위해 이러한 통합 세부 사항을 다룰 예정이지만, 현재로서는 두 SDK를 효과적으로 함께 사용하는 방법에 대한 지침을 제공합니다.
Zivid Motion과 Zivid SDK를 결합한 전체 샘플 애플리케이션은 Zvid 포인트 클라우드에서 발생한 장애물 샘플을 참조하세요.
단위: 밀리미터 vs 미터
다음 사항에 유의하십시오:
Zivid SDK 포인트 클라우드 좌표는 밀리미터 단위입니다.
Zivid Motion의 기하학적 형상 및 장애물 좌표는 미터 단위입니다.
SDK 포인트 클라우드에서 Motion 장애물을 생성하기 전에 항상 좌표를 밀리미터에서 미터로 변환하십시오.
const Zivid::Matrix4x4 millimetersToMetersTransform{ {
{ 0.001f, 0.f, 0.f, 0.f },
{ 0.f, 0.001f, 0.f, 0.f },
{ 0.f, 0.f, 0.001f, 0.f },
{ 0.f, 0.f, 0.f, 1.f },
} };
frame.pointCloud().transform(millimetersToMetersTransform);
millimeters_to_meters_transform = np.diag([0.001, 0.001, 0.001, 1])
frame.point_cloud().transform(millimeters_to_meters_transform)
C++ 통합 세부 정보
애플리케이션 인스턴스화 순서
When using Zivid SDK and Zivid Motion in the same C++ process, create a Application first and a
Motion::Application application second, to avoid an initialization error.
다음 순서를 따르세요:
Zivid::Application zividApp;
Zivid::Motion::Application motionApp;
데이터 유형 변환
SDK and Motion types are different C++ types, even when they represent the same concept.
예를 들어:
PointXYZis an SDK point type.Zivid::Motion::Vector3fis the Motion point type.
SDK 포인트 클라우드 데이터를 사용하여 Motion 장애물을 생성할 때 명시적으로 변환하십시오.
// Ensure that the point cloud is in meters, not millimeters, before copying the XYZ data.
// Also, make sure to use an unorganized point cloud, as Motion always expects unorganized point clouds.
const auto xyzData = unorganizedPointCloud.copyPointsXYZ();
std::vector<Zivid::Motion::Vector3f> points;
points.reserve(xyzData.size());
for(const auto &p : xyzData)
{
points.emplace_back(Zivid::Motion::Vector3f{ p.x, p.y, p.z });
}
planner.setObstacles({ Zivid::Motion::Obstacle::fromPointCloud("point_cloud_obstacle", points) });
Python 통합 세부 정보
Python에서는 상호 운용성이 더 간단합니다.
Zivid SDK와 Zivid Motion은 모두 NumPy 호환 데이터와 자연스럽게 연동됩니다.
밀리미터를 미터로 변환하는 것 외에는 특별한 데이터 변환 단계가 필요하지 않습니다.
zivid.Application()과zividmotion.Application()의 생성 순서에는 제한이 없습니다.