A generic ROS2 subscriber for numbers, strings, images, and video.
Project description
aksub
=====
A generic ROS2 subscriber that can receive numbers, strings, images, or video frames with minimal setup.
Installation
------------
First, make sure you have a working ROS2 environment with `rclpy` and `cv_bridge` installed.
Then clone this repository and install:
git clone https://github.com/yourname/aksub.git
cd aksub
pip install .
Usage
-----
Example Python usage:
import aksub
aksub.metadata(
mode=None, # Auto-detect from datatype
datatype="Float64", # e.g., "String", "Int32", "Image"
node_name="num_subscriber",
topic_name="number",
queue=10,
delay=1.0
)
print("Received value:", aksub.received_value)
Supported Datatypes
-------------------
- String (std_msgs.msg.String)
- Int32 (std_msgs.msg.Int32)
- Float32 (std_msgs.msg.Float32)
- Float64 (std_msgs.msg.Float64)
- Bool (std_msgs.msg.Bool)
- Image (sensor_msgs.msg.Image)
Accessing Received Data
-----------------------
- For String, Int, Float, Bool: `aksub.received_value` will be a Python primitive (str, int, float, bool).
- For Image/Video: `aksub.received_value` will be an OpenCV BGR image (numpy array).
Example for image:
import cv2
frame = aksub.received_value
if frame is not None:
cv2.imshow("Received Image", frame)
cv2.waitKey(0)
Example for video stream:
import cv2
while True:
frame = aksub.received_value
if frame is not None:
cv2.imshow("Video", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
Notes
-----
- `mode` can be "number", "string", "image", "video", or None for auto-detect.
- You can change `node_name`, `queue`, and `delay` in `metadata()`.
- `delay` can be used to control the processing interval.
- Requires `rclpy` and `cv_bridge` to be installed in your ROS2 Python environment.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aksub-0.1.0.tar.gz
(3.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
aksub-0.1.0-py3-none-any.whl
(3.6 kB
view details)
File details
Details for the file aksub-0.1.0.tar.gz.
File metadata
- Download URL: aksub-0.1.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a782356b8383873bd17cfa26ad969edae6db6fb43719f2f0ea9f9bba246f3bb
|
|
| MD5 |
8764b1dab9d7cf4553eca35503f930d4
|
|
| BLAKE2b-256 |
88d0e92b604a053cc1585409d99bf5c1c6e72c2979ec277586bc1271b4706db4
|
File details
Details for the file aksub-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aksub-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b36daeb8523270f793bb244d58eb20ab6da4ad843be97f37301b31ee574de1d2
|
|
| MD5 |
4b2c1bacb272b1eccfe782ce60063520
|
|
| BLAKE2b-256 |
4c4b295942615fc13c583c82f16578fb95fa3158f1ff90b539c6b4c895bbeb52
|