Exemplo n.º 1
0
def main(stdscr):
    args = rospy.myargv()[1:]
    cfgfile = find_config_file(args)
    if not cfgfile:
        rospy.logfatal("Could not locate config file.")
        exit(1)
    cfg = RawConfigParser()
    cfg.read(cfgfile)
    bm = BatteryMonitor(stdscr, cfg)
    rospy.init_node(NODE_NAME)
    rospy.Subscriber(SUBSCRIBE_TOPIC, RobotState, bm.on_update)
    rate = rospy.Rate(LOOP_FREQ)

    while not rospy.is_shutdown():
        bm.step()
        rate.sleep()
Exemplo n.º 2
0
def main(stdscr):
  args = rospy.myargv()[1:]
  cfgfile = find_config_file(args)
  if not cfgfile:
    rospy.logfatal("Could not locate config file.")
    exit(1)
  cfg = RawConfigParser()
  cfg.read(cfgfile)
  bm = BatteryMonitor(stdscr, cfg)
  rospy.init_node(NODE_NAME)
  rospy.Subscriber(SUBSCRIBE_TOPIC, RobotState, bm.on_update)
  rate = rospy.Rate(LOOP_FREQ)

  while not rospy.is_shutdown():
    bm.step()
    rate.sleep()
Exemplo n.º 3
0
def main():
  app = QtGui.QApplication(rospy.myargv())

  parser = OptionParser()
  parser.add_option("--config-file", "-c")
  options, args = parser.parse_args(rospy.myargv())
  cfgfile = find_config_file(options.config_file)
  if not cfgfile:
    rospy.logfatal("Unable to find config file")
    exit(1)
  rospy.loginfo("Calibrating file %s", cfgfile)

  screen = CalibrationScreen(cfgfile)
  screen.show()
  retval = app.exec_()
  return retval
Exemplo n.º 4
0
def main():
  def vision_callback(msg):
    commander.vision.on_update(msg, get_time())

  def stopsign_callback(msg):
    commander.stopsign.on_update(msg, get_time())

  def ranger_callback(msg):
    commander.ranger.on_update(msg, get_time())

  def estop_callback(msg):
    commander.estop.on_update(msg, get_time())

  rospy.loginfo("Starting %s", NODE_NAME)
  car_pub = rospy.Publisher(CAR_TOPIC, CarCommand)
  vel_pub = rospy.Publisher(VELOCITY_TOPIC, Twist)
  rospy.init_node(NODE_NAME)
  commander = OscarCommander(get_time())
  commander.debugger = rospy.loginfo
  cfgfile = find_config_file(rospy.myargv()[1:])
  if cfgfile:
    rospy.loginfo("Loading config file %s", cfgfile)
    commander.load_config(cfgfile)
  else:
    rospy.logfatal("No config file found")
    exit(1)

  rospy.Subscriber(VISION_TOPIC, Vector3, vision_callback)
  rospy.Subscriber(STOPSIGN_TOPIC, Float64, stopsign_callback)
  rospy.Subscriber(RANGER_TOPIC, Vector3, ranger_callback)
  rospy.Subscriber(ESTOP_TOPIC, Joy, estop_callback)

  rate = rospy.Rate(LOOP_FREQ)
  
  while not rospy.is_shutdown():
    rec = commander.get_command(get_time())
    car_pub.publish(throttle = rec.throt, steering = rec.steer)
    #vel_msg = Twist()
    #vel_msg.linear.x = rec.throt
    #vel_msg.angular.z = rec.steer
    #vel_pub.publish(vel_msg)
    rate.sleep()
    
  rospy.loginfo("Stopping %s", NODE_NAME)
Exemplo n.º 5
0
 def load_config(self, cmd_line_arg):
   cfg = find_config_file(cmd_line_arg)
   self.throttle.load_config(cfg)
   self.steering.load_config(cfg)
   self.pan.load_config(cfg)
   self.tilt.load_config(cfg)
Exemplo n.º 6
0
 def load_config(self, cmd_line_arg):
     cfg = find_config_file(cmd_line_arg)
     self.throttle.load_config(cfg)
     self.steering.load_config(cfg)
     self.pan.load_config(cfg)
     self.tilt.load_config(cfg)