# Indy APIs

IndySDK includes several libraries used for kinematics and dynamics calculations, which can be utilized for the robot control. For details, see "AbstractRobot6D" (for IndyRP2, "AbstractRobot7D") in the path of "../NRMKFramework/Components/".

### [Forward Kinematics]

• AbstractRobot6D::computeFK.
• Compute the task position and task velocity (optionally) from robot pose.
 1 2 void computeFK(TaskPosition & pos) void computeFK(TaskPosition & pos, TaskVelocity & vel) 

Parameters:

### [Jacobian]

• AbstractRobot6D::computeJacobian.
 1 2 void computeJacobian(TaskPosition & pos, TaskVelocity & vel, TaskJacobian & J, TaskJacobian & Jdot) 

Parameters:

• J, Jdot: "Task Jacobian" and its time derivative, respectively.
• TaskJacobian: 6 by 6 matrix (Eigen::Matrix).

### [Inverse Dynamics]

• AbstractRobot6D::idyn.
• Implement the recursive Newton-Euler method without gravity (optionally with gravity) for a given joint velocity and acceleration vector.
 1 2 void idyn(JointVec const & qdot, JointVec const & qddot) void idyn(JointVec const & qdot, JointVec const & qddot, LieGroup::Vector3D const & gacc) 

Parameters

• qdot: Array of the joint velocity values.
• qddot: Array of the joint acceleration values.
• gacc: Gravitation acceleration vector.

### [Passive Inverse Dynamics]

• AbstractRobot6D::idyn_passive.
• Implement the recursive passivity-based Newton-Euler method without gravity (optionally with gravity) for a given joint velocity and acceleration vector.
 1 2 void idyn_passive(JointVec const & qdot, JointVec const & qddot); void idyn_passive(JointVec const & qdot, JointVec const & qddot, LieGroup::Vector3D const & gacc) 

Parameters

• qdot: Array of the joint reference velocity values.
• qddot: Array of the joint acceleration values.
• gacc: Gravitation acceleration vector.

### [Gravity]

• AbstractRobot6D::idyn_gravity.
• Implement the recursive Newton-Euler method for gravitation for a given joint position.
 1 void idyn_gravity(LieGroup::Vector3D const & gacc); 

Parameters

• gacc: Gravitation acceleration vector.

### [Momentum]

• AbstractRobot6D::idyn_momentum.
• Implement the recursive Newton-Euler method for momentum computation for a given joint acceleration vector.
 1 void idyn_momentum(JointVec const & qddot) 

Parameters:

• qddot: Array of the joint acceleration values.

### [Dynamics Parameters]

• AbstractRobot6D::computeDynamicsParams.
 1 2 void computeDynamicsParams(LieGroup::Vector3D const & gravDir, JointMat & M, JointMat & C, JointVec & G) 

Parameters:

• M: Inertia matrix.
• C: Coriolis and centrifugal matrix.
• G: Gravity force vector.
• gravDir: Direction of gravity force.

• Calculate the desired trajectory based on a virtual physical proxy with the inertia, floating on 3D space.
• Use F/T sensor values to apply the external forces to a virtual proxy.

 1 void resetAdmittanceTraj(double delT) 

Parameters:

• delT: Sampling time.

 1 2 3 4 void updateAdmittanceTraj(TaskPosition const & posDes, TaskVelocity const & velDes, TaskAcceleration const & accDes, TaskPosition & tposProxy, TaskVelocity & tvelProxy, TaskAcceleration & taccProxy, LieGroup::Wrench f_ext, LieGroup::Wrench f_ext_filtered, int mode) 

Parameters:

• posDes: Desired position trajectory calculated from interpolator.
• velDes: Desired velocity trajectory calculated from interpolator.
• accDes: Desired acceleration trajectory calculated from interpolator.
• tposProxy: Proxy's desired position trajectory.
• tvelProxy: Proxy's desired velocity trajectory.
• taccproxy: Proxy's desired acceleration trajectory.
• mode: 0 - not applied; 1 - applied for displacement; 2 - applied for rotation.

### [Forward Dynamic Control]

• AbstractRobot6D::ForwardDynController.
• Provide "Forward Dynamic Controller" which uses "Jacobian Transpose" method in the task-space position control. It guarantees singularity-free task-space control.

Initialization and reset of Forward Dynamic Controller:

 1 2 void initForwardDynController(double delT) void resetForwardDynController() 

Parameters:

• delT: Sampling time

Control gain settings of Forward Dynamic Controller:

 1 2 void setForwardDynControlGain(JointVec const & kp, JointVec const & kv, JointVec const & ki) 

Parameters:

• kp, kv, ki: Position, velocity, and integral control gain, respectively.

Forward Dynamic Controller:

 1 2 3 4 void ForwardDynController(AbstractRobot6D & robotNom, JointMat & Mn, JointMat & Cn, JointVec & Gn, TaskPosition const & posDes, TaskVelocity const & velDes, LieGroup::Vector3D const & gravDir) 

Parameters:

• AbstractRobot6D: 6 degree-of-freedom (DOF) robot class which includes its states and API functions as members.
• JointMat: 6 by 6 matrix (Eigen::Matrix).
• robotNom: Nominal (or Simulated) robot.
• Mn: Inertia matrix of nominal robot.
• Cn: Coriolis and centrifugal matrix of nominal robot.
• Gn: Gravity force vector of nominal robot.
• PosDes, velDes: Desired position and velocity, respectively.

### [H-infinity Position Controller]

• AbstractRobot6D::HinfController.
• Provide H-infinity position controller which is the fundamental position controller of Neuromeka's Indy7.

Initialization and reset of H-infinity controller:

 1 2 void initHinfController(double delT) void resetHinfController() 

Parameters:

• delT: Sampling time.

Control gain settings of H-infinity controller:

 1 void setHinfControlGain(const JointVec &kp, const JointVec &kv, const JointVec &ki) 

Parameters:

• kp, kv, ki: Position, velocity, integral control gains, respectively.

Joint-space H-infinity controller and task-space H-infinity controller:

 1 2 3 4 int HinfController(LieGroup::Vector3D const & gravDir, JointVec const & qd, JointVec const & qdotd, JointVec const & qddotd) int HinfController(LieGroup::Vector3D const & gravDir, TaskPosition const & pd, TaskVelocity const & pdotd, TaskAcceleration const & pddotd) 

Parameters:

• qd, qdotd, qddotd: Desired joint position, joint velocity, and joint acceleration, respectively.
• gravDir: Direction of gravity force.

### [Target Coordinate Setting]

• AbstractRobot6D::setTtarget.
• Set the HTransform matrix from last joint to TCP.
 1 void setTtarget(LieGroup::Rotation const & R, LieGroup::Displacement const & r) 

Parameters:

• R: Rotation matrix from last joint to TCP.
• r: Displacement vector from last joint to TCP.

### [Reference Coordinate Setting]

• AbstractRobot6D::setTReference.
• Set the HTransform matrix from global origin to robot's origin.
 1 void setTReference(LieGroup::Rotation const & R, LieGroup::Displacement const & r) 

Parameters:

• R: Rotation matrix from global origin to robot's origin.
• r: Displacement vector from global origin to robot's origin.

### [F/T Sensor Coordinate Setting]

• AbstractRobot6D::setTFTSensor.
• Set the HTransform matrix from TCP to F/T sensor frame.
 1 void setTFTSensor(LieGroup::Rotation const & R, LieGroup::Displacement const & r) 

Parameters:

• R: Rotation matrix from TCP to F/T sensor frame.
• r: Displacement vector from TCP to F/T sensor frame.

### [Tool Property Setting]

• AbstractRobot6D::toolWeight, toolXcom, toolYcom, toolZcom.
• Return the tool information such as tool weight and tool position.
 1 2 double const & toolWeight() double & toolWeight() 
 1 2 double const & toolXcom() double & toolXcom() 
 1 2 double const & toolYcom() double & toolYcom() 
 1 2 double const & toolZcom() double & toolZcom() 

### [Home Position]

• AbstractRobot6D::qhome.
• Return the current home position.
 1 2 JointVec const & qhome() JointVec & qhome()