original_docstring: generate a sequence of walk motion primitives based on a direction and a number of steps 
docstring: generate a sequence of walk motion primitives based on a direction and a number of steps
docstring_tokens: generate a sequence of walk motion primitives based on a direction and a number of steps
code: def generate_locomotion_from_motion_primitives_using_direction(self, start_node, start_node_type, pose_buffer, action_desc, end_idle=True):
          """generate a sequence of walk motion primitives based on a direction and a number of steps """
          success = True
          direction = action_desc["direction"]
          n_remaining_steps = action_desc["n_steps"]
          body_orientation_targets = action_desc["body_orientation_targets"]
          upper_body_gesture = action_desc["upper_body_gesture"]
          velocity_factor = action_desc["velocity_factor"]
          step_distance = 80
          if "step_distance" in action_desc:
              step_distance = action_desc["step_distance"]
  
          upper_body_state = None
          if upper_body_gesture is not None:
              upper_body_state = self.generate_upper_body_state(upper_body_gesture)
          current_node = start_node
          node_type = start_node_type
          print("start processing direction", direction)
          while n_remaining_steps > 0 and not self.stop_thread:
              direction_vector = direction
              if n_remaining_steps == 1:
                  step_distance = 0
              if self.collision_boundary is not None and step_distance > 0:
                  points = [np.array(pose_buffer[-1][:3])]
                  points.append(points[0]+step_distance*direction_vector)
                  if self.collision_boundary.check_trajectory(points, 0.0001):
                      print("stop due to collision")
                      step_distance = 0
                      success = False
                      self.state_queue.pop_last_state()
                      last_state = self.state_queue.get_last_state()
                      if last_state is not None:
                          pose_buffer = self.state_queue.get_last_state().pose_buffer
              elif step_distance > 0:
                  print("no collision boundary defined")
              new_frames, current_node, node_type = self.generate_locomotion_step(current_node, node_type, direction_vector, step_distance, pose_buffer, body_orientation_targets, upper_body_state, velocity_factor, end_idle)
              self.state_queue.add_state_queue_entry(current_node, node_type, new_frames, pose_buffer, self.dt)
              n_remaining_steps-=1
              time.sleep(self.settings.sleep_time)
              print("generated state")
          return success, 0
code_tokens: def generate_locomotion_from_motion_primitives_using_direction ( self , start_node , start_node_type , pose_buffer , action_desc , end_idle = True ) : success = True direction = action_desc [ "direction" ] n_remaining_steps = action_desc [ "n_steps" ] body_orientation_targets = action_desc [ "body_orientation_targets" ] upper_body_gesture = action_desc [ "upper_body_gesture" ] velocity_factor = action_desc [ "velocity_factor" ] step_distance = 80 if "step_distance" in action_desc : step_distance = action_desc [ "step_distance" ] upper_body_state = None if upper_body_gesture is not None : upper_body_state = self . generate_upper_body_state ( upper_body_gesture ) current_node = start_node node_type = start_node_type print ( "start processing direction" , direction ) while n_remaining_steps > 0 and not self . stop_thread : direction_vector = direction if n_remaining_steps == 1 : step_distance = 0 if self . collision_boundary is not None and step_distance > 0 : points = [ np . array ( pose_buffer [ - 1 ] [ : 3 ] ) ] points . append ( points [ 0 ] + step_distance * direction_vector ) if self . collision_boundary . check_trajectory ( points , 0.0001 ) : print ( "stop due to collision" ) step_distance = 0 success = False self . state_queue . pop_last_state ( ) last_state = self . state_queue . get_last_state ( ) if last_state is not None : pose_buffer = self . state_queue . get_last_state ( ) . pose_buffer elif step_distance > 0 : print ( "no collision boundary defined" ) new_frames , current_node , node_type = self . generate_locomotion_step ( current_node , node_type , direction_vector , step_distance , pose_buffer , body_orientation_targets , upper_body_state , velocity_factor , end_idle ) self . state_queue . add_state_queue_entry ( current_node , node_type , new_frames , pose_buffer , self . dt ) n_remaining_steps -= 1 time . sleep ( self . settings . sleep_time ) print ( "generated state" ) return success , 0
short_docstring: generate a sequence of walk motion primitives based on a direction and a number of steps
short_docstring_tokens: generate a sequence of walk motion primitives based on a direction and a number of steps
comment: """generate a sequence of walk motion primitives based on a direction and a number of steps """