Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexandrefch/ros-image-transport-py
ROS noetic package that manage automaticly multiple image transport type in python.
https://github.com/alexandrefch/ros-image-transport-py
image noetic python python3 ros ros-noetic ros-package
Last synced: about 2 months ago
JSON representation
ROS noetic package that manage automaticly multiple image transport type in python.
- Host: GitHub
- URL: https://github.com/alexandrefch/ros-image-transport-py
- Owner: alexandrefch
- License: apache-2.0
- Created: 2023-02-15T17:43:43.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-23T16:48:29.000Z (almost 2 years ago)
- Last Synced: 2024-01-25T11:56:25.918Z (11 months ago)
- Topics: image, noetic, python, python3, ros, ros-noetic, ros-package
- Language: Python
- Homepage:
- Size: 21.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# ROS Image Transport Python
![Ros](https://img.shields.io/badge/Ros-Noetic-green?style=for-the-badge&logo=ROS)
![Python](https://img.shields.io/badge/Python-3.8-green?style=for-the-badge&logo=Python&logoColor=FFFFFF)This ROS package aim to give the same facility of use of image topic as [image_transport](http://wiki.ros.org/image_transport) can does in c++. Moreover, this package is compatible with [image_transport](http://wiki.ros.org/image_transport) and [message_filter](http://wiki.ros.org/message_filters), that mean that you can communicate to existing node that use image transport in c++. (Like [rqt](http://wiki.ros.org/rqt) or [RViz](http://wiki.ros.org/rviz))
## :rocket: Getting Started
### :gear: Compilation
```shell
git clone https://github.com/alexandrefch/ros-image-transport-py.git
catkin build image_transport_py
```> **Warning**
> The catkin compilation might lead to some dependencies errors, do not hesitate to report them so they can be corrected.### :computer: How to use
**Publisher**
```py
# Publisher exampleimport rospy
import image_transportrospy.init_node("my_node_publisher")
publisher = image_transport.Publisher("my_topic/image")
publisher.publish(image)
```Instantiation of a publisher object by calling `image_transport.Publisher()` that will automaticly generate all supported transport type topic as below. (eg: rostopic list using `ImageTransport.advertise("my_topic/image")`)
```txt
my_topic/image
my_topic/image/compressed
```**Subscriber**
Now if you want to subscribe you simply need create call `image_transport.Subscriber` and choose your desire format topic, the library will detect what type is it using topic name and pick the correct image decoder.
(eg : if you want to subscribe to a compressed topic simply use `image_transport.Subscriber("my_topic/image/compressed",callback)`)```py
# Subscriber exampleimport rospy
import image_transportdef callback(image):
print(f"receive image of shape {image.shape}")rospy.init_node("my_node_subscriber")
image_transport.Subscriber("my_topic/image/compressed",callback)
```## :books: Supported transport type
- `image_raw`
- `compressed` (using jpeg compression)> **Note**
> If you want to help and add new transport type feel free to fork this project and make a merge request.## Compatibility with message_filter
```python
import rospy
import message_filters
import image_transport
from sensor_msgs.msg import PointCloud2def _callback(self,pcl,image):
print("Success !")rospy.init_node('Kitti')
subscribers = [
message_filters.Subscriber('/pointcloud',PointCloud2),
image_transport.Subscriber('/my_camera_topic/image_raw')
]
mf = message_filters.ApproximateTimeSynchronizer(
subscribers,
queue_size=10,
slop=0.1
)
mf.registerCallback(self._callback)
rospy.spin()
```