72 std::pair<int, LaserCorrection>& correction) {
83 correction.second.horiz_offset_correction = 0.0;
89 correction.second.max_intensity = 255;
95 correction.second.min_intensity = 0;
102 correction.second.cos_rot_correction = cosf(correction.second.rot_correction);
103 correction.second.sin_rot_correction = sinf(correction.second.rot_correction);
104 correction.second.cos_vert_correction =
105 cosf(correction.second.vert_correction);
106 correction.second.sin_vert_correction =
107 sinf(correction.second.vert_correction);
108 correction.second.focal_offset =
109 256.0f *
static_cast<float>(std::pow(
110 1 - correction.second.focal_distance / 13100.0f, 2));
111 correction.second.laser_ring = 0;
117 const YAML::Node& lasers = node[
LASERS];
121 if (
static_cast<int>(lasers.size()) != num_lasers) {
122 std::cerr <<
"num_lasers didn't match";
126 for (
int i = 0; i < num_lasers; i++) {
127 std::pair<int, LaserCorrection> correction;
128 lasers[i] >> correction;
136 double next_angle = -std::numeric_limits<double>::infinity();
138 for (
int ring = 0; ring < num_lasers; ++ring) {
140 double min_seen = std::numeric_limits<double>::infinity();
141 int next_index = num_lasers;
143 for (
int j = 0; j < num_lasers; ++j) {
146 if (next_angle < angle && angle < min_seen) {
152 if (next_index < num_lasers) {
155 next_angle = min_seen;
161 const std::pair<int, LaserCorrection>& correction) {
162 out << YAML::BeginMap;
163 out << YAML::Key <<
LASER_ID << YAML::Value << correction.first;
165 << correction.second.rot_correction;
167 << correction.second.vert_correction;
169 << correction.second.dist_correction;
171 << correction.second.dist_correction_x;
173 << correction.second.dist_correction_y;
175 << correction.second.vert_offset_correction;
177 << correction.second.horiz_offset_correction;
179 << correction.second.max_intensity;
181 << correction.second.min_intensity;
183 << correction.second.focal_distance;
185 << correction.second.focal_slope;