Skip to content
Snippets Groups Projects
Commit ce0bf04c authored by Simon Wittl's avatar Simon Wittl
Browse files

added artist

parent 91a83491
No related branches found
No related tags found
No related merge requests found
File added
No preview for this file type
......@@ -7,10 +7,7 @@ try:
import artistlib
from artistlib import utility as artist_utility
except ModuleNotFoundError:
raise ModuleNotFoundError('aRTist API not found.\n' +
'Use this api: \n' +
'https://github.com/wittlsn/aRTist-PythonLib/tree/artist_thd_wip \n' +
'Contact: simon.wittl@th-deg.de')
raise ModuleNotFoundError('aRTist API not found')
import ros2_numpy
import numpy as np
......@@ -24,8 +21,6 @@ class ArtistHardwareInterface(BaseHardwareInterfaceService):
def __init__(self, node_name: str = 'rq_hardware_interface_service'):
super().__init__(node_name)
# initialize artist api
self.api = artistlib.API()
self.source = artistlib.hardware.XraySource(self.api)
self.detector = artistlib.hardware.XrayDetector(self.api)
......@@ -33,9 +28,7 @@ class ArtistHardwareInterface(BaseHardwareInterfaceService):
def aquire_projection_callback(self,
request: AquireProjection.Request,
response: AquireProjection.Response):
"""
artist wrapper for projection aquisition
"""
projection_geometry = PyProjection.from_message(request.scan_pose)
self.api.rotate_from_quat('S', projection_geometry.focal_spot_orientation_quad)
......@@ -61,8 +54,6 @@ class ArtistHardwareInterface(BaseHardwareInterfaceService):
response.projection = request.scan_pose
response.projection.image = ros2_numpy.msgify(Image, projection_image.astype(np.uint16), 'mono16')
self.publish_projection(response.projection)
return response
......
......@@ -9,17 +9,10 @@ class BaseHardwareInterfaceService(Node):
def __init__(self, node_name: str = 'rq_base_hardware_interface_service'):
super().__init__(node_name)
self.srv = self.create_service(AquireProjection, 'aquire_projection', self.aquire_projection_callback)
self.topic = self.create_publisher(Projection, 'current_projection', 1)
self.aquired_projections = 0
def aquire_projection_callback(self,
rquest: AquireProjection.Request,
response: AquireProjection.Response) -> rclpy.Future:
response: AquireProjection.Response):
raise NotImplementedError
def publish_projection(self, projection: Projection):
self.topic.publish(projection)
self.aquired_projections += 1
self.get_logger().info(f'Published projection number: {self.aquired_projections}')
......@@ -6,7 +6,7 @@ from rq_controller.common import PyProjection
import rclpy
from rclpy.node import Node
class HardwareClient(Node):
class DefectDetectionClient(Node):
def __init__(self):
super().__init__('rq_hardware_client')
......@@ -30,7 +30,7 @@ def main():
rclpy.init()
minimal_client = HardwareClient()
minimal_client = DefectDetectionClient()
scan_pose = PyProjection.dummy()
future = minimal_client.aquire_projection(scan_pose)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment