Commit ad0db73a authored by Dominique Piche's avatar Dominique Piche

add MecaRobotForDosimetry user guide

parent e74bf9f3
......@@ -232,3 +232,72 @@ robot.deactivate()
```
This shows an example of a `linear_sequence` about an arbitrary axis, setting (0, 1, 1) as the `direction_vector`. The `direction_vector` is automatically normalized. When in tracking mode, the `linear_sequence` method relies on End of movements responses from the robot to track the position. To ensure these responses are not from earlier movement commands, the responses buffer is automatically cleared prior to the sequence. However, if the user is sure that the buffer is empty (for example right after another linear_sequence), this step can be skipped by setting `do_clear_buffer=False` to save about 2 seconds.
### Using the MecaRobotForDosimetry module
The `MecaRobotForDosimetry` class inherits from `MecaRobot` and defines the geometry for scintillation dosimetry measurements. It keeps track of each scintillators' position in relation to the source. The lowest scintillator is set as the tool reference frame (TRF), which means that the movement commands will send the lowest scintillator to the specified position. The TRF axes are also rotated so that they aligned with those of the WRF in the default orientation.
It takes as an argument the `scintillators_positions`, which is a Nx3 numpy array (N being the number of scintillators) of the scintillators position in relation to the TRF, starting with the closest. For example, in the setup depicted below, this parameter would be `scintillators_positions=np.array([[5,0,-200], [5,0,-250], [5,0,-300]])`. It also takes as an argument the `source_position`, which is a numpy array of the source position in relation to the base of the robot. In the setup below, this parameter would be `source_position=np.array([250,0,-90])`.
![](https://i.imgur.com/Zi0a4Fv.png)
#### Examples
The following examples are all on the project repository, in the Example folder.
##### 6 - Move to source
The following code moves the scintillators in a straight line towards the source by steps. The result is shown [here]( https://www.youtube.com/watch?v=vwFc-xDRFb8 ).
```python
robot = MecaRobotForDosimetry(scintillators_positions=np.array([[5,0,-200], [5,0,-250], [5,0,-300]]), source_position=np.array([250,0,-90]))
robot.start_tracking()
robot.move_position_relative_to_source(np.array([-60,0,0]))
robot.linear_sequence(direction_vector=np.array([1,0,0]), total_distance=50, step=5, delay=0.1)
robot.run('Delay', 1)
robot.move_position_relative_to_source(np.array([-60,0,0]))
robot.wait_for('3012')
robot.stop_tracking()
robot.deactivate()
```
The `move_position_relative_to_source` method is used to move the robot to a given position in relation to the source (here 60 mm before the source in the x-axis). Then, the `linear_sequence` method is used to move towards to source along the x-axis for a distance of 50 mm, leaving the lowest scintillator 10 mm away from the source in the end.
Because the tracking mode is enabled, 8 new files will be created in the Data folder. The `general_info.txt` file contains the date and time at which the program was run as well as the source position, and the `time.txt` file contains the time at every step during linear sequences. For each scintillator, there is a `scintillator_x_position_relative_to_source.txt` file and `scintillator_x_distance_to_source.txt ` file, which contains the scintillator positions at every step during linear sequences. For example, the `scintillator_1_position_relative_to_source.txt` file will have 10 lines, as such
>-55. , 0. , 100.
>-50. , 0. , 100.
>...
>-15. , 0. , 100.
>-10. , 0. , 100.
The scintillator 1 is the highest scintillator, and because the robot was moved so that the lowest scintillator is at the source height, the scintillator 1 is 100 mm above the source.
##### 7 - Turn around source
The following code turns the robot around the source. The result is shown [here]( `https://www.youtube.com/watch?v=k-IdHareEhg` ).
```python
robot = MecaRobotForDosimetry(scintillators_positions=np.array([[5,0,-200], [5,0,-250], [5,0,-300]]), source_position=np.array([250,0,-90]))
robot.start_tracking()
robot.move_position_relative_to_source(np.array([0,-20,0]))
robot.turn_around_source(angle_to_cover=180, angular_step=-15, delay=0.1)
robot.run('Delay', 1)
robot.wait_for('3012')
robot.stop_tracking()
robot.deactivate()
```
The `turn_around_source` method allows the move the scintillators in a circle around the source, for a total `angle_to_cover` by steps of size `angular_step`. A positive `angular_step` corresponds to a counter-clockwise rotation as seen from above, and a negative `angular_step` to a clockwise rotation. It should be noted that even tough the robot position after every step will be at a fixed radial distance from the source, the robot path between the steps is not circular, as the `MovePose` command is used by the `turn_around_source` method.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment