 
{ File k2.sil -  ( Joint limits functions ) }
 
 
{  This functions computes the set of joint limits for the robot }
{  GUY at the position J.  GUY is the robot object and J is the  }
{  current joint vector in the CIM convention.                   }
function joint_limits_sx_13_19(guy: object;j:jvr): jvr_bnds;
var jlr : joint_limited_robot;
begin
  jlr := guy to_view joint_limited_robot;
  joint_limits_sx_13_19 := jlr.joint_limits;
end;
 
 
{  This function determines whether J is inside the joint limits }
{  for robot X.  The argument X is the robot object and is never }
{  used by Meta-Kinematics-generated code.  The argument J is    }
{  the current joint vector in the CIM convention.               }
function in_joint_limits_sx_13_19(x:object; j:jvr): boolean;
var pjl: jvr_bnds;
begin
  pjl:=joint_limits_sx_13_19(x,j);
  in_joint_limits_sx_13_19:= in_bnds(j[1],pjl[1]) and
                               in_bnds(j[2],pjl[2]) and
                               in_bnds(j[3],pjl[3]) and
                               in_bnds(j[4],pjl[4]) and
                               in_bnds(j[5],pjl[5]) and
                               in_bnds(j[6],pjl[6]);
end;
