빠른 시작

소개

이 글은 Zivid Motion에 대한 간략한 소개입니다. 셀을 분해하고, 계획 데이터를 생성하고, 간단한 장애물을 피하는 경로를 계획하는 방법을 보여줍니다. 이 빠른 시작 가이드의 목표는 세부적인 내용에 깊이 들어가지 않고 간단한 예제를 제공하는 것입니다.

아직 Zivid Motion을 설치하지 않았다면 설치 으로 이동하여 Zivid Motion을 설치한 후 이 문서로 다시 돌아오세요.

셀 데이터 설치

셀 데이터는 Zivid Motion 팀에서 제공한 설치 파일 옆에 있는 zip 파일에 포함되어 있습니다.

~/Downloads/motion-quickstart/
├─ data.zip
├─ zivid_pythonmotion*.whl
├─ zivid-motion*.deb

가장 먼저 해야 할 일은 셀룰러 데이터를 설치하는 것입니다.

python -c 'import zividmotion; app = zividmotion.Application(); zividmotion.install_package(application=app, package_path="path/to/data.zip")'

이제 ~/.local/share/Motion/ 디렉터리에 이 빠른 시작 가이드에 필요한 데이터가 포함되어 있어야 합니다. 이 디렉터리의 내용에 대한 자세한 내용은 셀 데이터데이터 및 구성 파일 섹션을 참조하십시오.

계획 데이터 생성

계획을 시작하기 전에 계획 데이터를 생성해야 합니다. 이는 런타임 계획 계산 속도를 높이는 사전 처리 단계입니다. ~/.local/share/Motion/ 경로의 소스 파일이 변경될 때마다 계획 데이터를 다시 생성해야 합니다. 그렇지 않으면 계획 프로그램에서 오류가 발생합니다.

계획 데이터를 생성하려면 계획 데이터 생성 샘플의 코드를 실행하세요. 생성 시간은 시스템 사양에 따라 다르지만, testing 환경에서는 1분 정도 소요됩니다.

계획 경로

이제 경로를 계획할 시간입니다! 아래의 간단한 예시를 통해 네 가지 간단한 단계를 따라해 보세요.

  1. 플래너를 초기화합니다

  2. 하나의 관절 구성에서 다른 관절 구성으로 가는 경로를 계획하세요.

  3. 간단한 기하학적 장애물을 설치하여 경로를 막으세요.

  4. 경로를 다시 계획하고, 계획자가 장애물을 피해 새로운 경로를 어떻게 찾아내는지 살펴보세요.

from typing import Optional

from zividmotion.zividmotion import (
    Application,
    Configuration,
    Goals,
    Mesh,
    Obstacle,
    PathRequest,
    PlannerSettings,
    Pose,
    Profile,
    Vector3f,
    Visualizer,
)

# A visual representation of the cell will open when USE_VISUALIZER is set to True.
CELL_NAME = "demo_cell"
PROFILE = Profile.testing
USE_VISUALIZER = True


app = Application()


planner_settings = PlannerSettings(
    cell_name=CELL_NAME,
    profile=PROFILE,
)

print("1. Initializing planner...")
planner = app.create_planner(planner_settings)
visualizer: Optional[Visualizer] = Visualizer.view_planner(planner) if USE_VISUALIZER else None
print("Planner successfully initialized.")

start_joint_config = Configuration([0.0, 0.0, 0.6, 0.0, 0.9, 0.0])

input("2. Press Enter to plan path to goal...")

# A simple planning problem where the shortest path is to spin the first joint 180 degrees.
goal_configuration = Configuration([3.14, 0.0, 0.6, 0.0, 0.9, 0.0])
goal = Goals.from_configurations([goal_configuration])

path_request = PathRequest(goals=goal)
path_result_1 = planner.path(start_joint_config, path_request)

print(path_result_1)

input("3. Press Enter to set an obstacle...")

# This obstacle will block the direct path, forcing the planner to find a new path around it.
box_mesh = Mesh.create_box(Vector3f(0.12, 0.7, 0.7)).transform_in_place(
    Pose(
        [
            [1.0, 0.0, 0.0, 0.0],
            [0.0, 1.0, 0.0, 1.3],
            [0.0, 0.0, 1.0, 0.8],
            [0.0, 0.0, 0.0, 1.0],
        ]
    )
)
obstacle = Obstacle.from_mesh(name="box_obstacle", mesh=box_mesh)
planner.set_obstacles([obstacle])

input("4. Press Enter to plan path to goal again...")

path_result_2 = planner.path(start_joint_config, path_request)

# The planner should now have found a new path around the obstacle. When comparing the two
# path results, you can see that path_result_2 contains multiple waypoints to pass around
# the obstacle.
print(path_result_1)
print(path_result_2)

if visualizer is not None:
    print("Close the window to exit.")
    visualizer.wait()

다음 단계

이 글은 Zivid Motion을 아주 간단하게 소개하여 런타임 API를 활용해 경로를 계획하고 환경에 동적인 장애물을 설정하는 방법을 이해하는 데 도움을 드렸습니다. 다음으로 추천하는 자료는 다음과 같습니다.