Changeset 205 in flair-src for trunk/lib/FlairFilter/src/TrajectoryGenerator1D_impl.cpp
- Timestamp:
- 12/05/17 14:20:54 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairFilter/src/TrajectoryGenerator1D_impl.cpp
r177 r205 85 85 86 86 // configure trajectory 87 end_position = end_pos; 87 this->start_pos = start_pos; 88 this->end_pos = end_pos; 88 89 pos = start_pos; 89 90 acc = acceleration->Value(); … … 95 96 v = -max_veloctity->Value(); 96 97 } 97 if (end_pos ition< start_pos) {98 if (end_pos < start_pos) { 98 99 acc = -acc; 99 100 // max_veloctity=-max_veloctity; … … 106 107 v = 0; 107 108 // output->SetValue(1,0,v); 109 } 110 111 float TrajectoryGenerator1D_impl::GetPercentageOfCompletion(void) const { 112 if(!is_started) { 113 return 0; 114 } else { 115 return (pos-start_pos)/(end_pos-start_pos)*100; 116 } 108 117 } 109 118 … … 140 149 } 141 150 pos += v * delta_t; 142 if (end_pos ition- v * v / (2 * acc) <= pos && v >= 0)151 if (end_pos - v * v / (2 * acc) <= pos && v >= 0) 143 152 acc = -acc; 144 if (end_pos ition- v * v / (2 * acc) >= pos && v < 0)153 if (end_pos - v * v / (2 * acc) >= pos && v < 0) 145 154 acc = -acc; 146 if (pos >= end_pos ition&& v >= 0)155 if (pos >= end_pos && v >= 0) 147 156 is_finished = true; 148 if (pos <= end_pos ition&& v < 0)157 if (pos <= end_pos && v < 0) 149 158 is_finished = true; 150 159 } … … 152 161 if (is_finished == true) { 153 162 v = 0; 154 pos = end_pos ition;163 pos = end_pos; 155 164 } 156 165 }
Note:
See TracChangeset
for help on using the changeset viewer.