Exemplo n.º 1
0

#functions to be used in class
def word(l, h):
    """
	Given a low and high bit, converts the number back into a word.
	"""
    return (h << 8) + l


#checksum method, receives array
def checksum(arr):
    return 255 - ((sum(arr)) % 256)


#little-endian method
def le(h):
    h &= 0xffff
    return [h & 0xff, h >> 8]


#example code
if __name__ == "__main__":
    from std_msgs import String
    from uros import NodeHandle
    msg = String()
    msg.data = 'HiItsMeMario'
    node = NodeHandle(2, 115200)
    while True:
        node.publish('greet', msg)
Exemplo n.º 2
0
from std_msgs import String
from uros import NodeHandle
import time


def cb(msg):
    print(msg.data)


node = NodeHandle(2, 57600)
node.subscribe('chatter', String, cb)
node.subscribe('greet', String, cb)
Exemplo n.º 3
0
from std_msgs import String
from uros import NodeHandle
import time


def cb(msg):
    print(msg.data)


msgp = String()
msgp.data = "ItsMeLuigi"

node = NodeHandle(2, 57600)
node.subscribe("chatter", String, cb)

while True:
    node.publish("groop", msgp)
    time.sleep(1)
Exemplo n.º 4
0
# functions to be used in class
def word(l, h):
    """
	Given a low and high bit, converts the number back into a word.
	"""
    return (h << 8) + l


# checksum method, receives array
def checksum(arr):
    return 255 - ((sum(arr)) % 256)


# little-endian method
def le(h):
    h &= 0xFFFF
    return [h & 0xFF, h >> 8]


# example code
if __name__ == "__main__":
    from std_msgs import String
    from uros import NodeHandle

    msg = String()
    msg.data = "HiItsMeMario"
    node = NodeHandle(2, 115200)
    while True:
        node.publish("greet", msg)
Exemplo n.º 5
0
from std_msgs import String
from uros import NodeHandle
import time


def cb(msg):
    print(msg.data)


node = NodeHandle(2, 57600)
node.subscribe("chatter", String, cb)
node.subscribe("greet", String, cb)
Exemplo n.º 6
0
from std_msgs import String
from uros import NodeHandle
import time


def cb(msg):
    print(msg.data)


msgp = String()
msgp.data = 'ItsMeLuigi'

node = NodeHandle(2, 57600)
node.subscribe('chatter', String, cb)

while True:
    node.publish('groop', msgp)
    time.sleep(1)