refactor: use new port negotiation style

As changed in the API document, this now uses the new port negotiation style.

ref: N25B-168
This commit is contained in:
Twirre Meulenbelt
2025-10-16 17:22:04 +02:00
parent e12d88726d
commit 23c3379bfb
8 changed files with 43 additions and 69 deletions

View File

View File

@@ -0,0 +1,25 @@
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