|
38 | 38 | #include <sofa/component/topology/container/dynamic/EdgeSetGeometryAlgorithms.h> |
39 | 39 | #include <sofa/core/behavior/MechanicalState.h> |
40 | 40 | #include <sofa/helper/AdvancedTimer.h> |
41 | | -#include <sofa/helper/system/FileRepository.h> |
42 | 41 | #include <sofa/type/vector_algorithm.h> |
43 | 42 |
|
44 | 43 |
|
@@ -68,12 +67,10 @@ InterventionalRadiologyController<DataTypes>::InterventionalRadiologyController( |
68 | 67 | , d_startingPos(initData(&d_startingPos,Coord(),"startingPos","starting pos for inserting the instrument")) |
69 | 68 | , d_threshold(initData(&d_threshold, (Real)0.01, "threshold", "threshold for controller precision which is homogeneous to the unit of length used in the simulation")) |
70 | 69 | , d_rigidCurvAbs(initData(&d_rigidCurvAbs, "rigidCurvAbs", "pairs of curv abs for beams we want to rigidify")) |
71 | | -, d_motionFilename(initData(&d_motionFilename, "motionFilename", "text file that includes tracked motion from optical sensor")) |
72 | 70 | , d_indexFirstNode(initData(&d_indexFirstNode, (unsigned int) 0, "indexFirstNode", "first node (should be fixed with restshape)")) |
73 | 71 | , l_fixedConstraint(initLink("fixedConstraint", "Path to the FixedProjectiveConstraint")) |
74 | 72 | , l_mechanicalTopology(initLink("topology", "Path to the mechanical topology")) |
75 | 73 | { |
76 | | - m_sensored =false; |
77 | 74 | } |
78 | 75 |
|
79 | 76 |
|
@@ -137,13 +134,7 @@ void InterventionalRadiologyController<DataTypes>::init() |
137 | 134 | { |
138 | 135 | m_FF=true; |
139 | 136 | m_RW=false; |
140 | | - m_sensored = false; |
141 | 137 | } |
142 | | - if (!d_motionFilename.getValue().empty()) |
143 | | - { |
144 | | - m_FF = true; m_sensored = true; m_currentSensorData = 0; |
145 | | - loadMotionData(d_motionFilename.getValue()); |
146 | | - } |
147 | 138 |
|
148 | 139 | auto checkData = [&](auto& data) |
149 | 140 | { |
@@ -296,31 +287,6 @@ void InterventionalRadiologyController<DataTypes>::init() |
296 | 287 | sofa::core::objectmodel::BaseComponent::d_componentState.setValue(sofa::core::objectmodel::ComponentState::Valid); |
297 | 288 | } |
298 | 289 |
|
299 | | -template<class DataTypes> |
300 | | -void InterventionalRadiologyController<DataTypes>::loadMotionData(std::string filename) |
301 | | -{ |
302 | | - if (!helper::system::DataRepository.findFile(filename)) |
303 | | - { |
304 | | - msg_error() << "File " << filename << " not found."; |
305 | | - return; |
306 | | - } |
307 | | - std::ifstream file(filename.c_str()); |
308 | | - |
309 | | - std::string line; |
310 | | - Vec3 result; |
311 | | - while( std::getline(file,line) ) |
312 | | - { |
313 | | - if (line.empty()) |
314 | | - continue; |
315 | | - std::istringstream values(line); |
316 | | - values >> result[0] >> result[1] >> result[2]; |
317 | | - result[0] /= 1000; |
318 | | - m_sensorMotionData.push_back(result); |
319 | | - } |
320 | | - |
321 | | - file.close(); |
322 | | -} |
323 | | - |
324 | 290 | /*! |
325 | 291 | * \todo fix the mouse event with better controls |
326 | 292 | */ |
@@ -413,26 +379,7 @@ void InterventionalRadiologyController<DataTypes>::onBeginAnimationStep(const do |
413 | 379 | } |
414 | 380 | if (m_FF) |
415 | 381 | { |
416 | | - if (!m_sensored) |
417 | | - xInstrTip[id] += d_speed.getValue() * context->getDt(); |
418 | | - else |
419 | | - { |
420 | | - unsigned int newSensorData = m_currentSensorData + 1; |
421 | | - |
422 | | - while( m_sensorMotionData[newSensorData][0] < context->getTime() ) |
423 | | - { |
424 | | - m_currentSensorData = newSensorData; |
425 | | - newSensorData++; |
426 | | - } |
427 | | - if(newSensorData >= m_sensorMotionData.size()) |
428 | | - { |
429 | | - xInstrTip[id] = 0; |
430 | | - } |
431 | | - else |
432 | | - { |
433 | | - xInstrTip[id] += m_sensorMotionData[m_currentSensorData][1]; |
434 | | - } |
435 | | - } |
| 382 | + xInstrTip[id] += d_speed.getValue() * context->getDt(); |
436 | 383 | } |
437 | 384 | if (m_RW) |
438 | 385 | { |
|
0 commit comments