コード例 #1
0
ファイル: parkingBrain.py プロジェクト: graceyin1218/6-oh-fun
def on_stop():
    if not REAL_ROBOT:
        code = checkoff.generate_code(globals())
        if isinstance(code, bytes):
            code = code.decode()
        print("Hex Code for Tutor:\n%s" % code, file=sys.stderr)
        p = PlotWindow()
        p.plot(robot.probMeasures)
        p.axes[0].set_ylim([0.0, 1.0])
コード例 #2
0
ファイル: parkingBrain.py プロジェクト: graceyin1218/6-oh-fun
def on_stop():
    if not REAL_ROBOT:
        code = checkoff.generate_code(globals())
        if isinstance(code, bytes):
            code = code.decode()
        print("Hex Code for Tutor:\n%s" % code, file=sys.stderr)
        p = PlotWindow()
        p.plot(robot.probMeasures)
        p.axes[0].set_ylim([0.0,1.0])
コード例 #3
0
ファイル: plotters.py プロジェクト: Edward-Wei/mit-courses
 def plot(self, data):
   t_samples, probe_samples = [], []
   for t, solution in data.items():
     # ensure that the probes are in the solved circuits
     assert self._probe_plus in solution, ('+probe is disconnected from '
         'circuit')
     assert self._probe_minus in solution, ('-probe is disconnected from '
         'circuit')
     t_samples.append(t)
     probe_samples.append(
         solution[self._probe_plus] - solution[self._probe_minus])
   probe_plot = PlotWindow('Probe voltage difference')
   probe_plot.stem(t_samples, probe_samples)
コード例 #4
0
 def plot(self, data):
     # motor angle
     angle_plot = PlotWindow('Motor %s angle' % self._motor.label)
     angle_plot.stem(T_SAMPLES, self._motor.angle_samples[:-1])
     # motor speed
     speed_plot = PlotWindow('Motor %s speed' % self._motor.label)
     speed_plot.stem(T_SAMPLES, self._motor.speed_samples[:-1])
コード例 #5
0
 def plot(self, data):
     t_samples, probe_samples = [], []
     for t, solution in data.items():
         # ensure that the probes are in the solved circuits
         assert self._probe_plus in solution, (
             '+probe is disconnected from '
             'circuit')
         assert self._probe_minus in solution, (
             '-probe is disconnected from '
             'circuit')
         t_samples.append(t)
         probe_samples.append(solution[self._probe_plus] -
                              solution[self._probe_minus])
     probe_plot = PlotWindow('Probe voltage difference')
     probe_plot.stem(t_samples, probe_samples)
コード例 #6
0
ファイル: simulate.py プロジェクト: Edward-Wei/mit-courses
 def myPlot(s,title,y0,y1):
     if nSamples>1:
         samps = [s.sample(x) for x in xrange(nSamples)]
         yy0 = min(samps)
         yy1 = max(samps)
         if float(yy1-y0)/float(y1-y0+.001)>0.9:
             y1 = yy1
         if float(y1-yy0)/float(y1-y0+.001)>0.9:
             y0 = yy0
         p = PlotWindow(title)
         p.stem(range(nSamples),samps)
         p.axis([0,nSamples,y0,y1])
         add_window(p)
     warning = str(title)+':'
     for nn in range(nSamples):
         warning += '{0:6.2f}'.format(s.sample(nn))
     warn(warning)
コード例 #7
0
ファイル: plotters.py プロジェクト: Edward-Wei/mit-courses
 def plot(self, data):
   # motor angle
   angle_plot = PlotWindow('Motor %s angle' % self._motor.label)
   angle_plot.stem(T_SAMPLES, self._motor.angle_samples[:-1])
   # motor speed
   speed_plot = PlotWindow('Motor %s speed' % self._motor.label)
   speed_plot.stem(T_SAMPLES, self._motor.speed_samples[:-1])
コード例 #8
0
 def plot(self, data):
     # motor
     if self._head_connector.motor_present:
         self._head_connector.motor.label = self._head_connector.motor_label
         Motor_Plotter(self._head_connector.motor).plot(data)
     # lamp distance signal
     if self._head_connector.lamp_distance_signal:
         distance_plot = PlotWindow('Lamp %s distance' %
                                    self._head_connector.photo_label)
         distance_plot.stem(
             T_SAMPLES,
             self._head_connector.lamp_distance_signal.samples(
                 0, T, NUM_SAMPLES))
     # lamp angle signal
     if self._head_connector.lamp_angle_signal:
         angle_plot = PlotWindow('Lamp %s angle' %
                                 self._head_connector.photo_label)
         angle_plot.stem(
             T_SAMPLES,
             self._head_connector.lamp_angle_signal.samples(
                 0, T, NUM_SAMPLES))
コード例 #9
0
ファイル: plotters.py プロジェクト: Edward-Wei/mit-courses
 def plot(self, data):
   # motor
   if self._head_connector.motor_present:
     self._head_connector.motor.label = self._head_connector.motor_label
     Motor_Plotter(self._head_connector.motor).plot(data)
   # lamp distance signal
   if self._head_connector.lamp_distance_signal:
     distance_plot = PlotWindow('Lamp %s distance' %
         self._head_connector.photo_label)
     distance_plot.stem(T_SAMPLES,
         self._head_connector.lamp_distance_signal.samples(0, T, NUM_SAMPLES))
   # lamp angle signal
   if self._head_connector.lamp_angle_signal:
     angle_plot = PlotWindow('Lamp %s angle' %
         self._head_connector.photo_label)
     angle_plot.stem(T_SAMPLES, self._head_connector.lamp_angle_signal.samples(
         0, T, NUM_SAMPLES))
コード例 #10
0
 def myPlot(s, title, y0, y1):
     if nSamples > 1:
         samps = [s.sample(x) for x in xrange(nSamples)]
         yy0 = min(samps)
         yy1 = max(samps)
         if float(yy1 - y0) / float(y1 - y0 + .001) > 0.9:
             y1 = yy1
         if float(y1 - yy0) / float(y1 - y0 + .001) > 0.9:
             y0 = yy0
         p = PlotWindow(title)
         p.stem(range(nSamples), samps)
         p.axis([0, nSamples, y0, y1])
         add_window(p)
     warning = str(title) + ':'
     for nn in range(nSamples):
         warning += '{0:6.2f}'.format(s.sample(nn))
     warn(warning)
コード例 #11
0
 def plot(self, data):
     alpha_plot = PlotWindow('Pot %s alpha' % self._pot.label)
     alpha_plot.stem(T_SAMPLES, self._pot.signal.samples(0, T, NUM_SAMPLES))
コード例 #12
0
def brainStop():
    p = PlotWindow()
    p.plot(robot.distance)  # plot the list of distances
コード例 #13
0
ファイル: wallFollowerBrain.py プロジェクト: hanw/mit-courses
def brainStop():
    p = PlotWindow()
    p.plot(robot.distance)  # plot the list of distances
コード例 #14
0
ファイル: plotters.py プロジェクト: Edward-Wei/mit-courses
 def plot(self, data):
   alpha_plot = PlotWindow('Pot %s alpha' % self._pot.label)
   alpha_plot.stem(T_SAMPLES, self._pot.signal.samples(0, T, NUM_SAMPLES))
コード例 #15
0
def brainStop():
    p = PlotWindow('Slime Trail')
    soarWorld.plotSoarWorld(PATH_TO_WORLD,p) #show the soar world
    p.plot(robot.slimeX,robot.slimeY) #plot the recorded slime trail data
コード例 #16
0
ファイル: localizeBrain.py プロジェクト: lasernite/6.01
def brainStop():
    p = PlotWindow()
    p.plot(robot.probMeasures)
    p.axes[0].set_ylim([0.0,1.0])
コード例 #17
0
def brainStop():
    p = PlotWindow('Slime Trail')
    soarWorld.plotSoarWorld(PATH_TO_WORLD, p)  #show the soar world
    p.plot(robot.slimeX, robot.slimeY)  #plot the recorded slime trail data
コード例 #18
0
def stemplot(response):
    PlotWindow().stem(range(len(response)), response)
コード例 #19
0
def brainStop():
    p = PlotWindow()
    p.plot(robot.distance)