- Timestamp:
- Dec 5, 2017, 2:20:54 PM (7 years ago)
- Location:
- trunk/lib/FlairFilter/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairFilter/src/TrajectoryGenerator1D.cpp
r177 r205 89 89 } 90 90 91 float TrajectoryGenerator1D::GetPercentageOfCompletion(void) const { 92 return pimpl_->GetPercentageOfCompletion(); 93 } 94 91 95 } // end namespace filter 92 96 } // end namespace flair -
trunk/lib/FlairFilter/src/TrajectoryGenerator1D.h
r177 r205 127 127 * \brief Position 128 128 * 129 * \return the actual position 129 130 */ 130 131 float Position(void) const; … … 133 134 * \brief Speed 134 135 * 136 * \return the actual speed 135 137 */ 136 138 float Speed(void) const; 139 140 /*! 141 * \brief Get percentage of completion 142 * 143 * Value is between 0 and 100. 144 * 145 * \return the percentage of completion (in position) 146 */ 147 float GetPercentageOfCompletion(void) const; 137 148 138 149 /*! -
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 } -
trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator1D_impl.h
r177 r205 38 38 void StopTraj(void); 39 39 void Reset(void); 40 float GetPercentageOfCompletion(void) const; 40 41 flair::core::cvmatrix *output; 41 42 float pos_off, vel_off; … … 43 44 44 45 private: 45 float end_position;46 float start_pos,end_pos; 46 47 float pos, v, acc; 47 48 flair::core::Time previous_time;
Note:
See TracChangeset
for help on using the changeset viewer.