Subversion Repositories Projects

Rev

Rev 552 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 552 Rev 563
Line 174... Line 174...
174
            raise InvalidMsgType
174
            raise InvalidMsgType
175
        self.msg = msg
175
        self.msg = msg
Line 176... Line 176...
176
       
176
       
177
     def getData(self):
177
     def getData(self):
178
        data = []
178
        data = []
179
        for i in range(0,25):
179
        for i in range(0,50):
180
          data.append(self.msg.data2SignedInt(2*i))
180
          data.append(self.msg.data2SignedInt(2*i))
Line 181... Line 181...
181
        return data
181
        return data
182
 
182
 
Line 208... Line 208...
208
    def open(self, comPort):
208
    def open(self, comPort):
209
        self.serPort = serial.Serial(comPort, 57600, timeout=0.5)
209
        self.serPort = serial.Serial(comPort, 57600, timeout=0.5)
210
        if not self.serPort.isOpen():
210
        if not self.serPort.isOpen():
211
            raise IOError("Failed to open serial port")
211
            raise IOError("Failed to open serial port")
Line -... Line 212...
-
 
212
 
-
 
213
    def close(self):
-
 
214
        self.serPort.close()
212
 
215
       
213
    def isOpen(self):
216
    def isOpen(self):
Line 214... Line 217...
214
        return self.serPort != None
217
        return self.serPort != None
215
 
218
 
Line 253... Line 256...
253
        msg = MkMsg(address=MkComm.FCADDRESS, cmd='t', data=motorSpeeds)
256
        msg = MkMsg(address=MkComm.FCADDRESS, cmd='t', data=motorSpeeds)
254
        self.sendLn(msg.generateMsg())
257
        self.sendLn(msg.generateMsg())
Line 255... Line 258...
255
       
258
       
256
    def doVibrationTest(self, motorSpeeds, nbSamples, channel):
259
    def doVibrationTest(self, motorSpeeds, nbSamples, channel):
257
        data = []
260
        data = []
258
        for i in range(0,min(nbSamples,1000)/50):
261
        for i in range(0,(min(nbSamples,1000)/50)):
259
          self.setMotorTest(motorSpeeds)
262
          self.setMotorTest(motorSpeeds)
260
          time.sleep(0.05)
263
          time.sleep(0.05)
261
          #print i 
264
          #print i 
262
          msg = MkMsg(address=MkComm.FCADDRESS, cmd='f', data=[channel, i])
265
          msg = MkMsg(address=MkComm.FCADDRESS, cmd='f', data=[channel, i])