Skip to content

Commit 21432b2

Browse files
author
henrykotze
committed
codecheck passed updates
Signed-off-by: henrykotze <[email protected]>
1 parent 62a58c6 commit 21432b2

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/systems/air_flow/AirFlow.cc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ class gz::sim::systems::AirFlowPrivate
8787

8888
/// \brief Update air flow sensor data based on physics data
8989
/// \param[in] _ecm Immutable reference to ECM.
90-
public: void UpdateAirFlows(const EntityComponentManager &_ecm, gz::math::Vector3d wind);
90+
/// \param[in] wind The wind conditions in the environment
91+
public: void UpdateAirFlows(const EntityComponentManager &_ecm,
92+
gz::math::Vector3d wind);
9193

9294
/// \brief Remove air flow sensors if their entities have been removed
9395
/// from simulation.
@@ -146,13 +148,13 @@ void AirFlow::PostUpdate(const UpdateInfo &_info,
146148
if (!_info.paused)
147149
{
148150

149-
150-
gz::math::Vector3d wind{0,0,0};
151+
gz::math::Vector3d wind{0, 0, 0};
151152
// get wind as a component from the _ecm
152153
if(_ecm.EntityByComponents(components::Wind()) != kNullEntity){
153154

154155
Entity windEntity = _ecm.EntityByComponents(components::Wind());
155-
auto windLinearVel = _ecm.Component<components::WorldLinearVelocity>(windEntity);
156+
auto windLinearVel = _ecm.Component<components::WorldLinearVelocity>
157+
(windEntity);
156158

157159
if (windLinearVel != nullptr){
158160
wind = windLinearVel->Data();
@@ -268,7 +270,8 @@ void AirFlowPrivate::CreateSensors(const EntityComponentManager &_ecm)
268270
}
269271

270272
//////////////////////////////////////////////////
271-
void AirFlowPrivate::UpdateAirFlows(const EntityComponentManager &_ecm, math::Vector3d wind)
273+
void AirFlowPrivate::UpdateAirFlows(const EntityComponentManager &_ecm,
274+
math::Vector3d wind)
272275
{
273276
GZ_PROFILE("AirFlowPrivate::UpdateAirFlows");
274277
_ecm.Each<components::AirFlowSensor, components::WorldPose>(
@@ -287,8 +290,7 @@ void AirFlowPrivate::UpdateAirFlows(const EntityComponentManager &_ecm, math::Ve
287290

288291
if(wind.IsFinite()){
289292
it->second->SetWindVelocity(wind);
290-
} else
291-
{
293+
} else {
292294
gzwarn << "Wind velocity is ignored. Contains NaN";
293295
it->second->SetWindVelocity(gz::math::Vector3d::Zero);
294296
}

test/integration/air_flow_system.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737

3838
#include "../helpers/Relay.hh"
3939
#include "../helpers/EnvTestFixture.hh"
40-
#include "test_config.hh"
4140

4241
using namespace gz;
4342
using namespace sim;
@@ -142,7 +141,7 @@ TEST_F(AirFlowTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(AirFlow))
142141

143142
/////////////////////////////////////////////////
144143
// The test checks if the sensor is capable of measuring
145-
// the
144+
// the wind conditions when it is stationary
146145
TEST_F(AirFlowTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(AirFlowWindy))
147146
{
148147
// Start server
@@ -232,8 +231,8 @@ TEST_F(AirFlowTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(AirFlowWindy))
232231
}
233232

234233
/////////////////////////////////////////////////
235-
// The test checks if the sensor is moving at the same speed as the
236-
// wind, that it measure no airflow
234+
// The test checks that the sensor measures the correct relative airflow
235+
// when it is moving within windy condition.
237236
TEST_F(AirFlowTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(AirFlowMoveWindy))
238237
{
239238
// Start server
@@ -277,9 +276,8 @@ TEST_F(AirFlowTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(AirFlowMoveWindy))
277276
body = Link(bodyEntity);
278277
body.EnableVelocityChecks(_ecm);
279278

280-
body.SetLinearVelocity(_ecm, gz::math::Vector3d(1,5,0));
279+
body.SetLinearVelocity(_ecm, gz::math::Vector3d(1, 5, 0));
281280

282-
283281
}).OnPostUpdate([&](const UpdateInfo &_info,
284282
const EntityComponentManager &_ecm)
285283
{

0 commit comments

Comments
 (0)