original_docstring:  Generate a motion primitive sequence based on action constraints 
docstring: Generate a motion primitive sequence based on action constraints
docstring_tokens: Generate a motion primitive sequence based on action constraints
code: def generate_action_from_motion_primitives(self, node_queue, node_constraints, pose_buffer, node_body_orientation_targets, fix_root_params=None):
          """ Generate a motion primitive sequence based on action constraints """
          #print("generate action", node_constraints.keys(), look_at_target)
          cycle_count = 0
          while len(node_queue) > 0 and not self.stop_thread:
              current_node, node_type = node_queue[0]
              constraints = []
              key = (current_node, cycle_count)
              if key in node_constraints:
                  constraints = node_constraints[key]
              else:
                  print("ignore",key)
              body_orientation_targets = None
              if key in node_body_orientation_targets:
                  body_orientation_targets = node_body_orientation_targets[key]
              new_frames, events, hold_frames = self.generate_constrained_frames(current_node, constraints, pose_buffer, body_orientation_targets)
  
              new_entry = self.state_queue.create_state_queue_entry(current_node, node_type, self.dt, pose_buffer, new_frames,
                                                        events, hold_frames, export=False)
  
              self.state_queue.append_state_to_queue(new_entry)
              if fix_root_params is not None:
                  start_pos, start_q = fix_root_params
                  self.state_queue.apply_end_pos_correction(start_pos)
                  self.state_queue.apply_end_orientation_correction(start_q)
              time.sleep(self.settings.sleep_time)
              node_queue = node_queue[1:]
              action = current_node[0]
              if action in self.action_definitions:
                  if "cycle_nodes" in self.action_definitions[action]:
                      if current_node[1] in self.action_definitions[action]["cycle_nodes"]:
                          cycle_count+=1
code_tokens: def generate_action_from_motion_primitives ( self , node_queue , node_constraints , pose_buffer , node_body_orientation_targets , fix_root_params = None ) : cycle_count = 0 while len ( node_queue ) > 0 and not self . stop_thread : current_node , node_type = node_queue [ 0 ] constraints = [ ] key = ( current_node , cycle_count ) if key in node_constraints : constraints = node_constraints [ key ] else : print ( "ignore" , key ) body_orientation_targets = None if key in node_body_orientation_targets : body_orientation_targets = node_body_orientation_targets [ key ] new_frames , events , hold_frames = self . generate_constrained_frames ( current_node , constraints , pose_buffer , body_orientation_targets ) new_entry = self . state_queue . create_state_queue_entry ( current_node , node_type , self . dt , pose_buffer , new_frames , events , hold_frames , export = False ) self . state_queue . append_state_to_queue ( new_entry ) if fix_root_params is not None : start_pos , start_q = fix_root_params self . state_queue . apply_end_pos_correction ( start_pos ) self . state_queue . apply_end_orientation_correction ( start_q ) time . sleep ( self . settings . sleep_time ) node_queue = node_queue [ 1 : ] action = current_node [ 0 ] if action in self . action_definitions : if "cycle_nodes" in self . action_definitions [ action ] : if current_node [ 1 ] in self . action_definitions [ action ] [ "cycle_nodes" ] : cycle_count += 1
short_docstring: Generate a motion primitive sequence based on action constraints
short_docstring_tokens: Generate a motion primitive sequence based on action constraints
comment: """ Generate a motion primitive sequence based on action constraints """$SEP$#print("generate action", node_constraints.keys(), look_at_target)