As changed in the API document, this now uses the new port negotiation style. ref: N25B-168
26 lines
570 B
Python
26 lines
570 B
Python
import logging
|
|
import sys
|
|
|
|
try:
|
|
import qi
|
|
except ImportError:
|
|
qi = None
|
|
|
|
|
|
def get_qi_session():
|
|
if qi is None:
|
|
logging.info("Unable to import qi. Running in stand-alone mode.")
|
|
return None
|
|
|
|
if "--qi-url" not in sys.argv:
|
|
logging.info("No Qi URL argument given. Running in stand-alone mode.")
|
|
return None
|
|
|
|
try:
|
|
app = qi.Application()
|
|
app.start()
|
|
return app.session
|
|
except RuntimeError:
|
|
logging.info("Unable to connect to the robot. Running in stand-alone mode.")
|
|
return None
|