-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a45626f
commit 43870bb
Showing
4 changed files
with
53 additions
and
7 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
34 changes: 34 additions & 0 deletions
34
...tion/lidar_object_detection/lidar_object_detection/lidar_object_detection/label_server.py
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 rclpy | ||
from rclpy.node import Node | ||
from vision_msgs.msg import VisionInfo | ||
|
||
class LabelServer(Node): | ||
def __init__(self): | ||
super().__init__('label_server') | ||
self.publisher_ = self.create_publisher(VisionInfo, 'vision_info', 10) | ||
self.label_mapping = { | ||
1: "car", | ||
2: "pedestrian", | ||
3: "cyclist", | ||
} | ||
self.publish_labels() | ||
|
||
def publish_labels(self): | ||
vision_info_msg = VisionInfo() | ||
vision_info_msg.database_location = "memory" | ||
vision_info_msg.database_version = "1.0" | ||
for label_id, class_name in self.label_mapping.items(): | ||
vision_info_msg.class_map[label_id] = class_name | ||
self.publisher_.publish(vision_info_msg) | ||
|
||
def main(args=None): | ||
rclpy.init(args=args) | ||
label_server = LabelServer() | ||
rclpy.spin(label_server) | ||
label_server.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
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