Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. if __name__ == '__main__':
  2. parser = OptionParser()
  3. parser.add_option("-s", "--system", action="store_true", dest="system", default=False,help="use the system bus in
  4. stead of the session bus")
  5.  
  6. (options, args) = parser.parse_args()
  7.  
  8. dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
  9.  
  10. if options.system:
  11. bus = dbus.SystemBus()
  12. else:
  13. bus = dbus.SessionBus()
  14.  
  15. #Create Aseba network
  16. network = dbus.Interface(bus.get_object('ch.epfl.mobots.Aseba', '/'), dbus_interface='ch.epfl.mobots.AsebaNetwork
  17. ')
  18.  
  19. #print in the terminal the name of each Aseba NOde
  20. print network.GetNodesList()
  21.  
  22. with open('logFile', 'w') as f:
  23. f.write('This is a test\n')
  24. f.close()
  25.  
  26. #GObject loop
  27. print 'starting loop'
  28. loop = gobject.MainLoop()
  29. #call the callback of Braitenberg algorithm
  30. handle = gobject.timeout_add (100, Braitenberg) #every 0.1 sec
  31. loop.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement