@@ -68,6 +68,9 @@ class gz::sensors::AirSpeedSensorPrivate
6868 // / \brief Velocity of the air coming from the sensor
6969 public: gz::math::Vector3d vel;
7070
71+ // / \brief Velocity of the wind coming from the sensor
72+ public: gz::math::Vector3d windVel;
73+
7174 // / \brief Noise added to sensor data
7275 public: std::map<SensorNoiseType, NoisePtr> noises;
7376};
@@ -169,12 +172,10 @@ bool AirSpeedSensor::Update(
169172 const float density_ratio = powf (kTemperaturMsl / temperature_local , 4 .256f );
170173 const float air_density = kAirDensityMsl / density_ratio;
171174
172- math::Vector3d wind_vel_{0 , 0 , 0 };
173175 math::Quaterniond veh_q_world_to_body = this ->Pose ().Rot ();
174-
175176 // calculate differential pressure + noise in hPa
176177 math::Vector3d air_vel_in_body_ = this ->dataPtr ->vel -
177- veh_q_world_to_body.RotateVectorReverse (wind_vel_ );
178+ veh_q_world_to_body.RotateVectorReverse (this -> dataPtr -> windVel );
178179 float diff_pressure = math::sgn (air_vel_in_body_.X ()) * 0 .005f * air_density
179180 * air_vel_in_body_.X () * air_vel_in_body_.X ();
180181
@@ -209,6 +210,12 @@ void AirSpeedSensor::SetVelocity(const gz::math::Vector3d &_vel)
209210 this ->dataPtr ->vel = _vel;
210211}
211212
213+ // ////////////////////////////////////////////////
214+ void AirSpeedSensor::SetWindVelocity (const gz::math::Vector3d &_windVel)
215+ {
216+ this ->dataPtr ->windVel = _windVel;
217+ }
218+
212219// ////////////////////////////////////////////////
213220bool AirSpeedSensor::HasConnections () const
214221{
0 commit comments