Skip to content
Snippets Groups Projects
README.md 2.04 KiB
Newer Older
Simon Wittl's avatar
Simon Wittl committed
![test](https://mygit.th-deg.de/roboct/robo_quality/gitlab-profile/-/raw/main/resources/rq_controller.svg?inline=false)

Simon Wittl's avatar
Simon Wittl committed
# RoboQualityController

Simon Wittl's avatar
Simon Wittl committed
Main controller of the Robo Quality project. This should controll all the services via the clients of the sumodules.
Simon Wittl's avatar
Simon Wittl committed
Also all common conversions from ROS2 interfaces to Python and Disk are included.

# Example Workflow

In this example all service nodes are started as `echo´s` (dummies). The workflow class connects to the standard services and calls them. The main idea is to replaces the service calls with "real" implemenataions / functionalities but keep the client calls for the workflow the same to keep testing and integrating easy independet of the systems. 


## Start Service nodes

Start the service nodes in a first console.

```powershell
C:\dev\ros2_humble\setup.ps1
C:\dev\rq_workflow\install\setup.ps1
ros2 launch C:\dev\rq_workflow\launch\echo_launch.py
```

## Run script

The following script can be found [here](https://mygit.th-deg.de/roboct/robo_quality/rq_controller/-/blob/main/rq_controller/rq_workflow.py?ref_type=heads#L80). Source ROS 2 in a second console:


```powershell
C:\dev\ros2_humble\setup.ps1
C:\dev\rq_workflow\install\setup.ps1
ros2 launch C:\dev\rq_workflow\launch\echo_launch.py
```
Run script / file from the second console:

```python
# Initialize workflow
from rq_controller.rq_workflow import WorkflowNode

workflow = WorkflowNode()

# Aquire some scout views
projection_list = list()
for i in range(5):
    print(f' - At projection {i}')
    scan_pose = PyProjection.dummy()
    scan_pose.focal_spot_mm += i
    projection_list.append(workflow.aquire_projection(scan_pose))

# Detect errors in scout views 
roi = workflow.defect_detection(projection_list)

# Init traj opt
workflow.trajectory_initialize(roi)

# Get next scan pose from traj opt
next_scan_pose, finished = workflow.trajectory_update(projection_list[-1])

# Aquire scan pose
projection_list.append(workflow.aquire_projection(next_scan_pose))

# Resconstruct projections
volume = workflow.get_volume(projection_list, roi[0])
```