Returns the lengths of a path in 1, 2 or 3D Cartesian space, even if more coordinates are provided. Each path point will have a corresponding length value (taken as the distance from the path's first point, along the path)


list pathLengths, float totalLength = sim.getPathLengths(list path, int dof, string distCallback = None) float[] pathLengths, float totalLength = sim.getPathLengths(float[] path, int dof, function/string distCallback = nil)


  • path: the path, specified in row-major order, e.g. a path containing two 3D poses (position+quaternion) would be [x1 y1 z1 qx1 qy1 qz1 qw1 x2 y2 z2 qx2 qy2 qz2 qw2]
  • dof: the size or dimension of path points, e.g. in case of a 3D pose, this would be 7 (however only the first 3 dimensions would be taken into account)
  • distCallback: an optional function that takes as input two configurations, and returns the calculated distance between them. See also sim.getConfigDistance

Return values

  • pathLengths: the lengths corresponding to each path point
  • totalLength: the total length of the path

See also: