Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if __name__ == '__main__':
- parser = OptionParser()
- parser.add_option("-s", "--system", action="store_true", dest="system", default=False,help="use the system bus in
- stead of the session bus")
- (options, args) = parser.parse_args()
- dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
- if options.system:
- bus = dbus.SystemBus()
- else:
- bus = dbus.SessionBus()
- #Create Aseba network
- network = dbus.Interface(bus.get_object('ch.epfl.mobots.Aseba', '/'), dbus_interface='ch.epfl.mobots.AsebaNetwork
- ')
- #print in the terminal the name of each Aseba NOde
- print network.GetNodesList()
- with open('logFile', 'w') as f:
- f.write('This is a test\n')
- f.close()
- #GObject loop
- print 'starting loop'
- loop = gobject.MainLoop()
- #call the callback of Braitenberg algorithm
- handle = gobject.timeout_add (100, Braitenberg) #every 0.1 sec
- loop.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement