<commit_before># sim_lib.tcl: haltcl procs for sim configurations

#----------------------------------------------------------------------
# all globals are in one associative array ::SIM_LIB()
set letters {x y z a b c u v w}
foreach a {x y z a b c u v w} {
  set ::SIM_LIB($a,idx) [lsearch $letters $a]
}
#----------------------------------------------------------------------
proc core_sim {axes
               number_of_axes
               servo_period
               {base_period 0}
               {emcmot motmod}
              } {
  # adapted as haltcl proc from core_sim.hal
  # note: with default emcmot==motmot,
  #       thread will not be added for (default) base_pariod == 9
  loadrt trivkins
  set lcmd "loadrt $emcmot"
  set lcmd "$lcmd base_period_nsec=$base_period"
  set lcmd "$lcmd servo_period_nsec=$servo_period"
  set lcmd "$lcmd num_joints=$number_of_axes"

  eval $lcmd
  addf motion-command-handler servo-thread
  addf motion-controller      servo-thread

  set pid_names ""
  set mux_names ""
  foreach a $axes {
    set pid_names "${pid_names},${a}_pid"
    set mux_names "${mux_names},${a}_mux"
  }
  set pid_names [string trimleft $pid_names ,]
  set mux_names [string trimleft $mux_names ,]
  loadrt pid  names=$pid_names
  loadrt mux2 names=$mux_names

  # pid components
  # The pid comp is used as a pass-thru device (FF0=1,all other gains=0)
  # to emulate the connectivity of a servo system
  # (e.g., no short-circuit connection of motor-pos-cmd to motor-pos-fb)
  foreach cname [split $pid_names ,] {
    addf ${cname}.do-pid-calcs servo-thread<commit_msg>lib/hallib/sim_lib.tcl: enforce reqmt for joints_axes<commit_after># sim_lib.tcl: haltcl procs for sim configurations

#----------------------------------------------------------------------
# all globals are in one associative array ::SIM_LIB()
set letters {x y z a b c u v w}
foreach a {x y z a b c u v w} {
  set ::SIM_LIB($a,idx) [lsearch $letters $a]
}
#----------------------------------------------------------------------
proc core_sim {axes
               number_of_axes
               servo_period
               {base_period 0}
               {emcmot motmod}
              } {
  # adapted as haltcl proc from core_sim.hal
  # note: with default emcmot==motmot,
  #       thread will not be added for (default) base_pariod == 9
  if [info exists ::KINS(KINEMATICS)] {
    loadrt $::KINS(KINEMATICS)
  } else {
    puts stderr "\n!!!core_sim: KINS(KINEMATICS) must be specified\n"
    exit 1
  }
  set lcmd "loadrt $emcmot"
  set lcmd "$lcmd base_period_nsec=$base_period"
  set lcmd "$lcmd servo_period_nsec=$servo_period"
  set lcmd "$lcmd num_joints=$number_of_axes"

  eval $lcmd
  addf motion-command-handler servo-thread
  addf motion-controller      servo-thread

  set pid_names ""
  set mux_names ""
  foreach a $axes {
    set pid_names "${pid_names},${a}_pid"
    set mux_names "${mux_names},${a}_mux"
  }
  set pid_names [string trimleft $pid_names ,]
  set mux_names [string trimleft $mux_names ,]
  loadrt pid  names=$pid_names
  loadrt mux2 names=$mux_names

  # pid components
  # The pid comp is used as a pass-thru device (FF0=1,all other gains=0)
  # to emulate the connectivity of a servo system
  # (e.g., no short-circuit connection of motor-pos-cmd to motor-pos-fb)
  foreach cname [split $pid_names ,] {
    addf ${cname}.do-pid-calcs servo-thread
{'fraction_non_alphanumeric': 0.17531889646989024, 'fraction_numerical': 0.00385642242657965, 'mean_word_length': 2.261121856866538, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2934949', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1096, 'n_words': 341}