@@ -174,8 +174,10 @@ bool AirFlowSensor::Update(
174
174
math::Vector3d air_vel_in_body_ = this ->dataPtr ->vel -
175
175
veh_q_world_to_body.RotateVectorReverse (wind_vel_);
176
176
177
+ // airflow flowing in to the sensor is measured as 0. Hense the substraction
178
+ // of M_2_PI.
177
179
double airflow_direction_in_xy_plane = atan2f (air_vel_in_body_.Y (),
178
- air_vel_in_body_.X ());
180
+ air_vel_in_body_.X ()) - M_PI_2 ;
179
181
180
182
// Apply noise
181
183
if (this ->dataPtr ->dir_noises .find (AIR_FLOW_DIR_NOISE) !=
@@ -187,9 +189,6 @@ bool AirFlowSensor::Update(
187
189
msg.mutable_direction_noise ()->set_type (msgs::SensorNoise::GAUSSIAN);
188
190
}
189
191
190
- // apply resolution to sensor measurement
191
-
192
-
193
192
air_vel_in_body_.Z () = 0 ;
194
193
double airflow_speed = air_vel_in_body_.Length ();
195
194
@@ -199,16 +198,12 @@ bool AirFlowSensor::Update(
199
198
{
200
199
airflow_speed =
201
200
this ->dataPtr ->speed_noises [AIR_FLOW_SPEED_NOISE]->Apply (
202
- airflow_direction_in_xy_plane );
201
+ airflow_speed );
203
202
msg.mutable_speed_noise ()->set_type (msgs::SensorNoise::GAUSSIAN);
204
203
}
205
204
206
- // apply resolution to sensor measurement
207
-
208
-
209
-
210
- msg.set_xy_speed (airflow_direction_in_xy_plane);
211
- msg.set_xy_direction (airflow_speed);
205
+ msg.set_xy_direction (airflow_direction_in_xy_plane);
206
+ msg.set_xy_speed (airflow_speed);
212
207
213
208
// publish
214
209
this ->AddSequence (msg.mutable_header ());
0 commit comments