Append/Remove/Replace Link

RTSX Help: Append/remove/replace a robot link




This set of auxiliary functions is designed to conveniently add, remove, or replace a link in a robot model.


  • robot = AppendLink(robot, L, li)
  • robot = RemoveLink(robot, li)
  • robot = ReplaceLink(robot, L, li)

Input Arguments

  • robot –a robot model to modify
  • L –a link to append/replace
  • li –index of robot link

Output Arguments

  • robot — updated robot model


Suppose a robot model is already built and one later wants to add/delete/change a link at specific location, this set of support functions is designed for such purpose. When appending/replacing robot with a new link, the link is checked whether it has same DH convention with the robot. If not, the function shows error message and the link is not added/changed.


L(1)=Link([0 0 1.2 0]);
L(2)=Link([0 0 1 0]);
twolink=SerialLink(L); // a 2-link manipulator
newL1 = Link([0 0 0.5 0]);
threelink = AppendLink(twolink,newL1,2);  // insert new link at location 2
fourlink = AppendLink(threelink, newL1); // if location is omitted, append on top
threelink1 = RemoveLink(fourlink,3); // remove link 3
newL2 = Link([0 1 0 pi/2],'P');	// new prismatic link
threelink2 = ReplaceLink(threelink1, newL2, 2);  // replace link 2

See Also