Esempio n. 1
0
def getimu(m, addr):
  m.setaddr(addr)
  m.flush()
  m.loadheli(cmd.mode(cmd.mode_get_imu))
  m.sendbase(cmd.mode(cmd.mode_sendrecv))
  try:
    (arr, t, crc) = m.nextline()
    if (arr == False):
      sys.stderr.write("\n** Error ** ")
      sys.stderr.write(repr(t) + "\n\n")
      return -1, None
    elif arr:
      if crc:
        sys.stderr.write("o")
        sys.stderr.flush()
        return 1, None
      else:
        return 0, arr
    else:
      sys.stderr.write("x")
      sys.stderr.flush()
      return 1, None
  except:
    sys.stderr.write(repr(sys.exc_info()))
    sys.stderr.write("\nQuitting... \n")
    return -1, None
def startup(m):
	m.sendbase(cmd.radio(int(chan)))

	m.sendheli(cmd.flags(cmd.ledmode_cnt + cmd.tick))
	m.sendheli(cmd.mode(cmd.mode_imu_loop))

	m.sendbase(cmd.flags(cmd.ledmode_cnt + cmd.notick))
	m.sendbase(cmd.mode(cmd.mode_sniff))
Esempio n. 3
0
def startup(m,chan):
  m.sendbase(cmd.radio(chan))
  # time.sleep(1)
  m.sendbase(cmd.flags(cmd.ledmode_cnt + cmd.notick))
  # time.sleep(1)

  m.sendheli(cmd.flags(cmd.ledmode_cnt + cmd.tick))
  #time.sleep(1)
  m.sendheli(cmd.mode(cmd.mode_imu_loop))
  #time.sleep(1)

  m.sendbase(cmd.mode(cmd.mode_sniff))
Esempio n. 4
0
def startup(m):
  m.sendbase(cmd.radio(25))
  m.sendbase(cmd.flags(cmd.ledmode_cnt + cmd.notick))

  # m.sendheli(cmd.flags(cmd.ledmode_cnt + cmd.tick))

  m.sendbase(cmd.mode(cmd.mode_sniff))
Esempio n. 5
0
def end(m):
  m.sendbase(cmd.mode(cmd.mode_spin))
  m.end()