class_docstr: Customized target trajectory here, it support 3 ways currently
  1.fixed_speed, e.g. reset(.., fixed_speed=1.25)
  2.stage , e.g. reset(.., stage=1)
  3.boundary, e.g. reset(.., boundary=True)
class_docstr_tok: ["Customized","target","trajectory","here",",","it","support","3","ways","currently","1.fixed_speed",",","e.g",".","reset","(","..",",","fixed_speed=1.25",")","2.stage",",","e.g",".","reset","(","..",",","stage=1",")","3.boundary",",","e.g",".","reset","(","..",",","boundary=True",")"]
code: def generate_stage_targets(self, poisson_lambda=300, stage=None):
      nsteps = self.time_limit + 1
      velocity = np.zeros(nsteps)
      heading = np.zeros(nsteps)
  
      velocity[0] = 1.25
      heading[0] = 0
  
      change = np.cumsum(np.random.poisson(poisson_lambda, 10))
      if stage == 0:
          change = []
      elif stage == 1:
          change = change[:1]
      elif stage == 2:
          change = change[:2]
      elif stage == 3:
          if change[3] <= 1000:
              change = change[:4]
          else:
              change = change[:3]
      else:
          raise NotImplemented
  
      if self.discrete_data:
          target_vels = self._generate_target_vel(
              stage=stage, change_num=len(change)
          )
  
      change_cnt = 0
      for i in range(1, nsteps):
          velocity[i] = velocity[i - 1]
          heading[i] = heading[i - 1]
  
          if i in change:
              change_cnt += 1
              if self.discrete_data:
                  velocity[i] = target_vels[change_cnt]
              else:
                  velocity[i] += random.choice(
                      [-1, 1]
                  ) * random.uniform(-0.5, 0.5)
              heading[i] += random.choice([-1, 1]) * random.uniform(
                  -math.pi / 8, math.pi / 8
              )
  
      trajectory_polar = np.vstack((velocity, heading)).transpose()
      targets = np.apply_along_axis(self.rect, 1, trajectory_polar)
      return targets
  
imports: import abc
  import gym
  import math
  import numpy
  import random
  from collections import OrderedDict
  from osim.env import ProstheticsEnv
  from parl.utils import logger
  from tqdm import tqdm
label_desc: Use image node_id 6 for calling the CustomR2Env obj's underlying member method code with example usage: obj.generate_stage_targets(poisson_lambda, stage) and returns: targets