27 lines
725 B
Python
27 lines
725 B
Python
from osc4py3.as_eventloop import *
|
|
from osc4py3 import oscbuildparse
|
|
import time
|
|
|
|
# Start OSC
|
|
osc_startup()
|
|
osc_udp_client("127.0.0.1", 8000, "osc_client")
|
|
|
|
# Generate a future timetag (current time + 2 seconds)
|
|
timetag = oscbuildparse.unixtime2timetag(time.time() + 2)
|
|
|
|
# Create messages with proper addresses
|
|
msg1 = oscbuildparse.OSCMessage("/joint_states/joint1/position", None, [42])
|
|
msg2 = oscbuildparse.OSCMessage("/joint_states/joint2/velocity", None, [3.14])
|
|
|
|
# Create an OSC bundle with the correct timetag
|
|
bundle = oscbuildparse.OSCBundle(timetag, [msg1, msg2])
|
|
|
|
# Send the bundle
|
|
osc_send(bundle, "osc_client")
|
|
osc_process()
|
|
|
|
print(f"📤 Sent OSC bundle with timetag: {timetag}")
|
|
|
|
# Terminate OSC
|
|
osc_terminate()
|