original_docstring: generate a walk motion based on a sequence of target points
          frame_buffer: a list of frames containing pose parameters of the previous frames
          control_points: a list of positions
          
docstring: generate a walk motion based on a sequence of target points
  frame_buffer: a list of frames containing pose parameters of the previous frames
  control_points: a list of positions
docstring_tokens: generate a walk motion based on a sequence of target points frame_buffer : a list of frames containing pose parameters of the previous frames control_points : a list of positions
code: def generate_locomotion_from_pfnn(self, frame_buffer, control_points):
          """generate a walk motion based on a sequence of target points
          frame_buffer: a list of frames containing pose parameters of the previous frames
          control_points: a list of positions
          """
          success = True
          self.pfnn_wrapper.controller.traj.blend_bias = self.settings.pfnn_blend_bias
          aligning_transform = self.get_node_aligning_start_transform_pfnn(frame_buffer)
          aligning_transform_inv = np.linalg.inv(aligning_transform)
          scale_factor = 1.0 / 10
          local_control_points = []
          for p in control_points:
              local_p = np.dot(aligning_transform_inv, [p[0],0, p[2], 1])[:3]
              local_control_points.append(local_p * scale_factor)
  
          current_position = np.array([0, 0, 0])
          local_control_points = [current_position] + local_control_points + [local_control_points[-1]]
  
          print("stretch control points", len(local_control_points))
          local_control_points = stretch_points(local_control_points, 0.1)
          print("generate motion", len(control_points), len(local_control_points))
          start_position = np.array(frame_buffer[-1][:3])
  
          self.pfnn_wrapper.reset(current_position, 0, np.array([0, 0, 1]))
  
          n_primitives = 0
          new_frames = []
          while len(local_control_points) > 0 and not self.stop_thread:
              # get direction vector from control points
              target_dir = self.get_avg_direction(current_position, local_control_points)
              distance = np.linalg.norm(target_dir)
              target_dir /= distance
              if distance < self.settings.min_pfnn_target_distance:
                  # point has been reached
                  local_control_points.pop(0)
                  print(len(local_control_points), "points remaining")
                  continue
              frame = self.pfnn_wrapper.get_next_frame(target_dir, self.settings.verbose)
              current_position = frame[:3]
              #print("step_controller", current_position, target_pos, self.pfnn_wrapper.phase, distance)
              new_frames.append(frame)
  
              if len(new_frames) > self.settings.min_pfnn_primitive_steps and self.settings.split_pfnn_primitives:
                  # convert the result of the pfnn into a state queue entry
                  scaled_frames = np.array(new_frames)
                  if len(new_frames) > 0:
                      scaled_frames[:, :3] *= 1 / scale_factor
                  if n_primitives > 0:
                      current_node = ("walk", "right_step")
                      node_type = NODE_TYPE_STANDARD
                      apply_smoothing = False
                  else:
                      current_node = ("walk", "right_end_step")
                      node_type = NODE_TYPE_END
                      apply_smoothing = True
                  new_state = self.state_queue.build_pfnn_state(scaled_frames, frame_buffer, aligning_transform, apply_smoothing)
                  self.state_queue.add_state_queue_entry(current_node, node_type, scaled_frames, frame_buffer, self.dt, new_state=new_state)
                  new_frames = []
                  frame_buffer = np.array(self.state_queue.get_last_state().state.mv.frames).tolist()
                  n_primitives+=1
  
          # convert the result of the pfnn into a state queue entry
          new_frames = np.array(new_frames)
          if len(new_frames) >0:
              current_node = ("walk", "right_end_step")
              node_type = NODE_TYPE_END
              new_frames[:,:3] *= 1/scale_factor
              #new_frames[:,:3] += start_position
              apply_smoothing = True
              if n_primitives > 0:
                  apply_smoothing = False
              new_state = self.state_queue.build_pfnn_state(new_frames, frame_buffer, aligning_transform, apply_smoothing=apply_smoothing)
              if new_state.mv.n_frames > 0:
                  self.state_queue.add_state_queue_entry(current_node, node_type, new_frames, frame_buffer, self.dt, new_state=new_state)
          return success, np.linalg.norm(start_position - control_points[-1])
code_tokens: def generate_locomotion_from_pfnn ( self , frame_buffer , control_points ) : success = True self . pfnn_wrapper . controller . traj . blend_bias = self . settings . pfnn_blend_bias aligning_transform = self . get_node_aligning_start_transform_pfnn ( frame_buffer ) aligning_transform_inv = np . linalg . inv ( aligning_transform ) scale_factor = 1.0 / 10 local_control_points = [ ] for p in control_points : local_p = np . dot ( aligning_transform_inv , [ p [ 0 ] , 0 , p [ 2 ] , 1 ] ) [ : 3 ] local_control_points . append ( local_p * scale_factor ) current_position = np . array ( [ 0 , 0 , 0 ] ) local_control_points = [ current_position ] + local_control_points + [ local_control_points [ - 1 ] ] print ( "stretch control points" , len ( local_control_points ) ) local_control_points = stretch_points ( local_control_points , 0.1 ) print ( "generate motion" , len ( control_points ) , len ( local_control_points ) ) start_position = np . array ( frame_buffer [ - 1 ] [ : 3 ] ) self . pfnn_wrapper . reset ( current_position , 0 , np . array ( [ 0 , 0 , 1 ] ) ) n_primitives = 0 new_frames = [ ] while len ( local_control_points ) > 0 and not self . stop_thread : target_dir = self . get_avg_direction ( current_position , local_control_points ) distance = np . linalg . norm ( target_dir ) target_dir /= distance if distance < self . settings . min_pfnn_target_distance : local_control_points . pop ( 0 ) print ( len ( local_control_points ) , "points remaining" ) continue frame = self . pfnn_wrapper . get_next_frame ( target_dir , self . settings . verbose ) current_position = frame [ : 3 ] new_frames . append ( frame ) if len ( new_frames ) > self . settings . min_pfnn_primitive_steps and self . settings . split_pfnn_primitives : scaled_frames = np . array ( new_frames ) if len ( new_frames ) > 0 : scaled_frames [ : , : 3 ] *= 1 / scale_factor if n_primitives > 0 : current_node = ( "walk" , "right_step" ) node_type = NODE_TYPE_STANDARD apply_smoothing = False else : current_node = ( "walk" , "right_end_step" ) node_type = NODE_TYPE_END apply_smoothing = True new_state = self . state_queue . build_pfnn_state ( scaled_frames , frame_buffer , aligning_transform , apply_smoothing ) self . state_queue . add_state_queue_entry ( current_node , node_type , scaled_frames , frame_buffer , self . dt , new_state = new_state ) new_frames = [ ] frame_buffer = np . array ( self . state_queue . get_last_state ( ) . state . mv . frames ) . tolist ( ) n_primitives += 1 new_frames = np . array ( new_frames ) if len ( new_frames ) > 0 : current_node = ( "walk" , "right_end_step" ) node_type = NODE_TYPE_END new_frames [ : , : 3 ] *= 1 / scale_factor apply_smoothing = True if n_primitives > 0 : apply_smoothing = False new_state = self . state_queue . build_pfnn_state ( new_frames , frame_buffer , aligning_transform , apply_smoothing = apply_smoothing ) if new_state . mv . n_frames > 0 : self . state_queue . add_state_queue_entry ( current_node , node_type , new_frames , frame_buffer , self . dt , new_state = new_state ) return success , np . linalg . norm ( start_position - control_points [ - 1 ] )
short_docstring: generate a walk motion based on a sequence of target points
  frame_buffer: a list of frames containing pose parameters of the previous frames
  control_points: a list of positions
short_docstring_tokens: generate a walk motion based on a sequence of target points frame_buffer : a list of frames containing pose parameters of the previous frames control_points : a list of positions
comment: """generate a walk motion based on a sequence of target points
          frame_buffer: a list of frames containing pose parameters of the previous frames
          control_points: a list of positions
          """$SEP$# get direction vector from control points$SEP$# point has been reached$SEP$#print("step_controller", current_position, target_pos, self.pfnn_wrapper.phase, distance)$SEP$# convert the result of the pfnn into a state queue entry$SEP$# convert the result of the pfnn into a state queue entry$SEP$#new_frames[:,:3] += start_position