Commit 72642d77 authored by Dominique Piche's avatar Dominique Piche

removed unecessary files

parent 41093fa0
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'daq_acquisition_QtDesigner_gui.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_DAQMainWin(object):
def setupUi(self, DAQMainWin):
resolution_ratio = 1.85
DAQMainWin.setObjectName("DAQMainWin")
DAQMainWin.resize(1450/resolution_ratio, 2500/resolution_ratio)
self.centralwidget = QtWidgets.QWidget(DAQMainWin)
self.centralwidget.setObjectName("centralwidget")
self.StartDAQAcquisition = QtWidgets.QPushButton(self.centralwidget)
self.StartDAQAcquisition.setGeometry(QtCore.QRect(1110/resolution_ratio, 20/resolution_ratio, 161/resolution_ratio, 41/resolution_ratio))
self.StartDAQAcquisition.setObjectName("StartDAQAcquisition")
self.StopDAQAcquisition = QtWidgets.QPushButton(self.centralwidget)
self.StopDAQAcquisition.setGeometry(QtCore.QRect(1300/resolution_ratio, 20/resolution_ratio, 161/resolution_ratio, 41/resolution_ratio))
self.StopDAQAcquisition.setObjectName("StopDAQAcquisition")
self.label_1 = QtWidgets.QLabel(self.centralwidget)
# self.label_1.setGeometry(QtCore.QRect(950, 1080, 250, 40))
self.label_1.setGeometry(QtCore.QRect(1230/resolution_ratio, 1330/resolution_ratio, 250/resolution_ratio, 40/resolution_ratio))
self.label_1.setObjectName("label_1")
self.label_1.setFont(QtGui.QFont('SansSerif', 10, QtGui.QFont.Bold))
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(120/resolution_ratio, 55/resolution_ratio, 250/resolution_ratio, 40/resolution_ratio))
self.label_2.setObjectName("label_2")
self.label_2.setFont(QtGui.QFont('SansSerif', 10, QtGui.QFont.Bold))
self.grPlot = PlotWidget(self.centralwidget)
self.grPlot.setGeometry(QtCore.QRect(120/resolution_ratio, 100/resolution_ratio, 1150/resolution_ratio, 600/resolution_ratio))
self.grPlot.setObjectName("grPlot")
self.grPlot_2 = PlotWidget(self.centralwidget)
self.grPlot_2.setGeometry(QtCore.QRect(1300/resolution_ratio, 100/resolution_ratio, 1150/resolution_ratio, 600/resolution_ratio))
self.grPlot_2.setObjectName("grPlot_2")
self.grPlot_3 = PlotWidget(self.centralwidget)
self.grPlot_3.setGeometry(QtCore.QRect(120/resolution_ratio, 710/resolution_ratio, 1150/resolution_ratio, 600/resolution_ratio))
self.grPlot_3.setObjectName("grPlot_3")
self.grPlot_4 = PlotWidget(self.centralwidget)
self.grPlot_4.setGeometry(QtCore.QRect(1300/resolution_ratio, 710/resolution_ratio, 1150/resolution_ratio, 600/resolution_ratio))
self.grPlot_4.setObjectName("grPlot_4")
DAQMainWin.setCentralWidget(self.centralwidget)
self.retranslateUi(DAQMainWin)
QtCore.QMetaObject.connectSlotsByName(DAQMainWin)
def retranslateUi(self, DAQMainWin):
_translate = QtCore.QCoreApplication.translate
DAQMainWin.setWindowTitle(_translate("DAQMainWin", "IViST"))
self.StartDAQAcquisition.setText(_translate("DAQMainWin", "Start acquisition"))
self.StopDAQAcquisition.setText(_translate("DAQMainWin", "Stop acquisition"))
self.label_1.setText(_translate("DAQMainWin", "Time (s)"))
self.label_2.setText(_translate("DAQMainWin", "DAQ signal (V)"))
from pyqtgraph import PlotWidget
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
DAQMainWin = QtWidgets.QMainWindow()
ui = Ui_DAQMainWin()
ui.setupUi(DAQMainWin)
DAQMainWin.show()
sys.exit(app.exec_())
# System modules
import numpy as np
from PyQt5 import QtWidgets, QtCore, QtGui
import pyqtgraph as pg
import datetime
import sys
from os.path import join
import queue
import nidaqmx
from nidaqmx.stream_readers import (AnalogSingleChannelReader, AnalogMultiChannelReader)
from nidaqmx.stream_writers import (AnalogSingleChannelWriter, AnalogMultiChannelWriter)
# Local modules
from NI_DAQ.DAQ_Volt_QtDesigner_gui import *
###########################################################
class DAQ_MainWin(QtWidgets.QMainWindow, Ui_DAQMainWin):
def __init__(self, app, signal_queue, *args, **kwargs):
self.start_time = None
self.last_read_time = None
self.signal_queue = signal_queue
self.DAQ_model = 6216
QtWidgets.QMainWindow.__init__(self, *args, **kwargs)
# Getting ready the graph before real time plotting
pg.setConfigOption('background', 'w') # before loading widget
pg.setConfigOption('foreground', 'k')
self.setupUi(self)
app.aboutToQuit.connect(self._closeEvent)
# Connect event to actions
self.c = 0
self.StopDAQAcquisition.clicked.connect(self.stopEvent)
self.StartDAQAcquisition.clicked.connect(self.startAcquisition)
# The Plotter
self.grPlot.plotItem.showGrid(True, True, 0.7)
self.grPlot_2.plotItem.showGrid(True, True, 0.7)
self.grPlot_3.plotItem.showGrid(True, True, 0.7)
self.grPlot_4.plotItem.showGrid(True, True, 0.7)
#self.grPlot.plot([self.a], [Y[0]], pen=None, symbol='o', symbolPen=None, symbolSize=10, symbolBrush=(0, 0, 204))
pen_1 = pg.mkPen(color=(0, 204, 204), width=8)
pen_2 = pg.mkPen(color=(34, 204, 0), width=8)
pen_3 = pg.mkPen(color=(0, 0, 204), width=8)
pen_4 = pg.mkPen(color=(204, 0, 34), width=8)
self.plot_1 = self.grPlot.plot([], [], pen=pen_1)
self.plot_2 = self.grPlot_2.plot([], [], pen=pen_2)
self.plot_3 = self.grPlot_3.plot([], [], pen=pen_3)
self.plot_4 = self.grPlot_4.plot([], [], pen=pen_4)
# Setting a timer
self.timer = pg.QtCore.QTimer()
self.timer.timeout.connect(self.DAQ_loop)
# Initiate DAQ
self.number_of_samples = 10000 # Samples to be collected
self.sample_rate = 100000 # Samples rate production
self.number_of_channels = 4 # Number of channels used during acquisition
self.values_filename = "DAQ_Volt_measurement.txt"
self.values_file = None
self.values_read = np.zeros((self.number_of_channels, self.number_of_samples), dtype=np.float64)
self.t = 0
system = nidaqmx.system.System.local()
Finite_Mode = nidaqmx.constants.AcquisitionType(10178) # Finite acquisition
Cont_Mode = nidaqmx.constants.AcquisitionType(10123) # Continious acquisition
self.write_task = nidaqmx.Task()
self.read_task = nidaqmx.Task()
self.read_task.ai_channels.add_ai_voltage_chan("Dev2/ai11:14", max_val=5, min_val=0)
self.read_task.timing.cfg_samp_clk_timing(rate=self.sample_rate, samps_per_chan=10000000, sample_mode=Cont_Mode)
self.write_task.ao_channels.add_ao_voltage_chan("Dev2/ao0", max_val=1, min_val=0.999)
self.writer = AnalogMultiChannelWriter(self.write_task.out_stream, auto_start=True)
self.reader = AnalogMultiChannelReader(self.read_task.in_stream)
def stopEvent(self):
self.timer.stop()
self.read_task.stop()
self.write_task.stop()
self.values_file.close()
print('--------------------------------------')
print('Stop button pressed')
elapsed = (self.last_read_time - self.start_time).total_seconds()
print("Runtime: {} seconds, {} minutes".format(int(elapsed), int(elapsed / 60)))
def _closeEvent(self):
self.stopEvent()
def startAcquisition(self):
self.values_file = open(self.values_filename, "a")
self.read_task.start()
self.write_task.start()
self.plot_1.setData([], [])
self.plot_2.setData([], [])
self.plot_3.setData([], [])
self.plot_4.setData([], [])
values_to_test = np.ones((1, self.number_of_samples), dtype=np.float64)
self.writer.write_many_sample(values_to_test)
self.start_time = datetime.datetime.now()
self.last_read_time = self.start_time
self.timer.start(20)
def DAQ_loop(self):
###################################################################################################
# If you use cfg_samp_clk_timing set time out as 0.1
self.reader.read_many_sample(self.values_read, number_of_samples_per_channel=self.number_of_samples, timeout=0.1)
read_time = datetime.datetime.now()
elapsed_time = (read_time - self.start_time).total_seconds()
time_resolution = (read_time - self.last_read_time).total_seconds()
val = np.mean(self.values_read, axis=1)
self.signal_queue.put(val)
try:
self.update(elapsed_time, val)
self.values_file.write("{:.3f} {} {} {} {}\n".format(elapsed_time, *val))
except Exception as e:
print(e)
#print("Elapsed: {:.3f} Time resolution: {:.3f}".format(elapsed_time, time_resolution))
self.last_read_time = read_time
def update(self, xval, val, max_nb_val=1000):
xaxis, CH1 = self.plot_1.getData()
_, CH2 = self.plot_2.getData()
_, CH3 = self.plot_3.getData()
_, CH4 = self.plot_4.getData()
xaxis = np.append(xaxis, xval)
CH1 = np.append(CH1, val[0])
CH2 = np.append(CH2, val[1])
CH3 = np.append(CH3, val[2])
CH4 = np.append(CH4, val[3])
xaxis = xaxis[-max_nb_val:]
CH1 = CH1[-max_nb_val:]
CH2 = CH2[-max_nb_val:]
CH3 = CH3[-max_nb_val:]
CH4 = CH4[-max_nb_val:]
self.plot_1.setData(xaxis, CH1)
self.plot_2.setData(xaxis, CH2)
self.plot_3.setData(xaxis, CH3)
self.plot_4.setData(xaxis, CH4)
self.grPlot.setXRange(xval - 5, xval + 5, padding=None)
self.grPlot_2.setXRange(xval - 5, xval + 5, padding=None)
self.grPlot_3.setXRange(xval - 5, xval + 5, padding=None)
self.grPlot_4.setXRange(xval - 5, xval + 5, padding=None)
max1 = max(CH1[-20:]) + 0.4*max(CH1[-20:])
max2 = max(CH2[-20:]) + 0.4*max(CH2[-20:])
max3 = max(CH3[-20:]) + 0.4*max(CH3[-20:])
max4 = max(CH4[-20:]) + 0.4*max(CH4[-20:])
self.grPlot.setYRange(0, max1, padding=None)
self.grPlot_2.setYRange(0, max2, padding=None)
self.grPlot_3.setYRange(0, max3, padding=None)
self.grPlot_4.setYRange(0, max4, padding=None)
if __name__ == "__main__":
queue = queue.LifoQueue()
app = QtWidgets.QApplication([])
window = DAQ_MainWin(app, queue)
window.show()
app.exec_()
import sys
import numpy as np
import time
from MecaRobot.meca_robot_for_dosimetry import MecaRobotForDosimetry
from NI_DAQ.DAQ_Volt_module import *
robot_ip = "192.168.0.100"
robot_port = 10000
simulation_mode = True
enable_log = True
tool_length = 400
source_depth = 170
scintillators_positions = np.array([[5.55, 0, -tool_length+67], [5.55, 0, -tool_length+42], [5.55, 0, -tool_length+13]])
source_position = np.array([264.522,-0.400,128.342])+np.array([5.55+10, 0, 270-tool_length])+np.array([0,0,-source_depth])
robot = MecaRobotForDosimetry(ip = robot_ip,
port = robot_port,
simulation_mode = simulation_mode,
enable_log = enable_log,
scintillators_positions = scintillators_positions,
source_position = source_position,
scintillators_signal_queue=signal_queue)
# Calibrating the source position
robot.run('SetConf', [1,1,-1])
robot.find_source_position(distance_to_source=10)
robot.start_tracking()
robot.move_position_relative_to_source(np.array([-50,0,-64]))
robot.move_position_relative_to_source(np.array([-10,0,-64]))
robot.linear_sequence(np.array([0,0,1]), 74, 0.2)
time.sleep(2)
robot.stop_tracking()
robot.deactivate()
import sys
import numpy as np
import time
from MecaRobot.meca_robot_for_dosimetry import MecaRobotForDosimetry
robot_ip = "192.168.0.100"
robot_port = 10000
simulation_mode = True
enable_log = True
source_position = np.array([277.617,18.972,290.005])+np.array([0,0,-100])+np.array([-0.214,1.45,1.945])
robot = MecaRobotForDosimetry(ip = robot_ip,
port = robot_port,
simulation_mode = simulation_mode,
enable_log = enable_log,
source_position = source_position)
robot.run('SetTRF', [0,0,0,0,-90,0])
robot.start_tracking()
robot.move_position_relative_to_source(np.array([-5,50,0]))
robot.wait_for('3004', 'Did not receive EOM')
robot.move_position_relative_to_source(np.array([-5,10,0]))
robot.wait_for('3004', 'Did not receive EOM')
robot.run('Delay', 5)
robot.linear_sequence(np.array([1,0,0]), 5, 0.2, 0.5)
robot.linear_sequence(np.array([1,0,0]), 5, 0.2, 0.5)
robot.run('Delay', 5)
robot.move_position_relative_to_source(np.array([-10,50,0]))
robot.wait_for('3004', 'Did not receive EOM')
robot.move_position_relative_to_source(np.array([-50,-5,0]))
robot.wait_for('3004', 'Did not receive EOM')
robot.move_position_relative_to_source(np.array([-10,-5,0]))
robot.wait_for('3004', 'Did not receive EOM')
robot.run('Delay', 5)
robot.linear_sequence(np.array([0,1,0]), 5, 0.2, 0.5)
robot.linear_sequence(np.array([0,1,0]), 5, 0.2, 0.5)
robot.run('Delay', 5)
robot.move_position_relative_to_source(np.array([-50,-5,0]))
robot.wait_for('3004', 'Did not receive EOM')
robot.move_position_relative_to_source(np.array([0,50,-5]))
robot.wait_for('3004', 'Did not receive EOM')
robot.move_position_relative_to_source(np.array([0,10,-5]))
robot.wait_for('3004', 'Did not receive EOM')
robot.run('Delay', 5)
robot.linear_sequence(np.array([0,0,1]), 5, 0.2, 0.5)
robot.linear_sequence(np.array([0,0,1]), 5, 0.2, 0.5)
robot.run('Delay', 5)
robot.move_position_relative_to_source(np.array([0,50,-10]))
robot.wait_for('3012', 'Did not receive EOB')
robot.stop_tracking()
time.sleep(5)
robot.deactivate()
\ No newline at end of file
import time
from scipy.spatial.transform import Rotation as R
import numpy as np
from MecaRobot.meca_robot import MecaRobot
"""
Moves the mPSD holder tool attached at the end of the robot in a cone shape to calibrate a NDI Polaris Spectra optical
tracking system. Once this procedure is done, the system tracks the end of the tool very precisely, which allows us to
have a precise initial position measurement in relation to the radioactive source.
"""
def get_cone_orientation(polar_angle, azimutal_angle):
"""
Returns the Euler angles corresponding to a polar rotation followed by an azimutal rotation.
"""
polar_angle = -polar_angle*np.pi/180
azimutal_angle = -azimutal_angle*np.pi/180
polar_rotation = R.from_euler('y',-polar_angle)
axis_about_which_to_turn = np.array([np.sin(polar_angle),0,np.cos(polar_angle)])
quaternion = np.concatenate([-np.sin(azimutal_angle/2)*axis_about_which_to_turn,np.array([np.cos(azimutal_angle/2)])])
aximutal_rotation = R.from_quat(quaternion)
total_rotation = polar_rotation*aximutal_rotation
euler_angles = total_rotation.as_euler('XYZ', degrees=True)
# Not rotating about z-axis so that the NDI tool keeps facing the detector
euler_angles[2] = 0
return euler_angles
if __name__ == '__main__':
robot_ip = "192.168.0.100"
robot_port = 10000
simulation_mode = False
enable_log = True
execution_time = 20
part_to_calibrate = 'MPSD_HOLDER' # MPSD_HOLDER or SOURCE_CATHETER_HOLDER
if part_to_calibrate == 'MPSD_HOLDER':
position = [200,0,130] # mm
polar_angle = -35 # degrees
azimutal_angle = 150 # degrees
TRF = [100,0,4.5,0,-90,0]
elif part_to_calibrate == 'SOURCE_CATHETER_HOLDER':
position = [215,0,150] # mm
polar_angle = -35 # degrees
azimutal_angle = 165
TRF = [70,0,22,0,-90,0]
else:
raise ValueError('part_to_calibrate undefined. Choose MPSD_HOLDER or SOURCE_CATHETER_HOLDER.')
orientation = [0,polar_angle,0]
robot = MecaRobot(robot_ip, robot_port, simulation_mode, enable_log)
robot.run('SetTRF', TRF)
robot.run('SetBlending', 1)
robot.run('SetEOB', 1)
robot.run('MovePose', position+orientation)
robot.clear_buffer
number_of_positions = 50
start_time = time.time()
current_time = 0
while current_time < execution_time:
for i in np.linspace(0,azimutal_angle,number_of_positions):
euler_angles = get_cone_orientation(polar_angle, i)
robot.run('MovePose', position+list(euler_angles))
for i in np.linspace(azimutal_angle,-azimutal_angle,number_of_positions):
euler_angles = get_cone_orientation(polar_angle, i)
robot.run('MovePose', position+list(euler_angles))
for i in np.linspace(-azimutal_angle,0,number_of_positions):
euler_angles = get_cone_orientation(polar_angle, i)
robot.run('MovePose', position+list(euler_angles))
robot.wait_for('3012', 'Did not receive EOB', timeout=60)
current_time = time.time()-start_time
robot.deactivate()
\ No newline at end of file
import sys
import numpy as np
import queue
import threading
from MecaRobot.meca_robot_for_dosimetry import MecaRobotForDosimetry
from NI_DAQ.DAQ_Volt_module import *
# Moves the robot in straight lines of 150 mm towards the source in a water tank.
def robot_thread(signal_queue):
robot_ip = "192.168.0.100"
robot_port = 10000
simulation_mode = True # Only run in simulation, the robot is at full speed!
enable_log = True
tool_length = 399.6
scintillators_positions = np.array([[5.55, 0, -tool_length+67], [5.55, 0, -tool_length+42], [5.55, 0, -tool_length+13]])
source_position = np.array([264.522,-0.400,128.342])+np.array([5.55+10, 0, 270-399.6])+np.array([0,0,-170])
robot = MecaRobotForDosimetry(ip = robot_ip,
port = robot_port,
simulation_mode = simulation_mode,
enable_log = enable_log,
scintillators_positions = scintillators_positions,
source_position = source_position,
scintillators_signal_queue=signal_queue)
# Calibrating the source position
robot.run('SetConf', [1,1,-1])
robot.run('SetCartLinVel', 500)
robot.run('SetJointVel', 100)
# Movements
height_source_start = -64
number_of_straight_lines = 74
lines_resolution = 1
for i in range(number_of_straight_lines):
robot.move_position_relative_to_source(np.array([0,50,lines_resolution*i+height_source_start]))
robot.move_position_relative_to_source(np.array([0,30,lines_resolution*i+height_source_start]))
robot.run('MoveLinRelWRF', [0,-10,0,0,0,0])
robot.move_position_relative_to_source(np.array([0,50,lines_resolution*i+height_source_start]))
for i in range(number_of_straight_lines):
robot.move_position_relative_to_source(np.array([-100,0,lines_resolution*i+height_source_start]))
robot.run('MoveLinRelWRF', [95,0,0,0,0,0])
for i in range(number_of_straight_lines):
robot.move_position_relative_to_source(np.array([0,-50,lines_resolution*i+height_source_start]))
robot.move_position_relative_to_source(np.array([0,-30,lines_resolution*i+height_source_start]))
robot.run('MoveLinRelWRF', [0,10,0,0,0,0])
robot.move_position_relative_to_source(np.array([0,-50,lines_resolution*i+height_source_start]))
robot.run('Delay', 1)
robot.run('MoveLinRelTRF', [-75,0,0,0,0,0])
# Deactivating robot
robot.deactivate()
print('Main program done')
sys.stdout.flush()
with open('log.txt') as log:
content = log.read()
if content.find('singularity') != -1:
print('A singularity was encountered during simulation.')
if __name__ == '__main__':
signal_queue = queue.LifoQueue()
t = threading.Thread(target=robot_thread, args=(signal_queue,))
app = QtWidgets.QApplication([])
window = DAQ_MainWin(app, signal_queue)
t.start()
window.show()
window.startAcquisition()
app.exec_()
\ No newline at end of file
import sys
import numpy as np
import time
from MecaRobot.meca_robot_for_dosimetry import MecaRobotForDosimetry
from NI_DAQ.DAQ_Volt_module import *
# Moves the robot in straight lines of 150 mm towards the source in a water tank.
robot_ip = "192.168.0.100"
robot_port = 10000
simulation_mode = True
enable_log = True
tool_length = 400
scintillators_positions = np.array([[5.55, 0, -tool_length+67], [5.55, 0, -tool_length+42], [5.55, 0, -tool_length+13]])
source_position = np.array([264.522,-0.400,128.342])+np.array([5.55+10, 0, 270-399.6])+np.array([0,0,-170])
robot = MecaRobotForDosimetry(ip = robot_ip,
port = robot_port,
simulation_mode = simulation_mode,
enable_log = enable_log,
scintillators_positions = scintillators_positions,
source_position = source_position,
scintillators_signal_value=val)
# Calibrating the source position
robot.run('SetConf', [1,1,-1])
# Movements
robot.start_tracking()
height_source_start = -64
number_of_straight_lines = 3
lines_resolution = 1
robot.move_position_relative_to_source(np.array([0,50,height_source_start]))
robot.wait_for('3004', 'Did not receive EOM.')
robot.move_position_relative_to_source(np.array([0,20,height_source_start]))
robot.wait_for('3004', 'Did not receive EOM.')
robot.linear_sequence(direction_vector=np.array([0, -1, 0]), total_distance=10, step=0.5)
robot.move_position_relative_to_source(np.array([0,50,height_source_start]))
for i in range(number_of_straight_lines):
robot.move_position_relative_to_source(np.array([-100,0,lines_resolution*i+height_source_start]))
robot.wait_for('3004', 'Did not receive EOM')
robot.linear_sequence(direction_vector=np.array([1,0,0]), total_distance=60, step=5)
robot.linear_sequence(direction_vector=np.array([1,0,0]), total_distance=20, step=1, do_clear_buffer=False)
robot.linear_sequence(direction_vector=np.array([1,0,0]), total_distance=10, step=0.5, do_clear_buffer=False)
robot.linear_sequence(direction_vector=np.array([1,0,0]), total_distance=5, step=0.1, do_clear_buffer=False)
robot.move_position_relative_to_source(np.array([-50,0,height_source_start]))
robot.wait_for('3004', 'Did not receive EOM.')
robot.move_position_relative_to_source(np.array([0,-20,height_source_start]))
robot.wait_for('3004', 'Did not receive EOM.')
robot.linear_sequence(direction_vector=np.array([0, 1, 0]), total_distance=10, step=0.5)
robot.move_position_relative_to_source(np.array([0,-50, height_source_start]))
robot.stop_tracking()
robot.run('Delay', 1)
robot.run('MoveLinRelTRF', [-75,0,0,0,0,0])
# Deactivating robot
robot.deactivate()
print('Main program done')
sys.stdout.flush()
\ No newline at end of file
import sys
import numpy as np
import time
from threading import Timer
from MecaRobot.meca_robot_for_dosimetry import MecaRobotForDosimetry
def stop_robot():
robot.stop_tracking()
time.sleep(5)
robot.deactivate()
t = Timer(500, stop_robot)
t.start()
robot_ip = "192.168.0.100"
robot_port = 10000
simulation_mode = True
enable_log = True
source_position = np.array([277.617,18.972,290.005])+np.array([0,0,-100])+np.array([-0.214,1.45,1.945])+np.array([-0.52,-0.62,0.57])
water_level = -8.415
polar_angles_list = np.array([160, 135, 90, 45, 20]) * np.pi / 180
dwell_time = 0.6
robot = MecaRobotForDosimetry(ip = robot_ip,
port = robot_port,
simulation_mode = simulation_mode,
enable_log = enable_log,
source_position = source_position,
water_level = water_level)
robot.run('SetTRF', [0,0,0,0,-90,0])
robot.start_tracking()
robot.move_position_relative_to_source(np.array([0,50,0]))
robot.wait_for('3004', 'Did not receive EOM.')
robot.move_position_relative_to_source(np.array([0,30,0]))
robot.wait_for('3004', 'Did not receive EOM.')
robot.run('Delay', 5)
robot.linear_sequence(direction_vector=np.array([0, -1, 0]), total_distance=15, step=1, delay=dwell_time)
robot.linear_sequence(direction_vector=np.array([0, -1, 0]), total_distance=7, step=0.5, delay=dwell_time, do_clear_buffer = False)
robot.run('Delay', 5)
robot.move_position_relative_to_source(np.array([-10,50,0]))
robot.wait_for('3004', 'Did not receive EOM.')
robot.move_position_relative_to_source(np.array([-50,0,0]))
robot.wait_for('3004', 'Did not receive EOM.')
robot.move_position_relative_to_source(np.array([-35,0,0]))
robot.wait_for('3004', 'Did not receive EOM.')
robot.run('Delay', 5)
for angle in polar_angles_list:
robot.move_position_relative_to_source(np.array([-4.9, 0, 0]))
robot.wait_for('3004', 'Did not receive EOM.')
direction_vector = np.array([-np.sin(angle), 0, np.cos(angle)])
robot.linear_sequence(direction_vector=direction_vector, total_distance=10, step=0.5, delay=dwell_time)
robot.linear_sequence(direction_vector=direction_vector, total_distance=60, step=1, delay=dwell_time, do_clear_buffer=False)
robot.run('Delay', 5)
robot.move_position_relative_to_source(np.array([-50,0,0]))
robot.wait_for('3004', 'Did not receive EOM.')
robot.move_position_relative_to_source(np.array([0,-30,0]))