Last active
August 29, 2015 14:12
-
-
Save traverseda/5d4ce3efb12adfd7f1d1 to your computer and use it in GitHub Desktop.
verse client example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import vrsent | |
import subprocess | |
import time | |
import os | |
import argparse | |
def setup_server(): | |
if os.path.isfile('verse.pid'): | |
pidfile = open('verse.pid', 'r') | |
pid = int(pidfile.read()) | |
if pid: | |
print("Killing verse_server with pid = "+str(pid)) | |
subprocess.call("kill "+str(pid), shell=True) | |
pidfile.close() | |
pidfile = open('verse.pid', 'w+') | |
verse_server = subprocess.Popen("verse_server -d warning", shell=True) | |
pidfile.write(str(verse_server.pid)) | |
print("Starting verse_server with pid = "+str(verse_server.pid)) | |
pidfile.close() | |
internalfps=30 | |
def main(): | |
# setup_server() | |
session = vrsent.VerseSession(username=u'root', password=u'root',callback_thread=False) | |
session.send_user_authenticate() | |
session.debug_print = True | |
print("--------") | |
print(session.state) | |
print(session.fps) | |
while(session.state != 'DISCONNECTED'): | |
session.callback_update() | |
time.sleep(1.0/session.fps) | |
print(session.state) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment