Rose-Hulman Robotics Team

Changeset 650 for trunk/software

Show
Ignore:
Timestamp:
02/02/10 01:13:36 (2 years ago)
Author:
mosttw
Message:

Made Drive set duty cycle rather than use PID; capture script now captures video from Elphel; logs now saved with .log extension

Location:
trunk/software
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/software/logs

    • Property svn:ignore set to
      *.log
  • trunk/software/pics

    • Property svn:ignore set to
      *.jpg
  • trunk/software/rb/controller.py

    r636 r650  
    132132                        from rb.transcript import TranscriptLogger 
    133133                        self.transcript = TranscriptLogger( 
    134                                         datetime.now().strftime('logs/rblog-%Y-%M-%d-%H:%m:%s.txt'), 
     134                                        datetime.now().strftime('logs/rblog-%Y-%m-%dT%H:%M:%S.log'), 
    135135                                        self.drive, self.gps, self.microstrain) 
    136136 
  • trunk/software/rb/drive.py

    r648 r650  
    1 # Copyright (C) 2008-2009 Thomas W. Most 
     1# Copyright (C) 2008-2010 Thomas W. Most 
    22# Copyright (C) 2009 Andy Spencer 
    33# 
     
    168168        def _main(self): 
    169169                logger.info("Motor %s main starting", self.dev) 
     170                # TODO: Make this robust against disconnections 
     171                while self._send('disable') is None and self.drive.running: 
     172                        logger.debug('Trying to disable PID on controller %s', self._port_name) 
     173                        time.sleep(0.5) 
    170174                while self.drive.running: 
    171175                        self._send('setdc', self.target * DC_MAX) # Ping! 
    172                         time.sleep(.05) 
     176                        time.sleep(0.05) 
    173177                logger.info("Motor %s main terminating", self.dev) 
    174178                self._send('setdc', 0) 
     
    185189                        ln = self._port.write(chr(t['op'])) 
    186190                        self._port.write(chr(len(t_st))) 
    187                         self._port.write(t_st) 
     191                        if t_st: 
     192                                self._port.write(t_st) 
    188193                         
    189194                        # Recieve response 
     
    200205                        r_length = ord(r_length) 
    201206                        if r_length != struct.calcsize(r['fmt']): 
    202                                 print "Motor._send: Recieved incorrect `r_length' (%d) from motor controller %s" % (r_length, self._port_name) 
     207                                logger.error("Recieved incorrect `r_length' (%d) from motor controller %s", 
     208                                                r_length, self._port_name) 
    203209 
    204210                        if r_length == 0: 
     
    207213                        r_st = self._port.read(r_length) 
    208214                        if len(r_st) != r_length: 
    209                                 print "Motor._send: Timeout reading `r_data' from motor controller" 
     215                                logger.error("Timeout reading `r_data' from motor controller %s", self._port_name) 
     216                                return None 
    210217                        r_data = struct.unpack(r['fmt'], r_st) 
    211218 
  • trunk/software/scripts/capture.sh

    r534 r650  
    11#!/usr/bin/zsh 
     2# Capture video from the Elphel. 
    23 
    3 #PID='' 
    4 I=1 
    5 while true; do 
    6   wget 'http://192.168.1.4:8081/bimg' -O img.$I.jpg 
    7   #kill $PID 
    8   #eog img.$I.jpg & 
    9   #PID=$! 
    10   I=`dc <<< "$I 1 + p"` 
    11   sleep 1 
    12 done 
     4gst-launch-0.10 \ 
     5  rtspsrc location=rtsp://192.168.27.3:554 latency=100 ! \ 
     6  rtpjpegdepay ! \ 
     7  matroskamux ! \ 
     8  filesink location=capture.mkv 
    139