forked from IntelRealSense/realsense-ros
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request IntelRealSense#2158 from doronhi/ros1-metadata
publish metadata
- Loading branch information
Showing
6 changed files
with
134 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,7 @@ add_message_files( | |
FILES | ||
IMUInfo.msg | ||
Extrinsics.msg | ||
Metadata.msg | ||
) | ||
|
||
add_service_files( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
std_msgs/Header header | ||
string json_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import sys | ||
import rospy | ||
from realsense2_camera.msg import Metadata | ||
import json | ||
|
||
def metadata_cb(msg): | ||
aa = json.loads(msg.json_data) | ||
os.system('clear') | ||
print('\n'.join(['%10s:%-10s' % (key, str(value)) for key, value in aa.items()])) | ||
|
||
def main(): | ||
if len(sys.argv) < 2 or '--help' in sys.argv or '/?' in sys.argv: | ||
print ('USAGE:') | ||
print('echo_metadata.py <topic>') | ||
print('Demo for listening on given metadata topic.') | ||
print('App subscribes on given topic') | ||
print('App then prints metadata from messages') | ||
print('') | ||
print('Example: echo_metadata.py /camera/depth/metadata') | ||
print('') | ||
exit(-1) | ||
|
||
topic = sys.argv[1] | ||
|
||
rospy.init_node('metadata_tester', anonymous=True) | ||
|
||
depth_sub = rospy.Subscriber(topic, Metadata, metadata_cb) | ||
|
||
rospy.spin() | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters