 
{ File ld.sil -  ( Load function for Silspec ) }
 
 
{ This is the "load" function for this robot.  It is called when
  a robot of this type is Installed into the workcell. }
 
procedure load_sx_13_19(name: string);
var
  rob: shape; rd: robotdata;
  flange : model;
  flange_name : string;
  jlr : joint_limited_robot;
  jlims : jvr_bnds;
begin
  sx_13_19_robot_model := restore(sx_13_19_robot_pathname);
  add(set_kind(sx_13_19_robot_model,"device),name);
  c_ob(select(wlkup(name),"LINKN));
  dset_pathdata_of(c_ob(),copy(sx_13_19_pathdata) as_type universal);
  dset_jsi_zone_mode(c_ob(),FALSE);
  dset_fly_value(c_ob(),1.000000000000000e+00);
  dset_zone_mode(c_ob(),FALSE);
  dset_fly_value(c_ob(),1.000000000000000e+00);
  dset_objectdata_of(parent(c_ob()),copy(sx_13_19_robotdata) as_type universal);

{ Support New Parameters for Calibration Package }

  rob:= wlkup(name);
  jlims := mk_jvr_bnds(       [-3.141592653589794e+00, 3.141592653589794e+00] as rbnds,
       [-3.141592653589793e+00, 1.221730476396034e+00] as rbnds,
       [-1.396263401595462e+00, 3.665191429188095e+00] as rbnds,
       [-6.632251157578448e+00, 3.490658503988725e-01] as rbnds,
       [-5.323254218582700e+00, -9.599310885968751e-01] as rbnds,
       [-3.490658503988660e+00, 3.490658503988660e+00] as rbnds);
  jlr := [rob,jlims] as joint_limited_robot;
  rd:= robotdata_of(rob);
  dset_robot_constants_of(rd,(copy(sx_13_19_constants as_type ob) as_type robot_constants) as_type universal);
  allocate_new_parms(rob,3,5,0);
  dset_rob_u_parm(rob,0,'' as_type universal);
  dset_rob_u_parm(rob,1,list("jzero,"azero                      ) as_type universal);
  dset_rob_u_parm(rob,2,emptylist(rob_parm_id) as_type universal);
  dset_joint_r_parm(rob,4,0,0.000000000000000e+00);
  dset_joint_r_parm(rob,4,1,1.499999999999994e+01);
  dset_joint_r_parm(rob,4,2,7.700000000000000e+01);
  dset_joint_r_parm(rob,4,3,2.000000000000000e+01);
  dset_joint_r_parm(rob,4,4,0.000000000000000e+00);
  dset_joint_r_parm(rob,4,5,0.000000000000000e+00);
  c_ob(rob);
 
  dset_jlims_reduction(c_ob(),0.0);
  assert_kind(select(c_ob(),"LINK0),"rigid_link);
  assert_kind(select(c_ob(),"LINK1),"rigid_link);
  assert_kind(select(c_ob(),"LINK2),"rigid_link);
  assert_kind(select(c_ob(),"LINK3),"rigid_link);
  assert_kind(select(c_ob(),"LINK4),"rigid_link);
  assert_kind(select(c_ob(),"LINK5),"rigid_link);
  assert_kind(select(c_ob(),"LINKN),"rigid_tool);
  c_ob(select(wlkup(name),"LINKN));
  move_robot_sx_13_19(c_ob(),home(parent(c_ob())));
  flange:= mk_empty_shape();
  flange_name := concat(uppercase(name),'_FLANGE');
  if object_exists(flange_name) then delete(flange_name);
  add(flange,flange_name);
  imoveto(flange, sx_13_19_flange_rel_wrist rel pose(c_ob()));
  affix(wlkup(flange_name),c_ob());
  c_ob(wlkup(flange_name));
{ Here we should load the silio if it is present.... }
  repaint();
end;
  
  
robot_load_functions := cons(list('SX_13_19' as_type universal,
                           mk_closure(load_sx_13_19(string)) as_type universal),
                           robot_load_functions);
  
if not(member('SX_13_19', installed_robots)) then
   installed_robots := cons('SX_13_19', installed_robots);
  
