diff --git a/examples/worlds/advanced_lift_drag_system.sdf b/examples/worlds/advanced_lift_drag_system.sdf index d1d82a0eec..1c8ee16041 100644 --- a/examples/worlds/advanced_lift_drag_system.sdf +++ b/examples/worlds/advanced_lift_drag_system.sdf @@ -117,7 +117,7 @@ gz topic -e -t /world/advanced_lift_drag/model/advanced_lift_drag_demo_model/joi 0.1 0.1 0.1 - model://rc_cessna/meshes/body.dae + https://fuel.gazebosim.org/1.0/frede791/models/Advanced%20Plane/tip/files/meshes/body.dae @@ -184,7 +184,7 @@ gz topic -e -t /world/advanced_lift_drag/model/advanced_lift_drag_demo_model/joi 1 1 1 - model://rc_cessna/meshes/iris_prop_ccw.dae + https://fuel.gazebosim.org/1.0/frede791/models/Advanced%20Plane/tip/files/meshes/iris_prop_ccw.dae @@ -232,7 +232,7 @@ gz topic -e -t /world/advanced_lift_drag/model/advanced_lift_drag_demo_model/joi 0.1 0.1 0.1 - model://rc_cessna/meshes/left_aileron.dae + https://fuel.gazebosim.org/1.0/frede791/models/Advanced%20Plane/tip/files/meshes/left_aileron.dae @@ -260,7 +260,7 @@ gz topic -e -t /world/advanced_lift_drag/model/advanced_lift_drag_demo_model/joi 0.1 0.1 0.1 - model://rc_cessna/meshes/right_aileron.dae + https://fuel.gazebosim.org/1.0/frede791/models/Advanced%20Plane/tip/files/meshes/right_aileron.dae @@ -288,7 +288,7 @@ gz topic -e -t /world/advanced_lift_drag/model/advanced_lift_drag_demo_model/joi 0.1 0.1 0.1 - model://rc_cessna/meshes/left_flap.dae + https://fuel.gazebosim.org/1.0/frede791/models/Advanced%20Plane/tip/files/meshes/left_flap.dae @@ -316,7 +316,7 @@ gz topic -e -t /world/advanced_lift_drag/model/advanced_lift_drag_demo_model/joi 0.1 0.1 0.1 - model://rc_cessna/meshes/right_flap.dae + https://fuel.gazebosim.org/1.0/frede791/models/Advanced%20Plane/tip/files/meshes/right_flap.dae @@ -344,7 +344,7 @@ gz topic -e -t /world/advanced_lift_drag/model/advanced_lift_drag_demo_model/joi 0.1 0.1 0.1 - model://rc_cessna/meshes/elevators.dae + https://fuel.gazebosim.org/1.0/frede791/models/Advanced%20Plane/tip/files/meshes/elevators.dae @@ -372,7 +372,7 @@ gz topic -e -t /world/advanced_lift_drag/model/advanced_lift_drag_demo_model/joi 0.1 0.1 0.1 - model://rc_cessna/meshes/rudder.dae + https://fuel.gazebosim.org/1.0/frede791/models/Advanced%20Plane/tip/files/meshes/rudder.dae @@ -678,4 +678,4 @@ gz topic -e -t /world/advanced_lift_drag/model/advanced_lift_drag_demo_model/joi - \ No newline at end of file + diff --git a/src/systems/advanced_lift_drag/AdvancedLiftDrag.cc b/src/systems/advanced_lift_drag/AdvancedLiftDrag.cc index 63830a07cc..66d3633a07 100644 --- a/src/systems/advanced_lift_drag/AdvancedLiftDrag.cc +++ b/src/systems/advanced_lift_drag/AdvancedLiftDrag.cc @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * @author: Karthik Srivatsan, Frederik Markus * @version: 1.1 * @@ -346,7 +346,7 @@ void AdvancedLiftDragPrivate::Load(const EntityComponentManager &_ecm, if (entities.empty()) { gzerr << "Joint with name[" << ctrl_surface_name << "] not found. " - << "The LiftDrag will not generate forces\n"; + << "The LiftDrag will not generate forces.\n"; this->validConfig = false; return; } @@ -361,7 +361,8 @@ void AdvancedLiftDragPrivate::Load(const EntityComponentManager &_ecm, components::Joint::typeId)) { this->controlJointEntity = kNullEntity; - gzerr << "Entity with name[" << ctrl_surface_name << "] is not a joint\n"; + gzerr << "Entity with name[" << ctrl_surface_name + << "] is not a joint.\n"; this->validConfig = false; return; } @@ -400,9 +401,17 @@ void AdvancedLiftDragPrivate::Load(const EntityComponentManager &_ecm, this->area = _sdf->Get("area", this->area).first; // blade forward (-drag) direction in link frame - this->forward = - _sdf->Get("forward", this->forward).first; - this->forward.Normalize(); + if(this->forward.Length() != 0){ + this->forward = + _sdf->Get("forward", this->forward).first; + this->forward.Normalize(); + } + else + { + gzerr << "Forward vector length is zero. This is not valid.\n"; + this->validConfig = false; + return; + } // blade upward (+lift) direction in link frame this->upward = _sdf->Get( @@ -422,7 +431,7 @@ void AdvancedLiftDragPrivate::Load(const EntityComponentManager &_ecm, if (entities.empty()) { gzerr << "Link with name[" << linkName << "] not found. " - << "The AdvancedLiftDrag will not generate forces\n"; + << "The AdvancedLiftDrag will not generate forces.\n"; this->validConfig = false; return; } @@ -437,14 +446,14 @@ void AdvancedLiftDragPrivate::Load(const EntityComponentManager &_ecm, components::Link::typeId)) { this->linkEntity = kNullEntity; - gzerr << "Entity with name[" << linkName << "] is not a link\n"; + gzerr << "Entity with name[" << linkName << "] is not a link.\n"; this->validConfig = false; return; } } else { - gzerr << "The AdvancedLiftDrag system requires the 'link_name' parameter\n"; + gzerr << "AdvancedLiftDrag system requires the 'link_name' parameter.\n"; this->validConfig = false; return; } @@ -503,6 +512,11 @@ void AdvancedLiftDragPrivate::Update(EntityComponentManager &_ecm) body_y_axis)*body_y_axis; // Compute dynamic pressure + if(velInLDPlane.Length() == 0){ + gzerr << "In-plane velocity of vehicle cannot be 0.\n"; + this->validConfig = false; + return; + } const double speedInLDPlane = velInLDPlane.Length(); // Define stability frame: X is in-plane velocity, Y is the same as body Y, @@ -530,6 +544,11 @@ void AdvancedLiftDragPrivate::Update(EntityComponentManager &_ecm) { AngVel = _ecm.Component(this->linkEntity); } + if(AngVel == nullptr){ + gzerr << "Angular Velocity cannot be null.\n"; + this->validConfig = false; + return; + } double rr = AngVel->Data()[0]; // Roll rate double pr = -1*AngVel->Data()[1]; // Pitch rate @@ -818,8 +837,3 @@ GZ_ADD_PLUGIN(AdvancedLiftDrag, System, AdvancedLiftDrag::ISystemConfigure, AdvancedLiftDrag::ISystemPreUpdate) - -GZ_ADD_PLUGIN_ALIAS(AdvancedLiftDrag, "gz::sim::systems::AdvancedLiftDrag") - -// TODO(CH3): Deprecated, remove on version 8 -GZ_ADD_PLUGIN_ALIAS(AdvancedLiftDrag, "ignition::systems::AdvancedLiftDrag") \ No newline at end of file diff --git a/src/systems/advanced_lift_drag/AdvancedLiftDrag.hh b/src/systems/advanced_lift_drag/AdvancedLiftDrag.hh index 521790b8d3..0a5be89e8f 100644 --- a/src/systems/advanced_lift_drag/AdvancedLiftDrag.hh +++ b/src/systems/advanced_lift_drag/AdvancedLiftDrag.hh @@ -149,5 +149,4 @@ namespace systems } } } - -#endif \ No newline at end of file +#endif