Files
pepperplus-ri/src/robot_interface/utils/qi_utils.py
Twirre Meulenbelt 23c3379bfb refactor: use new port negotiation style
As changed in the API document, this now uses the new port negotiation style.

ref: N25B-168
2025-10-16 17:22:04 +02:00

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