예제 #1
0
def apex_disarm(pfc_path):
    tom = shell.Shell(pfc_path)
    sleep(3)
    tom.sendline('squib @apex hard soft aux disarm')
    sleep(3)
    tom.close()
    sleep(3)
예제 #2
0
def config_acs(pfc_path):
  sleep(5)
  tom = shell.Shell(pfc_path)
  sleep(1)
  sb = shell.Scoreboard(tom,'acs')
  sleep(1)
  tom.sendline('power on acs')
  sleep(3)
  print sb.query('power_acs_enabled')
  sleep(1)
  tom.sendline('acs esc on')
  sleep(5)
  esc_state = str(sb.query('acs_fan_esc_power_state'))
  current_esc_state = esc_state.split("'")[3]
  sleep(3)

  while current_esc_state != 'On':
    tom.sendline('acs esc on')
    sleep(6)
    esc_state = str(sb.query('acs_fan_esc_power_state'))
    current_esc_state = esc_state.split("'")[3]
    print current_esc_state
    sleep(2)

  print sb.query('acs_fan_esc_switch_on')
  esc_temp = str(sb.query('acs_temperature_fan_esc'))
  current_esc_temp = esc_temp.split("'")[3]
  print current_esc_temp
  tom.close()
  sleep(3)
  return float(current_esc_temp)
예제 #3
0
def apex_stfu(pfc_path):
    tom = shell.Shell(pfc_path)
    sleep(3)
    tom.sendline('beeper stfu')
    sleep(3)
    tom.close()
    sleep(3)
예제 #4
0
def apex_unfire(pfc_path):
    tom = shell.Shell(pfc_path)
    sleep(3)
    tom.sendline('squib @apex hard soft aux request unfire')
    sleep(3)
    tom.close()
    sleep(3)
예제 #5
0
def apex_power(pfc_path):
    tom = shell.Shell(pfc_path)
    sleep(3)
    tom.sendline('power on apex')
    sleep(3)
    tom.close()
    sleep(3)
예제 #6
0
def query_specific(pfc_path):
    tom = shell.Shell(pfc_path)
    sleep(3)
    sb = shell.Scoreboard(tom, 'apex')
    sleep(3)
    sbmap = sb.query()
    tom.close()
    return sbmap
예제 #7
0
def query_sb(pfc_path):
    tom = shell.Shell(pfc_path)
    sleep(3)
    sb = shell.Scoreboard(tom, 'apex')
    sleep(3)
    msg = str(sb.query('apex'))
    tom.close()
    return msg
예제 #8
0
def fs_format(pfc_path):

    print "Formating SD card..."
    tom = shell.Shell(pfc_path)
    sleep(5)
    tom.sendline('fs format')
    sleep(10)
    tom.close()
    print "Finished formatting"
예제 #9
0
def config_acs_setpoint(pfc_path, esc_setpoint):
  tom = shell.Shell(pfc_path)
  sleep(1)
  sb = shell.Scoreboard(tom,'acs')
  tom.sendline('heater set acs.main %s' % esc_setpoint)
  sleep(3)
  acs_sp = str(sb.query('acs_heater_setpoint_main'))
  current_acs_sp = acs_sp.split("'")[3]
  print 'ACS setpoint was set to %s' % current_acs_sp
  tom.close()
예제 #10
0
def clean_acs(pfc_path):
    sleep(5)
    tom = shell.Shell(pfc_path)
    sleep(1)
    sb = shell.Scoreboard(tom, 'acs')
    sleep(1)
    tom.sendline('power off acs')
    sleep(3)
    print sb.query('power_acs_enabled')
    sleep(1)
    tom.close()
예제 #11
0
def check_esc_temp(pfc_path):
    tom = shell.Shell(pfc_path)
    sleep(1)
    sb = shell.Scoreboard(tom, 'acs')
    sleep(3)
    esc_temp = str(sb.query('acs_temperature_fan_esc'))
    current_esc_temp = esc_temp.split("'")[3]
    print current_esc_temp
    tom.close()
    sleep(3)
    return float(current_esc_temp)
예제 #12
0
파일: flash.py 프로젝트: xuniuer/python
def parallel_flash(boards_to_flash, firmware_dir):
    assert boards_to_flash, (
        'Cannot identify boards to flash; must specify with --board')

    pfc_tuple = utils.find_pfc_type()
    detected_pfc_type, pfc_shell_device = (None, None)
    if pfc_tuple:
        detected_pfc_type, pfc_shell_device = pfc_tuple

    pfc_count = 0
    expected_pfc_type = None
    if 'half_stack_hv_pfc' in boards_to_flash:
        pfc_count += 1
        expected_pfc_type = 'half_stack_hv_pfc'

    assert pfc_count <= 1, 'Must specify at most one PFC type.'

    # Flashing a PFC device is requested, so try to verify the PFC attached
    # matches the specified PFC type.
    if pfc_count == 1:
        assert detected_pfc_type, 'Cannot flash pfc, no device found'

        if detected_pfc_type != utils.PFC_TYPE_UNKNOWN:
            assert detected_pfc_type == expected_pfc_type, (
                'Mismatch between actual and expected pfc type.')

    sh = None
    if pfc_shell_device:
        try:
            sh = shell.Shell(pfc_shell_device)
        except Exception:
            print >> sys.stderr, 'Unable to connect to PFC Shell!!!!!'
            sys.exit(1)

    maybe_power_on(boards_to_flash, sh, expected_pfc_type, firmware_dir)

    print 'Flashing boards: %s' % boards_to_flash
    flashing_threads = []
    for board in boards_to_flash:
        flashing_threads.append(BoardFlasher(board, firmware_dir))

    # Flash the boards in parallel.
    for thread in flashing_threads:
        thread.start()
    error = False
    for thread in flashing_threads:
        thread.join()
        error = error or thread.had_error
    # Final report in one place
    for thread in flashing_threads:
        thread.final_status()
    if error:
        sys.exit(1)
예제 #13
0
def config_esc_setpoint(pfc_path, esc_setpoint):
  tom = shell.Shell(pfc_path)
  sleep(1)
  sb = shell.Scoreboard(tom,'acs')
  tom.sendline('heater set acs.esc.on %s' % esc_setpoint)
  sleep(3)
  tom.sendline('acs esc_activation_temperature %s' % esc_setpoint)
  sleep(3)
  esc_sp = str(sb.query('acs_heater_setpoint_fan_esc'))
  current_esc_sp = esc_sp.split("'")[3]
  print 'ESC setpoint was set to %s' % current_esc_sp
  tom.close()
예제 #14
0
def squib_status(pfc_path):
    tom = shell.Shell(pfc_path)
    sleep(3)
    sb = shell.Scoreboard(tom, 'apex')
    sleep(3)
    hard = str(sb.query('apex_hard_squib_state'))
    soft = str(sb.query('apex_soft_squib_state'))
    aux = str(sb.query('apex_aux_squib_state'))
    print hard
    print soft
    print aux
    hard = (hard.split("'")[3])
    soft = (soft.split("'")[3])
    aux = (aux.split("'")[3])
    tom.close()
    sleep(3)
    return (hard, soft, aux)
예제 #15
0
def sb_measure(pfc_path):

    print "Recording MB SB data..."
    tom = shell.Shell(pfc_path)
    sleep(2)
    sb = shell.Scoreboard(tom, '')
    sleep(2)
    ts = utils.get_timestamp()
    logfile.write(ts)
    for sbvar in sbvars:
        logfile.write(',%s' % str(sb.query(sbvar)).split("'")[3])
    vardata = str(sb.query_i2c())
    for i in range(24):
        vdata = vardata.split(",")[i - 1]
        data = vdata.split(":")[1]
        logfile.write(',%s' % data)
    logfile.write(',\n')
    tom.close()
    print "Finished recording data"
예제 #16
0
    def initialize(self):
        if self.initialized:
            return

        if self.gdb_enabled:
            config_dir = os.path.join(os.path.dirname(__file__), '../src/app')
            make_binary = os.path.join(self.app_dir,
                                       '{0:s}/release/{0:s}'.format(self.name))
            cobble_binary = os.path.join(self.app_dir,
                                       '{0:s}/{0:s}'.format(self.name))
            openocd_cfg = os.path.join(config_dir, '{0:s}'.format(self.name))

            binary = cobble_binary
            if os.path.isfile(make_binary):
                binary = make_binary

            openocd_log = None
            gdb_log = None
            if self.log_gdb_flag:
                if not os.path.exists('test_logs'):
                    os.mkdir('test_logs')
                gdb_log = open(
                        'test_logs/{:s}_gdb_log.txt'.format(self.name), 'w')
                openocd_log = open(
                        'test_logs/{:s}_openocd_log.txt'.format(self.name), 'w')

            self.openocd = openocd.Openocd(self.debug_port,
                                           openocd_cfg,
                                           openocd_log)
            self.gdb = gdb.Gdb(self.debug_port, binary, gdb_log)

        if self.serial_device:
            self.shell = shell.Shell(self.serial_device,
                                     self.command_logfunc,
                                     self.serial_log)
            self.scoreboard = self.shell.scoreboard

        self.initialized = True
예제 #17
0
    sore.all_output('on')
    sleep(1)
    unit_id = config_common.prompt_unit(NAME)
    sn = unit_id.split("FL")[1]

    # Flash
    config_common.run_flash_firmware(args.firmware_dir, IMAGE_NAME)
    sleep(1)
    sore.all_output('off')
    sleep(5)
    sore.all_output('on')
    sleep(10)

    # Flash S/N
    tom = shell.Shell(bridge_path)
    sleep(1)
    sb = shell.Scoreboard(tom, 'gxpr_bridge')
    sleep(1)
    print sb.query('version_hash_gxpr')
    tom.sendline('test set_system_info %s' % sn)
    sleep(3)
    print sb.query('gxpr_serial_number')
    print sb.query('gxpr_fpga_sw_version')
    sleep(1)

    aeromap = aero.measure()

    print "   GXPR Status: " + aeromap['overall']
    print "   GXPR ERP: " + aeromap['power_boterp_value']
    print "   GXPR MTL: " + aeromap['power_botmtl_value']
예제 #18
0
def batt_charging(target_volt, target_current, max_temp, min_temp, max_diff, min_diff, monitor_freq, batt_num):

  is_it_done_yet = False

  ps1.ind_output('1','on')
  sleep(1)

  if batt_num == '2':
    ps1.ind_output('2','on')
    sleep(1)
  elif batt_num == '3':
    ps1.ind_output('2','on')
    sleep(1)
    ps2.ind_output('1','on')
    sleep(1)
  elif batt_num == '4':
    ps1.ind_output('2','on')
    sleep(1)
    ps2.ind_output('1','on')
    sleep(1)
    ps2.ind_output('2','on')
    sleep(1)
  else:
    if batt_num != '1':
      raise Exception, 'Unknown command.'

  while True:

    for i in range(int(batt_num)):

      print i
      if i == 1:
        path = pfc1_path
      elif i == 2:
        path = pfc2_path
      elif i == 3:
        path = pfc3_path
      elif i == 4:
        path = pfc4_path
      else:
        raise Exception, 'Unknown range.'

      tom = shell.Shell(path)
      sb = shell.Scoreboard(tom,'battery')

      state = check_batt_charge(target_volt, target_current, max_temp, min_temp, max_diff, min_diff, monitor_freq, batt_num)

      if i == 1:
        ch1_state = state
      elif i == 2:
        ch2_state = state
      elif i == 3:
        ch3_state = state
      elif i == 4:
        ch4_state = state
      else:
        raise Exception, 'Unknown range.'

      tom.close()

    if batt_num == '1':

      if ch1_state == 1:
        break

    elif batt_num == '2':

      if ch1_state == 1 and ch2_state == 1:
        break

    elif batt_num == '3':

      if ch1_state == 1 and ch2_state == 1 and ch3_state == 1:
        break

    elif batt_num == '4':

      if ch1_state == 1 and ch2_state == 1 and ch3_state == 1 and ch4_state == 1:
        break

    print "Checking measurement again in another %s seconds" % monitor_freq
    sleep(monitor_freq)
예제 #19
0
def config_burnin(pfc_path, ontime):
  tom = shell.Shell(pfc_path)
  sleep(3)
  tom.sendline('acs descend 0 %s 100 400' % ontime )
  sleep(3)
  tom.close()
예제 #20
0
    ps1.set_currentlimit(2, charge_i)
    ps2.set_voltage(1, charge_v)
    ps2.set_currentlimit(1, charge_i)
elif batt_num == '4':
    ps1.set_voltage(2, charge_v)
    ps1.set_currentlimit(2, charge_i)
    ps2.set_voltage(1, charge_v)
    ps2.set_currentlimit(1, charge_i)
    ps2.set_voltage(2, charge_v)
    ps2.set_currentlimit(2, charge_i)
else:
    if batt_num != '1':
        raise Exception, 'Unknown command.'

print "Accessing the PFCs"
tom1 = shell.Shell(pfc1_path)
sb1 = shell.Scoreboard(tom1, 'battery')
if batt_num == '2':
    tom2 = shell.Shell(pfc2_path)
    sb2 = shell.Scoreboard(tom2, 'battery')
elif batt_num == '3':
    tom2 = shell.Shell(pfc2_path)
    sb2 = shell.Scoreboard(tom2, 'battery')
    tom3 = shell.Shell(pfc3_path)
    sb3 = shell.Scoreboard(tom3, 'battery')
elif batt_num == '4':
    tom2 = shell.Shell(pfc2_path)
    sb2 = shell.Scoreboard(tom2, 'battery')
    tom3 = shell.Shell(pfc3_path)
    sb3 = shell.Scoreboard(tom3, 'battery')
    tom4 = shell.Shell(pfc4_path)
예제 #21
0
파일: masscal.py 프로젝트: xuniuer/python
 def _init(self):
   self._tom = shell.Shell(self._dev, log=self.shell_log)
   self._sb = shell.Scoreboard(self._tom, 'gxpr_bridge')
예제 #22
0
#!/usr/bin/env python
import argparse
import math
import twk_utils

from datetime import datetime
from time import sleep
from tools import shell

pfc_path = '/dev/serial/by-id/usb-loon_onboard_half_stack_hv_pfc-if01-port0'

utils = twk_utils.Twk_utils()

print "Accessing Major Tom"

tom = shell.Shell(pfc_path)
sb = shell.Scoreboard(tom, None)
sbvars = []
sbvars.append('gopro_target_video_on')
sbvars.append('gopro0_video_on')
sbvars.append('gopro0_voltage_camera_5v')
sbvars.append('gopro0_current_camera_5v')
sbvars.append('version_hash_gopro0')
sbvars.append('gopro1_video_on')
sbvars.append('gopro1_voltage_camera_5v')
sbvars.append('gopro1_current_camera_5v')
sbvars.append('version_hash_gopro1')
sbvars.append('gopro2_video_on')
sbvars.append('gopro2_voltage_camera_5v')
sbvars.append('gopro2_current_camera_5v')
sbvars.append('version_hash_gopro2')
예제 #23
0
parser.add_argument('majortom', help='Serial port connected to Major Tom')
parser.add_argument('aeroflex',
                    help='Serial port connected to the Aeroflex IRF 6000')
parser.add_argument('logfile', help='CSV file to append new measurements')
parser.add_argument('-v',
                    '--verbose',
                    action='store_true',
                    help='Tee serial communications to the console')
args = parser.parse_args()

print "Accessing the Aeroflex"
aero = aeroflex.Aeroflex(args.aeroflex)
aerovars = aeroflex.fields()

print "Accessing Major Tom"
tom = shell.Shell(args.majortom)
sb = shell.Scoreboard(tom, None)
sbvars = []
sbvars.append('avionics_barometric_pressure')
sbvars.append('avionics_barometric_pressure_filtered')
sbvars.append('avionics_barometric_pressure_variance')
sbvars.append('avionics_barometer_temperature')
sbvars.append('avionics_secondary_barometric_pressure')
sbvars.append('avionics_secondary_barometer_temperature')
sbvars.append('apex_temperature_barometer')
sbvars.append('apex_barometric_pressure')
sbvars.append('apex_barometric_pressure_filtered')
sbvars.append('apex_barometric_pressure_variance')
sbvars.append('gxpr_bridge_barometric_pressure')
sbvars.append('gxpr_bridge_barometer_temperature')
sbvars.append('gxpr_1_2_rail_voltage')
예제 #24
0
print "Accessing the XPF6020 Power Supply"
charge_v = 50
charge_i = 10
ps = xpf6020.Xpf6020(ps_path)
ps.reset_ps()
ps.set_voltage(1, charge_v)
ps.set_currentlimit(1, charge_i)
if batt_num == '2':
    ps.set_voltage(2, charge_v)
    ps.set_currentlimit(2, charge_i)
else:
    raise Exception, 'Unknown command.'

print "Accessing the PFCs"
tom1 = shell.Shell(pfc1_path)
sb1 = shell.Scoreboard(tom1, 'battery')
if batt_num == '2':
    tom2 = shell.Shell(pfc2_path)
    sb2 = shell.Scoreboard(tom2, 'battery')
else:
    raise Exception, 'Unknown command.'


def batt_charging(target_soc, monitor_freq, batt_num):

    ts = get_timestamp()
    print 'Charging the battery(s)...[' + ts + ']'

    ps.all_output('on')
    sleep(1)