Exemple #1
0
sys.path.insert(0, '../build/types/')
from example_t import example_t
import time

success = "Failure"


def handler(channel, msg):
    global success
    assert msg.timestamp == 10
    success = "Success"


# make a new zcm object and launch the handle thread
zcm = ZCM("ipc")
if not zcm.good():
    print "Unable to initialize zcm"
    exit()

# declare a new msg and populate it
msg = example_t()
msg.timestamp = 10

# set up a subscription on channel "TEST"
subs = zcm.subscribe("TEST", example_t, handler)

# publish a message
zcm.publish("TEST", msg)

# wait a second
Exemple #2
0
sys.path.insert(0, '../build/types/')
from example_t import example_t
import time

success = "Failure"


def handler(channel, msg):
    global success
    assert msg.timestamp == 10
    success = "Success"


# make a new zcm object and launch the handle thread
zcm = ZCM("")
if not zcm.good():
    print("Unable to initialize zcm")
    exit()

# declare a new msg and populate it
msg = example_t()
msg.timestamp = 10

# set up a subscription on channel "TEST"
zcm.subscribe("TEST", example_t, handler)

# publish a message
zcm.publish("TEST", msg)

# wait a second
Exemple #3
0
#!/usr/bin/python

from zcm import ZCM
import sys
sys.path.insert(0, '../build/types/')
from example_t import example_t
import time

success = "Failure"
def handler(channel, msg):
    global success
    assert msg.timestamp == 10
    success = "Success"

# make a new zcm object and launch the handle thread
zcm = ZCM()
if not zcm.good():
    print "Unable to initialize zcm"
    exit()

# declare a new msg and populate it
msg = example_t()
msg.timestamp = 10

# set up a subscription on channel "TEST"
subs = zcm.subscribe("TEST", example_t, handler)

# publish a message
zcm.publish("TEST", msg)

# wait a second
Exemple #4
0
# Untested

from zcm import ZCM
from pto import pto_t
from otp import otp_t


def handler(channel, msg):
    print "Received message on channel: " + channel
    assert msg.timestamp == 10


zcm = ZCM("udpm://10.0.0.4:7777?ttl=64")

if not zcm.good():
    print "Unable to initialize zcm"
    exit()

# declare a new msg and populate it
msg = pto_t()
msg.timestamp = 10

# set up a subscription on channel "TEST"
subs = zcm.subscribe("TEST", otp_t(), handler)

# publish a message
zcm.publish("TEST", msg)