Exemplo n.º 1
0
def main():
  if len(sys.argv) != 3:
    print "Usage: " + sys.argv[0] + " <rdis-file> <serial-port>"
    sys.exit(1)

  print "Starting up RDIS..."
  global gModel
  gModel = rdis.load( sys.argv[1] )
  gModel.setCallback(rdisCallback)
  gModel.startup(port=sys.argv[2])

  ## FIELD FROM NODE NAME IN ROS FORMALISM
  rospy.init_node('rdisWanderer', anonymous=True)

  ## AUTO-GENERATED PUBLISH/SUBSCRIBE STATEMENTS.
  ## CREATES LOCAL VARIABLE FOR EACH PUBLISHER.
  rospy.Subscriber('setSpeed',Twist,setSpeed_callback)
  registerPublisher('detect_bump', rospy.Publisher('hitObject', Bool), publish_hitObject)

  while not rospy.is_shutdown():
    ## Lets model know a thread tick has passed. Internal
    ## timers will govern whether or not it is time to call
    ## any periodic interfaces.
    gModel.tick()

    ## Loop at 40.0 Hz
    ## TODO: Draw from threading object.
    rospy.sleep(1.0 / 40.0)

  gModel.terminate()
Exemplo n.º 2
0
def main():
  if len(sys.argv) != 3:
    print "Usage: " + sys.argv[0] + " <rdis-file> <serial-port>"
    sys.exit(1)

  print "Starting up RDIS..."
  global gModel
  gModel = rdis.load( sys.argv[1] )
  gModel.setCallback(rdisCallback)
  gModel.startup(port=sys.argv[2])

  ## FIELD FROM NODE NAME IN ROS FORMALISM
  rospy.init_node('{nodeName}', anonymous=True)