Skip to content

Commit 54335cc

Browse files
committed
finish readme
1 parent d576cde commit 54335cc

File tree

5 files changed

+69
-8
lines changed

5 files changed

+69
-8
lines changed

README.md

+62-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,63 @@
11
# realsense_ROS2_interface
2-
This package interfaces the robot/joystick with the realsense ROS2 wrapper
2+
3+
This ROS2 package interfaces robots and/or joysticks with the official Intel RealSense ROS wrapper.
4+
5+
While it's targeting Intel RealSense and Sony Playstation Joystick, the package can be easily modified to work with any USB camera and controller.
6+
7+
For any questions, please contact the author, [Irving Fang](https://irvingf7.github.io/).
8+
9+
This package is heavily influenced and inspired by a [similar ROS1 package](https://github.com/ripl/capture-images) written by [Dr. Takuma Yoneda](https://takuma.yoneda.xyz/) from TTIC.
10+
11+
## Setup
12+
This package is only tested on `Ubuntu 22.04` and `ROS humble` distribution.
13+
14+
It requires the official [RealSense ROS2 wrapper](https://github.com/IntelRealSense/realsense-ros) and the Intel RealSense SDK.
15+
16+
I expect this package to be easily portable to other Ubuntu versions and ROS 2 distros, since it does not utilize anything specific to `Ubuntu 22.04` and `ROS humble`.
17+
18+
19+
20+
## Installation
21+
22+
After acquiring all the prerequisites, simply put this folder (which contains two ROS2 packages, technically speaking) inside your ROS workspace's `src` folder and run the following command in your ROS workspace.
23+
24+
```
25+
colcon build
26+
```
27+
28+
29+
## Package Breakdown
30+
I will walk through the package structure briefly here. Feel free to skip over if you are familiar with how a typical ROS2 package works.
31+
32+
This project is actually made of two ROS2 packages:
33+
34+
- `realsense_capture`: contains all the code that actually does the job.
35+
36+
- `realsense_interface_msg`: contains the definition for the service message type that's being used.
37+
38+
It's a conventional ROS practice to dedicate an independent package for message type definitions.
39+
40+
Inside `realsense_capture`:
41+
- `realsense_image_server.py`: responsible for constantly getting images from the camera, and is ready to serve the image whenever requested, that is, the capture button on the joystick is hit.
42+
43+
- `realsense_image_client.py`: responsible for acquiring the image whenever the capture button on the joystick is hit.
44+
45+
46+
## Usage
47+
To use the package, run
48+
49+
```bash
50+
ros2 launch realsense_capture realsense_sys_launch.py
51+
```
52+
53+
***Note***: The launch file also launches Foxglove, a visualization/monitoring app for ROS2. Get rid of related lines if desired.
54+
55+
There is no need to launch the RealSense ROS wrapper separately, as they are integrated in the launch file.
56+
57+
58+
## Contributing
59+
60+
Contributions to this project are welcome. If you encounter any issues or have suggestions for improvements, please open an issue on the GitHub repository.
61+
62+
## Citation
63+
If you find this little package helpful, please consider citing it in your paper/work.

realsense_capture/launch/realsense_sys_launch.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
{'name': 'hdr_merge.enable', 'default': 'false', 'description': 'hdr_merge filter enablement flag'},
8989
{'name': 'wait_for_device_timeout', 'default': '-1.', 'description': 'Timeout for waiting for device to connect (Seconds)'},
9090
{'name': 'reconnect_timeout', 'default': '6.', 'description': 'Timeout(seconds) between consequtive reconnection attempts'},
91-
{'name': 'img_folder', 'default': '/home/irving/Desktop', 'description': 'folder to save images'},
91+
{'name': 'save_folder', 'default': '/home/irving/Desktop', 'description': 'folder to save images'},
9292
]
9393

9494
def declare_configurable_parameters(parameters):
@@ -160,7 +160,7 @@ def generate_launch_description():
160160
package='realsense_capture',
161161
executable='image_client',
162162
name='image_client',
163-
parameters=[{'img_folder': launch_params['img_folder'],
163+
parameters=[{'save_folder': launch_params['save_folder'],
164164
}]
165165
)
166166

realsense_capture/realsense_capture/image_client.py realsense_capture/realsense_capture/realsense_image_client.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def __init__(self):
2828

2929
############################ Launch Parameters ########################################
3030
# parameter handling
31-
self.declare_parameter(name = 'img_folder', value = '/home/irving/Desktop')
32-
self.img_folder = self.get_parameter('img_folder').get_parameter_value().string_value
31+
self.declare_parameter(name = 'save_folder', value = '/home/irving/Desktop')
32+
self.save_folder = self.get_parameter('save_folder').get_parameter_value().string_value
3333

3434
############################ Client Setup #############################################
3535
# rgb client
@@ -75,7 +75,7 @@ def postprocess(self, img, modality):
7575
'''
7676
encoded_img = self.cvbridge.imgmsg_to_cv2(img_msg=img,
7777
desired_encoding='passthrough')
78-
cv2.imwrite(os.path.join(self.img_folder, f'{modality}_{img.header.stamp.sec}.png'), encoded_img)
78+
cv2.imwrite(os.path.join(self.save_folder, f'{modality}_{img.header.stamp.sec}.png'), encoded_img)
7979

8080
# color the log message
8181
color_start = '\033[94m'

realsense_capture/setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
tests_require=['pytest'],
2525
entry_points={
2626
'console_scripts': [
27-
'image_server = realsense_capture.image_server:main',
28-
'image_client = realsense_capture.image_client:main',
27+
'realsense_image_server = realsense_capture.realsense_image_server:main',
28+
'realsense_image_client = realsense_capture.realsense_image_client:main',
2929
],
3030
},
3131
)

0 commit comments

Comments
 (0)