Skip to content

Commit

Permalink
fixed a logic issue and check for small floating point numbers
Browse files Browse the repository at this point in the history
Signed-off-by: frederik <[email protected]>
  • Loading branch information
fredmarkus committed Oct 30, 2023
1 parent aa9f600 commit 6745e32
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/systems/advanced_lift_drag/AdvancedLiftDrag.cc
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,12 @@ void AdvancedLiftDragPrivate::Load(const EntityComponentManager &_ecm,
this->area = _sdf->Get<double>("area", this->area).first;

// blade forward (-drag) direction in link frame
this->forward =
_sdf->Get<math::Vector3d>("forward", this->forward).first;
if(this->forward.Length() != 0){
this->forward =
_sdf->Get<math::Vector3d>("forward", this->forward).first;
this->forward.Normalize();
}

else
{
gzerr << "Forward vector length is zero. This is not valid.\n";
Expand Down Expand Up @@ -512,7 +513,7 @@ void AdvancedLiftDragPrivate::Update(EntityComponentManager &_ecm)
body_y_axis)*body_y_axis;

// Compute dynamic pressure
if(velInLDPlane.Length() == 0){
if(velInLDPlane.Length() <= 1e-9){
gzerr << "In-plane velocity of vehicle cannot be 0.\n";
this->validConfig = false;
return;
Expand Down

0 comments on commit 6745e32

Please sign in to comment.