forked from autowarefoundation/autoware.universe
-
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.
add quick start demo (autowarefoundation#8)
Signed-off-by: Kento Yabuuchi <kento.yabuuchi.2@tier4.jp>
- Loading branch information
Showing
4 changed files
with
609 additions
and
86 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python3 | ||
import rclpy | ||
from rclpy.node import Node | ||
from sensor_msgs.msg import Image | ||
from sensor_msgs.msg import CompressedImage | ||
from cv_bridge import CvBridge | ||
from rclpy.qos import QoSProfile, QoSReliabilityPolicy | ||
|
||
|
||
class ImageCompressor(Node): | ||
def __init__(self): | ||
super().__init__('image_compressor') | ||
qos = QoSProfile( | ||
reliability=QoSReliabilityPolicy.RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT, | ||
depth=10 | ||
) | ||
self.publisher_ = self.create_publisher( | ||
CompressedImage, '/sensing/camera/traffic_light/image_raw/compressed', qos) | ||
self.subscription = self.create_subscription( | ||
Image, '/sensing/camera/traffic_light/image_raw', self.on_image, qos) | ||
self.bridge_ = CvBridge() | ||
|
||
def on_image(self, msg): | ||
self.get_logger().info('subscribed') | ||
mat = self.bridge_.imgmsg_to_cv2(msg) | ||
compressed_msg = self.bridge_.cv2_to_compressed_imgmsg(mat) | ||
compressed_msg.header = msg.header | ||
self.publisher_.publish(compressed_msg) | ||
self.get_logger().info('published') | ||
|
||
|
||
def main(args=None): | ||
rclpy.init(args=args) | ||
minimal_publisher = ImageCompressor() | ||
rclpy.spin(minimal_publisher) | ||
minimal_publisher.destroy_node() | ||
rclpy.shutdown() | ||
|
||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/bash | ||
ros2 bag record --use-sim-time\ | ||
/clock\ | ||
/tf_static\ | ||
/map/vector_map\ | ||
/map/vector_map_marker\ | ||
/vehicle/status/velocity_status\ | ||
/sensing/imu/tamagawa/imu_raw\ | ||
/sensing/gnss/pose\ | ||
/sensing/gnss/pose_with_covariance\ | ||
/sensing/camera/traffic_light/camera_info\ | ||
/sensing/camera/traffic_light/image_raw/compressed\ | ||
/initialpose |
Oops, something went wrong.