klampt.plan.kinetrajopt.trajopt_task_space module

Defines task space constraints for use in KineTrajOpt.

Classes:

PoseConstraint(wrobot, linkid, target_pose)

Yet another way to impose pose constraint from the moment perspective

DirectionConstraint(wrobot, linkid[, …])

Constraints to keep one direction up

OrientationConstraint(robot, linkid, R)

Keeps a link at some orientation

PositionConstraint(wrobot, linkid, lcl_pos, …)

To constrain the position of a link local position

Functions:

uncross(R)

Sinc(x)

Sinc_Dx(x)

MomentDerivative(m, R, z)

Compute the derivative of rotation vector given the value, rotation, and angular velocity

class klampt.plan.kinetrajopt.trajopt_task_space.PoseConstraint(wrobot, linkid, target_pose)[source]

Bases: klampt.plan.kinetrajopt.utils.ConstrInterface

Yet another way to impose pose constraint from the moment perspective

Methods:

compute(x[, grad_level])

Evaluates the constraint function and possibly (determining on grad_level) the Jacobian.

compute(x, grad_level=0)[source]

Evaluates the constraint function and possibly (determining on grad_level) the Jacobian.

Parameters
  • x (ndarray) – the point to be evaluated

  • grad_level (int, optional) – which level of gradient is computed. Defaults to 0.

Returns

The constraint value and optional derivatives, structured as follows:

  • If grad_level == 0, it returns a 1-D ndarray of g(x)

  • If grad_level == 1, it also returns a 2-D ndarray giving the constraint Jacobian d/dx g(x).

Return type

tuple

klampt.plan.kinetrajopt.trajopt_task_space.uncross(R)[source]
klampt.plan.kinetrajopt.trajopt_task_space.Sinc(x)[source]
klampt.plan.kinetrajopt.trajopt_task_space.Sinc_Dx(x)[source]
klampt.plan.kinetrajopt.trajopt_task_space.MomentDerivative(m, R, z)[source]

Compute the derivative of rotation vector given the value, rotation, and angular velocity

Parameters
  • m (arr) – the rotation vector

  • R (arr) – the rotation matrix

  • z (arr) – the angular velocity

Returns

the dereivative

Return type

dm ([arr])

class klampt.plan.kinetrajopt.trajopt_task_space.DirectionConstraint(wrobot, linkid, lcl_dir=[0, 0, 1], world_dir=[0, 0, 1])[source]

Bases: klampt.plan.kinetrajopt.utils.ConstrInterface

Constraints to keep one direction up

Methods:

compute(x[, grad_level])

Evaluates the constraint function and possibly (determining on grad_level) the Jacobian.

compute(x, grad_level=0)[source]

Evaluates the constraint function and possibly (determining on grad_level) the Jacobian.

Parameters
  • x (ndarray) – the point to be evaluated

  • grad_level (int, optional) – which level of gradient is computed. Defaults to 0.

Returns

The constraint value and optional derivatives, structured as follows:

  • If grad_level == 0, it returns a 1-D ndarray of g(x)

  • If grad_level == 1, it also returns a 2-D ndarray giving the constraint Jacobian d/dx g(x).

Return type

tuple

class klampt.plan.kinetrajopt.trajopt_task_space.OrientationConstraint(robot, linkid, R)[source]

Bases: klampt.plan.kinetrajopt.utils.ConstrInterface

Keeps a link at some orientation

Methods:

compute(x[, grad_level])

Evaluates the constraint function and possibly (determining on grad_level) the Jacobian.

compute(x, grad_level=0)[source]

Evaluates the constraint function and possibly (determining on grad_level) the Jacobian.

Parameters
  • x (ndarray) – the point to be evaluated

  • grad_level (int, optional) – which level of gradient is computed. Defaults to 0.

Returns

The constraint value and optional derivatives, structured as follows:

  • If grad_level == 0, it returns a 1-D ndarray of g(x)

  • If grad_level == 1, it also returns a 2-D ndarray giving the constraint Jacobian d/dx g(x).

Return type

tuple

class klampt.plan.kinetrajopt.trajopt_task_space.PositionConstraint(wrobot, linkid, lcl_pos, world_pos)[source]

Bases: klampt.plan.kinetrajopt.utils.ConstrInterface

To constrain the position of a link local position

Methods:

compute(x[, grad_level])

Evaluates the constraint function and possibly (determining on grad_level) the Jacobian.

compute(x, grad_level=0)[source]

Evaluates the constraint function and possibly (determining on grad_level) the Jacobian.

Parameters
  • x (ndarray) – the point to be evaluated

  • grad_level (int, optional) – which level of gradient is computed. Defaults to 0.

Returns

The constraint value and optional derivatives, structured as follows:

  • If grad_level == 0, it returns a 1-D ndarray of g(x)

  • If grad_level == 1, it also returns a 2-D ndarray giving the constraint Jacobian d/dx g(x).

Return type

tuple