73 uint8_t encoder_ordinal,
74 bool activate_health_monitoring,
bool measurement_only,
75 uint32_t external_encoder_type_);
79 std::optional<MotionMasterError>
execute(uint64_t pending_signals)
override;
91 enum class CalibrationStage {
104 uint8_t encoder_ordinal_;
105 bool activate_health_monitoring_;
106 bool measurement_only_;
107 uint32_t external_encoder_type_;
109 int32_t hardware_id_;
110 int32_t multiturn_resolution_;
111 uint8_t default_msb_out_;
113 bool biss_reset_required_ =
false;
117 double calibration_velocity_base_value_rpm_;
118 double calibration_velocity_rpm_;
121 int32_t min_software_position_limit_;
122 int32_t max_software_position_limit_;
123 uint32_t position_encoder_singleturn_resolution_;
124 int32_t starting_position_;
125 double profile_acceleration_rpm_;
126 double start_recording_demand_velocity_rpm_;
128 double max_motor_speed_rpm_;
130 double feed_constant_;
134 bool commutation_offset_measurement_possible_ =
false;
136 MU_Handle mu_handle_;
139 bool master_track_calibration_successful_ =
false;
140 bool nonius_track_calibration_successful_ =
false;
141 int32_t iteration_number_ = 0;
142 int32_t max_iterations_ = 13;
143 size_t number_of_samples_ = 6000;
144 size_t number_of_hrd_data_files_;
146 CalibrationStage calibration_stage_ = CalibrationStage::kInit;
148 bool validation_iteration_ =
false;
150 std::optional<std::future<MotionMasterError>> future_;
154 std::unique_ptr<SiUnitVelocity> si_unit_velocity_;
156 static constexpr float coarse_gain_values_[4] = {4.4f, 7.8f, 12.4f, 20.7f};
159 std::vector<std::pair<CalibrationParameters, CalibrationParameters>>
160 calibration_parameter_store_;
162 const std::vector<std::map<CirculoEncoderType, std::pair<int32_t, int32_t>>>
163 magnet_distance_amplification_limits_ = {
180 const std::vector<std::map<CirculoEncoderType, std::vector<double>>>
181 magnet_distance_polynomial_coefficients_ = {
184 {-1.93733026150236881113e-01, 1.84893973187097715449e-02,
185 -1.27277290997118431833e-04, 4.27826067036225706997e-07,
186 -5.20368296543940458560e-10, 0, 0}},
188 {-1.87769498023411640641e-01, 1.27635840217653444284e-02,
189 6.14758921668711374314e-04, -1.34096326750597602447e-05,
190 7.56425020103532749652e-08, 0, 0}},
192 {-1.04397317851772072905e-01, 1.70625714417142575197e-02,
193 -8.13961183382052607229e-05, -4.74936939216182293326e-07,
194 7.04504263424913605881e-09, -2.76371817076000863454e-11,
195 3.64854567222488168656e-14}},
197 {-2.84403156637705600840e-01, 3.12795823555360244517e-02,
198 -3.25259935985799334551e-04, 1.81647913872471759832e-06,
199 -4.91288513836093814287e-09, 5.10776292998975389867e-12, 0}}},
202 {-1.39784903650814168463e-01, 1.45325823633666237344e-02,
203 -7.50005188278302195896e-05, 1.61253405153954890157e-07,
204 -4.89306413790261647012e-11, 0, 0}},
206 {-1.81692029808327909501e-01, 3.02858503823710337177e-02,
207 1.23175956046672112430e-04, -8.59123594643554747716e-06,
208 6.60504319801355069769e-08, 0, 0}},
210 {-3.00602095387669798754e-01, 2.34428435042899098451e-02,
211 -2.62627767128114210458e-04, 1.69123403634972594129e-06,
212 -5.27050975872971237842e-09, 5.33125270236813597257e-12,
213 3.18588067695482955623e-15}},
215 {-1.66308923049894613611e-01, 1.82202872259577333680e-02,
216 3.95115033121136774701e-04, -1.41407239990230904438e-05,
217 1.61906309244842605822e-07, -8.18318393262045254823e-10,
218 1.54906578095712552649e-12}}},
221 {-1.93733026150236881113e-01, 1.84893973187097715449e-02,
222 -1.27277290997118431833e-04, 4.27826067036225706997e-07,
223 -5.20368296543940458560e-10, 0, 0}},
225 {-1.87769498023411640641e-01, 1.27635840217653444284e-02,
226 6.14758921668711374314e-04, -1.34096326750597602447e-05,
227 7.56425020103532749652e-08, 0, 0}},
229 {-1.04397317851772072905e-01, 1.70625714417142575197e-02,
230 -8.13961183382052607229e-05, -4.74936939216182293326e-07,
231 7.04504263424913605881e-09, -2.76371817076000863454e-11,
232 3.64854567222488168656e-14}},
234 {-2.84403156637705600840e-01, 3.12795823555360244517e-02,
235 -3.25259935985799334551e-04, 1.81647913872471759832e-06,
236 -4.91288513836093814287e-09, 5.10776292998975389867e-12, 0}}}};
256 void set_default_msb_out();
260 static MU_Error extract_calibration_parameters(
261 MU_Handle mu_handle,
long int* analog_data, int32_t number_of_samples,
264 std::pair<MotionMasterError, MU_Error> write_master_track_analog_parameters(
265 MU_Handle mu_handle);
267 std::pair<MotionMasterError, MU_Error> write_nonius_track_analog_parameters(
268 MU_Handle mu_handle);
272 static bool check_master_track_calibration(
275 static bool check_nonius_track_calibration(
278 std::pair<MotionMasterError, MU_Error> write_nonius_parameters(
279 MU_Handle mu_handle);
287 void write_final_nonius_data_debug_file();
289 MU_Error calibrate_nonius();
291 void log_all_calibration_parameters();
297 void limit_calibration_velocity(
double max_calibration_velocity_rpm,
298 bool notify =
false);
306 bool commutation_offset_measurement_possible();
308 int32_t convert_angle_to_position_units(
double angle)
const;