Skip to content

Commit

Permalink
rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
TomokiMochizuki committed Jan 9, 2024
1 parent ce4c94d commit eeeb016
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
21 changes: 10 additions & 11 deletions s2e-ff/src/components/aocs/qpd_positioning_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void QpdPositioningSensor::MainRoutine(int count) {
if (cos_theta < -1.0) cos_theta = -1.0;
double qpd_laser_received_angle_rad = acos(cos_theta);

// Calc relative position displacement (horizontal direction and vertical direction)
// Calc relative position displacement (the y-axis direction and the z-axis direction)
if (qpd_laser_received_angle_rad > qpd_laser_receivable_angle_rad_) {
continue;
}
Expand Down Expand Up @@ -140,20 +140,19 @@ double QpdPositioningSensor::CalcDisplacement(const libra::Vector<3> point_posit
void QpdPositioningSensor::CalcSensorOutput(LaserEmitter* laser_emitter, const double distance_from_beam_waist_m,
const double qpd_y_axis_displacement_m, const double qpd_z_axis_displacement_m) {
qpd_sensor_radius_m_ = (double)(((int32_t)(qpd_sensor_radius_m_ / qpd_sensor_integral_step_m_)) * qpd_sensor_integral_step_m_);
for (size_t horizontal_step = 0; horizontal_step <= (size_t)(qpd_sensor_radius_m_ / qpd_sensor_integral_step_m_) * 2; horizontal_step++) {
double horizontal_pos_m = qpd_sensor_integral_step_m_ * horizontal_step - qpd_sensor_radius_m_;
double vertical_range_max_m =
(double)((int32_t)(sqrt(pow(qpd_sensor_radius_m_, 2.0) - pow(horizontal_pos_m, 2.0)) / qpd_sensor_integral_step_m_) *
qpd_sensor_integral_step_m_);
for (size_t vertical_step = 0; vertical_step <= (size_t)(vertical_range_max_m / qpd_sensor_integral_step_m_) * 2; vertical_step++) {
double vertical_pos_m = qpd_sensor_integral_step_m_ * vertical_step - vertical_range_max_m;
for (size_t y_axis_step = 0; y_axis_step <= (size_t)(qpd_sensor_radius_m_ / qpd_sensor_integral_step_m_) * 2; y_axis_step++) {
double y_axis_pos_m = qpd_sensor_integral_step_m_ * y_axis_step - qpd_sensor_radius_m_;
double z_axis_range_max_m = (double)((int32_t)(sqrt(pow(qpd_sensor_radius_m_, 2.0) - pow(y_axis_pos_m, 2.0)) / qpd_sensor_integral_step_m_) *
qpd_sensor_integral_step_m_);
for (size_t z_axis_step = 0; z_axis_step <= (size_t)(z_axis_range_max_m / qpd_sensor_integral_step_m_) * 2; z_axis_step++) {
double z_axis_pos_m = qpd_sensor_integral_step_m_ * z_axis_step - z_axis_range_max_m;
double deviation_from_optical_axis_m =
sqrt(pow(horizontal_pos_m - qpd_y_axis_displacement_m, 2.0) + pow(vertical_pos_m - qpd_z_axis_displacement_m, 2.0));
sqrt(pow(y_axis_pos_m - qpd_y_axis_displacement_m, 2.0) + pow(z_axis_pos_m - qpd_z_axis_displacement_m, 2.0));
double temp = laser_emitter->CalcIntensity_W_m2(distance_from_beam_waist_m, deviation_from_optical_axis_m) * qpd_sensor_integral_step_m_ *
qpd_sensor_integral_step_m_;

qpd_sensor_output_y_axis_V_ += CalcSign(-horizontal_pos_m, qpd_sensor_integral_step_m_ / 2) * temp;
qpd_sensor_output_z_axis_V_ += CalcSign(vertical_pos_m, qpd_sensor_integral_step_m_ / 2) * temp;
qpd_sensor_output_y_axis_V_ += CalcSign(-y_axis_pos_m, qpd_sensor_integral_step_m_ / 2) * temp;
qpd_sensor_output_z_axis_V_ += CalcSign(z_axis_pos_m, qpd_sensor_integral_step_m_ / 2) * temp;
qpd_sensor_output_sum_V_ += temp;
}
}
Expand Down
10 changes: 5 additions & 5 deletions s2e-ff/src/components/aocs/qpd_positioning_sensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ class QpdPositioningSensor : public Component, public ILoggable {
libra::Vector<3> y_axis_direction_c_{0.0}; //!< y-axis direction in the component coordinate system
libra::Vector<3> z_axis_direction_c_{0.0}; //!< z-axis direction in the component coordinate system

double qpd_sensor_output_y_axis_V_; //!< Quadrant photodiode sensor output value corresponding to the y-axis direction [V]
double qpd_sensor_output_z_axis_V_; //!< Quadrant photodiode sensor output value corresponding to the y-axis direction [V]
double qpd_sensor_output_sum_V_; //!< Quadrant photodiode sensor output value corresponding to the sum of the light intensity [V]
double qpd_sensor_output_y_axis_V_ = 0.0; //!< Quadrant photodiode sensor output value corresponding to the y-axis direction [V]
double qpd_sensor_output_z_axis_V_ = 0.0; //!< Quadrant photodiode sensor output value corresponding to the y-axis direction [V]
double qpd_sensor_output_sum_V_ = 0.0; //!< Quadrant photodiode sensor output value corresponding to the sum of the light intensity [V]
double observed_y_axis_displacement_m_ = 0.0; //!< Observed displacement in the y-axis direction [m]
double observed_z_axis_displacement_m_ = 0.0; //!< Observed displacement in the z-axis direction [m]

Expand All @@ -103,8 +103,8 @@ class QpdPositioningSensor : public Component, public ILoggable {
double CalcDisplacement(const libra::Vector<3> point_position, const libra::Vector<3> origin_position,
const libra::Vector<3> displacement_direction);

void CalcSensorOutput(LaserEmitter* laser_emitter, const double distance_from_beam_waist_m, const double qpd_horizontal_displacement_m,
const double qpd_vertical_displacement_m);
void CalcSensorOutput(LaserEmitter* laser_emitter, const double distance_from_beam_waist_m, const double qpd_y_axis_displacement_m,
const double qpd_z_axis_displacement_m);
double ObservePositionDisplacement(const QpdObservedPositionDirection observation_direction, const double qpd_sensor_output_V,
const double qpd_sensor_output_sum_V, const std::vector<double>& qpd_ratio_reference_list);
double CalcSign(const double input_value, const double threshold);
Expand Down

0 comments on commit eeeb016

Please sign in to comment.