-
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 Imaging ROS Node that returns a sample response (#48)
- Loading branch information
1 parent
d6143a3
commit c612c1d
Showing
4 changed files
with
65 additions
and
3 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
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 |
---|---|---|
@@ -1,13 +1,25 @@ | ||
uint64 timestamp | ||
|
||
float64 lat | ||
float64 lon | ||
float64 x | ||
float64 y | ||
float64 z | ||
|
||
float64[8] shape_conf | ||
# should sum to 1 | ||
# indices in order: | ||
# circle, semicircle, quarter circle, triangle, rectangle, pentagon, star, cross | ||
float64[8] color_conf | ||
|
||
float64[36] letter_conf | ||
# should sum to 1 | ||
# indices in order: | ||
# ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789 | ||
|
||
float64[8] shape_color_conf | ||
# should sum to 1 | ||
# indices in order: | ||
# white, black, red, blue, green, purple, brown, orange | ||
|
||
float64[8] letter_color_conf | ||
# should sum to 1 | ||
# indices in order: | ||
# white, black, red, blue, green, purple, brown, orange |
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,42 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import rclpy | ||
from rclpy.node import Node | ||
from uavf_2024.msg import TargetDetection | ||
from uavf_2024.srv import TakePicture | ||
import numpy as np | ||
|
||
class ImagingNode(Node): | ||
def __init__(self) -> None: | ||
super().__init__('imaging_node') | ||
self.imaging_service = self.create_service(TakePicture, 'imaging_service', self.imaging_callback) | ||
|
||
def imaging_callback(self, request, response: list[TargetDetection]): | ||
response.detections = [ | ||
TargetDetection( | ||
timestamp = 69420, | ||
x = 1.0, | ||
y = 2.0, | ||
z = 3.0, | ||
shape_conf = np.zeros(8).tolist(), | ||
letter_conf = np.zeros(36).tolist(), | ||
shape_color_conf = np.zeros(8).tolist(), | ||
letter_color_conf = np.zeros(8).tolist(), | ||
) | ||
] | ||
return response | ||
|
||
def main(args=None) -> None: | ||
print('Starting imaging node...') | ||
rclpy.init(args=args) | ||
node = ImagingNode() | ||
rclpy.spin(node) | ||
node.destroy_node() | ||
rclpy.shutdown() | ||
|
||
|
||
if __name__ == '__main__': | ||
try: | ||
main() | ||
except Exception as e: | ||
print(e) |