Hello, so i wanted to send a message to a python script running externally of UR5, for this i used the OSC package and just tried to test it when a button in my UI is pressed. The BP looks like this and is derived from the website: OSC Plugin Overview for Unreal Engine | Unreal Engine 5.0 Documentation
My python script, which starts a server and listens to input looks like this:
import argparse
import math
from pythonosc.dispatcher import Dispatcher
from pythonosc import osc_server
def print_volume_handler(unused_addr, args, volume):
print("[{0}] ~ {1}".format(args[0], volume))
def print_compute_handler(unused_addr, args, volume):
try:
print("[{0}] ~ {1}".format(args[0], args[1](volume)))
except ValueError: pass
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ip",
default="127.0.0.1", help="The ip to listen on")
parser.add_argument("--port",
type=int, default=5005, help="The port to listen on")
args = parser.parse_args()
dispatcher = Dispatcher()
dispatcher.map("/filter", print)
dispatcher.map("/volume", print_volume_handler, "Volume")
dispatcher.map("/logvolume", print_compute_handler, "Log volume", math.log)
server = osc_server.ThreadingOSCUDPServer(
(args.ip, args.port), dispatcher)
print("Serving on {}".format(server.server_address))
server.serve_forever()
i got it from GitHub - attwad/python-osc: Open Sound Control server and client in pure python
unfortunatly the output from the python script stays quiet, and i do not know why. I guess its a simple fix, but for now i could not find it.