Zivid SDK 상호 운용성

To use Zivid SDK and Zivid Motion together in the same application, convert Zivid SDK point cloud coordinates from millimeters to meters before passing them to Zivid Motion. In C++, also instantiate Application before Motion::Application. These integration steps are manual for now; tighter interoperability between the two SDKs is planned for the future.

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.

예를 들어:

  • PointXYZ is an SDK point type.

  • Zivid::Motion::Vector3f is 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() 의 생성 순서에는 제한이 없습니다.