Main Content

copy

로봇 모델 복사

설명

newrobot = copy(robot)은 동일한 속성을 가진 robot의 깊은 복사본을 생성합니다. newrobot에서의 변경 내용이 robot에 반영되지 않습니다.

예제

예제

모두 축소

기존 rigidBodyTree 객체를 변경합니다. 강체 트리에서 조인트, 바디, 하위 트리를 바꿀 수 있습니다.

Robotics System Toolbox™ loadrobot 함수를 사용하여 ABB IRB-120T 매니퓰레이터를 불러옵니다. 이는 rigidBodyTree 객체로 지정됩니다.

manipulator = loadrobot("abbIrb120T");

show를 사용해서 로봇을 표시하고 showdetails를 사용해서 로봇의 세부 정보를 읽어옵니다.

show(manipulator);
showdetails(manipulator)

속성을 검사할 바디를 가져옵니다. link_3 바디의 자식은 link_4 바디뿐입니다. 특정 바디를 복사할 수도 있습니다.

body3 = getBody(manipulator,"link_3");
childBody = body3.Children{1}
body3Copy = copy(body3);

link_3 바디의 조인트를 바꿉니다. 다운스트림 바디의 기하 도형이 영향을 받지 않도록 하려면 새 Joint 객체를 만들고 replaceJoint를 사용해야 합니다. 바디 간의 변환을 정의하기 위해 필요한 경우 디폴트 단위 행렬을 사용하는 대신 setFixedTransform을 호출합니다.

newJoint = rigidBodyJoint("prismatic");
replaceJoint(manipulator,"link_3",newJoint);

showdetails(manipulator)

removeBody를 사용하여 전체 바디를 제거하고, 결과로 생성된 하위 트리를 가져옵니다. 제거된 바디는 하위 트리에 포함됩니다.

subtree = removeBody(manipulator,"link_4")
show(subtree);

수정된 link_3 바디를 제거합니다. 복사한 원래 link_3 바디를 link_2 바디에 추가한 다음, 반환된 하위 트리를 추가합니다. 로봇 모델은 동일하게 유지됩니다. 자세한 비교는 showdetails를 통해 확인하십시오.

removeBody(manipulator,"link_3");
addBody(manipulator,body3Copy,"link_2")
addSubtree(manipulator,"link_3",subtree)

showdetails(manipulator)

입력 인수

모두 축소

로봇 모델로, rigidBodyTree 객체로 지정됩니다.

출력 인수

모두 축소

로봇 모델로, rigidBodyTree 객체로 반환됩니다.

확장 기능

버전 내역

R2016b에 개발됨