Advertisement
Guest User

Initialize Particles

a guest
Jul 26th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. def initialize_particles(self, init_pose):
  2.         """
  3.        TODO
  4.        initialize the particles randomly around the init_pose
  5.  
  6.        Use np.random.normal to normally distribute the position
  7.        and angle based on the standard deviations self.init_pos_dev and
  8.        self.init_ang_dev
  9.        """
  10.        
  11.         self.particles = np.zeros((self.num_particles, 3))
  12.         for i in range(self.num_particles):
  13.             self.particles[i,0] = np.random.normal(init_pose[0],self.init_pos_dev)
  14.             self.particles[i,1] = np.random.normal(init_pose[1],self.init_pos_dev)
  15.             self.particles[i,2] = np.random.normal(init_pose[2],self.init_ang_dev)      
  16.         print self.particles    
  17.        
  18.  
  19.         self.publish_pose()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement