def redrawFunnelsButton(self, change=True): if self.funnels_toggle: variance_x = 1.5 + abs(self.XVelocity_drawing*0.1) variance_y = 1.5 + abs(self.YVelocity_drawing*0.1) variance_z = 1.5 + abs(self.ZVelocity_drawing*0.1) #self.ActionSet.computeAllPositions(self.XVelocity_drawing,self.YVelocity_drawing,self.ZVelocity_drawing) #find almost equally spaced indexes indices_to_draw = np.zeros(10) indices_to_draw[0] = 0 next_time = 0 + self.ActionSet.t_f/10.0 number = 0 for index, value in enumerate(self.ActionSet.overall_t_vector): if value > next_time: indices_to_draw[number] = index number = number + 1 next_time = next_time + self.ActionSet.t_f/10.0 for index, value in enumerate(indices_to_draw): time = self.ActionSet.overall_t_vector[value] x_center = self.ActionSet.pos_trajectories[self.funnel_number,0,value] y_center = self.ActionSet.pos_trajectories[self.funnel_number,1,value] z_center = self.ActionSet.pos_trajectories[self.funnel_number,2,value] World.buildEllipse(index, [x_center,y_center,z_center], variance_x*time, variance_y*time, variance_z*time, alpha=0.3)
def onDrawFunnelsButton(self, change=True): if change == True: self.funnel_number_x = self.funnel_number_x + 1 if self.funnel_number_x == 5: self.funnel_number_x = 0 self.funnel_number_y = self.funnel_number_y + 1 if self.funnel_number_y == 5: self.funnel_number_y = 0 print "I pressed the draw funnels button" variance_x = 1.5 + abs(self.XVelocity_drawing*0.1) variance_y = 1.5 + abs(self.YVelocity_drawing*0.1) variance_z = 0.2 self.ActionSet.computeAllPositions(self.XVelocity_drawing,self.YVelocity_drawing) print np.shape(self.ActionSet.p_x_trajectories), "is my shape" for i in xrange(np.size(self.ActionSet.p_x_trajectories,1)): print i x_center = self.ActionSet.p_x_trajectories[self.funnel_number_x,i] y_center = self.ActionSet.p_y_trajectories[self.funnel_number_y,i] print x_center, y_center World.buildEllipse(i, [x_center,y_center,0], variance_x*i/10.0*0.5, variance_y*i/10.0*0.5, variance_z, alpha=0.3)
def onDrawFunnelsButton(self): self.funnels_toggle = not self.funnels_toggle if self.funnels_toggle: self.onDrawActionSetButton() if not self.funnels_toggle: for i in xrange(0,10): x_center = self.ActionSet.pos_trajectories[self.funnel_number,0,i] y_center = self.ActionSet.pos_trajectories[self.funnel_number,1,i] z_center = self.ActionSet.pos_trajectories[self.funnel_number,2,i] World.buildEllipse(i, [x_center,y_center,z_center], 0.0, 0.0, 0.0, alpha=0.3)
def drawChosenFunnel(self): velocity_initial_x = self.stateOverTime[self.currentIdx,2] velocity_initial_y = self.stateOverTime[self.currentIdx,3] variance_x = 2.5 + abs(velocity_initial_x*0.1) variance_y = 2.5 + abs(velocity_initial_y*0.1) variance_z = 1.5 x_index = self.actionIndicesOverTime[self.currentIdx,0] y_index = self.actionIndicesOverTime[self.currentIdx,1] for i in xrange(0,10): time = 0.5/10.0*i x_center = self.ActionSet.p_x_trajectories[x_index, i] y_center = self.ActionSet.p_y_trajectories[y_index, i] z_center = 0.0 World.buildEllipse(i, [x_center,y_center,z_center], variance_x*time, variance_y*time, variance_z*time, alpha=0.3)