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_;
138 MU_Calibration* mu_calibration_ =
nullptr;
140 MU_CalibrationAnalyzeResult* mu_analyze_result_ =
nullptr;
143 bool master_track_calibration_successful_ =
false;
144 bool nonius_track_calibration_successful_ =
false;
145 int32_t iteration_number_ = 0;
146 int32_t max_iterations_ = 13;
147 size_t number_of_samples_ = 6000;
148 size_t number_of_hrd_data_files_;
150 CalibrationStage calibration_stage_ = CalibrationStage::kInit;
152 bool validation_iteration_ =
false;
154 std::optional<std::future<MotionMasterError>> future_;
158 std::unique_ptr<SiUnitVelocity> si_unit_velocity_;
160 static constexpr float coarse_gain_values_[4] = {4.4f, 7.8f, 12.4f, 20.7f};
163 std::vector<std::pair<CalibrationParameters, CalibrationParameters>>
164 calibration_parameter_store_;
166 const std::vector<std::map<CirculoEncoderType, std::pair<int32_t, int32_t>>>
167 magnet_distance_amplification_limits_ = {
184 const std::vector<std::map<CirculoEncoderType, std::vector<double>>>
185 magnet_distance_polynomial_coefficients_ = {
188 {-1.93733026150236881113e-01, 1.84893973187097715449e-02,
189 -1.27277290997118431833e-04, 4.27826067036225706997e-07,
190 -5.20368296543940458560e-10, 0, 0}},
192 {-1.87769498023411640641e-01, 1.27635840217653444284e-02,
193 6.14758921668711374314e-04, -1.34096326750597602447e-05,
194 7.56425020103532749652e-08, 0, 0}},
196 {-1.04397317851772072905e-01, 1.70625714417142575197e-02,
197 -8.13961183382052607229e-05, -4.74936939216182293326e-07,
198 7.04504263424913605881e-09, -2.76371817076000863454e-11,
199 3.64854567222488168656e-14}},
201 {-2.84403156637705600840e-01, 3.12795823555360244517e-02,
202 -3.25259935985799334551e-04, 1.81647913872471759832e-06,
203 -4.91288513836093814287e-09, 5.10776292998975389867e-12, 0}}},
206 {-1.39784903650814168463e-01, 1.45325823633666237344e-02,
207 -7.50005188278302195896e-05, 1.61253405153954890157e-07,
208 -4.89306413790261647012e-11, 0, 0}},
210 {-1.81692029808327909501e-01, 3.02858503823710337177e-02,
211 1.23175956046672112430e-04, -8.59123594643554747716e-06,
212 6.60504319801355069769e-08, 0, 0}},
214 {-3.00602095387669798754e-01, 2.34428435042899098451e-02,
215 -2.62627767128114210458e-04, 1.69123403634972594129e-06,
216 -5.27050975872971237842e-09, 5.33125270236813597257e-12,
217 3.18588067695482955623e-15}},
219 {-1.66308923049894613611e-01, 1.82202872259577333680e-02,
220 3.95115033121136774701e-04, -1.41407239990230904438e-05,
221 1.61906309244842605822e-07, -8.18318393262045254823e-10,
222 1.54906578095712552649e-12}}},
225 {-1.93733026150236881113e-01, 1.84893973187097715449e-02,
226 -1.27277290997118431833e-04, 4.27826067036225706997e-07,
227 -5.20368296543940458560e-10, 0, 0}},
229 {-1.87769498023411640641e-01, 1.27635840217653444284e-02,
230 6.14758921668711374314e-04, -1.34096326750597602447e-05,
231 7.56425020103532749652e-08, 0, 0}},
233 {-1.04397317851772072905e-01, 1.70625714417142575197e-02,
234 -8.13961183382052607229e-05, -4.74936939216182293326e-07,
235 7.04504263424913605881e-09, -2.76371817076000863454e-11,
236 3.64854567222488168656e-14}},
238 {-2.84403156637705600840e-01, 3.12795823555360244517e-02,
239 -3.25259935985799334551e-04, 1.81647913872471759832e-06,
240 -4.91288513836093814287e-09, 5.10776292998975389867e-12, 0}}}};
260 void set_default_msb_out();
297 MU_Error analyze_and_compute_analog_adjustments(
298 const uint16_t* master_data,
const uint16_t* nonius_data,
325 std::pair<MotionMasterError, MU_Error> write_master_track_analog_parameters();
353 std::pair<MotionMasterError, MU_Error> write_nonius_track_analog_parameters();
396 static bool is_master_analog_within_tolerance(
416 static bool is_nonius_analog_within_tolerance(
438 std::pair<MotionMasterError, MU_Error> write_nonius_sync_table();
512 void print_calibration_summary();
514 void write_final_nonius_data_debug_file();
534 MU_Error apply_optimized_nonius_table();
536 void log_all_calibration_parameters();
542 void limit_calibration_velocity(
double max_calibration_velocity_rpm,
543 bool notify =
false);
551 bool commutation_offset_measurement_possible();
553 int32_t convert_angle_to_position_units(
double angle)
const;