Created
December 16, 2020 21:41
-
-
Save mauricefallon/d2b72122d65096243a31eeb90747393f to your computer and use it in GitHub Desktop.
republish msg
This file contains hidden or 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
| #!/usr/bin/env python | |
| import rospy | |
| from sensor_msgs.msg import * | |
| import cv2 | |
| import numpy as np | |
| import math | |
| last_t = None | |
| global last_t | |
| def handle_msg(msg): | |
| global last_t | |
| if (last_t is None): | |
| return | |
| print "msg with shifted timestamp" | |
| #offset = 1603895423; | |
| #msg.header.stamp.secs = msg.header.stamp.secs + offset; | |
| msg.header.stamp = last_t | |
| #print "time_shifted:" + str(msg.header.stamp.secs) | |
| pub.publish(msg) | |
| def handle_msg2(msg): | |
| global last_t | |
| print "msg with j/s" | |
| #msg.header.stamp.secs = msg.header.stamp.secs + offset; | |
| last_t = msg.header.stamp | |
| #print "time_shifted:" + str(msg.header.stamp.secs) | |
| #pub.publish(msg) | |
| if __name__ == '__main__': | |
| rospy.init_node('repub_lidar') | |
| rospy.Subscriber('/os_cloud_node/points', PointCloud2, handle_msg) | |
| rospy.Subscriber('/joint_states', JointState, handle_msg2) | |
| pub = rospy.Publisher("/os_cloud_node/points_repub", PointCloud2, queue_size=10, latch=True) | |
| rospy.spin() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment