Skip to main content

ROS2 Geek

Project description

Create a Node and spin it without blocking.

Usually:

import rclpy
from rclpy.node import Node
from threading import Thread

node = Node("robot", namespace="MK14QWZ024480005")
Thread(target=rclpy.spin, args=(node,), daemon=True).start()

Now:

</code></pre>
<p>Create a publisher which publishes a message every 100ms.</p>
<p>Usually:</p>
<pre lang="python"><code>msg = String()
publisher = node.create_publisher(String, "topic", 10)
timer = node.create_timer(0.1, lambda: publisher.publish(msg))
# update the message
msg.data = "Hello, world!"

Now:

</code></pre>
<p>Wait for a message to be subscribed.</p>
<p>Usually:</p>
<pre lang="python"><code>message = String()
def callback(msg):
    message.data = msg.data
subscriber = node.create_subscription(String, "topic", callback, 10)
while not message.data:
    rclpy.spin_once(node)

Now:

The above comparison is just a simple example. For more complex examples, please read the following tutorial.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ros2_geek-0.2.0.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ros2_geek-0.2.0-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file ros2_geek-0.2.0.tar.gz.

File metadata

  • Download URL: ros2_geek-0.2.0.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.10

File hashes

Hashes for ros2_geek-0.2.0.tar.gz
Algorithm Hash digest
SHA256 36a63a4bfbe40abaf050d2f38706873cf3e2de42cbf0207c872e2b004c8244d1
MD5 ce89153bd68f7508962077f12c44fd68
BLAKE2b-256 85adafdd243353b24daaace3e9798a324f226de4e24394593dddf9f7bea98648

See more details on using hashes here.

File details

Details for the file ros2_geek-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ros2_geek-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.10

File hashes

Hashes for ros2_geek-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9de226e08174148097677c1985041a7df89374b64711ddbcdd8a551496c018a
MD5 57e6fa6bbc72206047dbc9d33acd8056
BLAKE2b-256 9fdd3e64b3c9e553b7085ca6c7c0767311b8232f12b1b1a38388def725758870

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page