17 #ifndef ROTORS_GAZEBO_PLUGINS_FW_DYNAMICS_PLUGIN_H 18 #define ROTORS_GAZEBO_PLUGINS_FW_DYNAMICS_PLUGIN_H 20 #include <gazebo/common/Plugin.hh> 21 #include <gazebo/common/common.hh> 22 #include <gazebo/gazebo.hh> 23 #include <gazebo/physics/physics.hh> 26 #include "Actuators.pb.h" 27 #include "RollPitchYawrateThrust.pb.h" 28 #include "WindSpeed.pb.h" 61 void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
64 void OnUpdate(
const common::UpdateInfo&);
153 roll_pitch_yawrate_thrust_msg);
163 #endif // ROTORS_GAZEBO_PLUGINS_FW_DYNAMICS_PLUGIN_H void CreatePubsAndSubs()
Creates all required publishers and subscribers, incl. routing of messages to/from ROS if required...
const boost::shared_ptr< const gz_mav_msgs::WindSpeed > GzWindSpeedMsgPtr
physics::LinkPtr link_
Pointer to the link.
const boost::shared_ptr< const gz_mav_msgs::RollPitchYawrateThrust > GzRollPitchYawrateThrustMsgPtr
std::string actuators_sub_topic_
Topic name for actuator commands.
transport::NodePtr node_handle_
Handle for the Gazebo node.
static constexpr bool kDefaultIsInputJoystick
static constexpr double kAirDensity
void ActuatorsCallback(GzActuatorsMsgPtr &actuators_msg)
Processes the actuator commands.
double NormalizedInputToAngle(const ControlSurface &surface, double input)
Convert control surface input that is normalized in range [-1, 1] to a physical deflection angle valu...
double throttle_
Throttle input, in range from 0 to 1.
const boost::shared_ptr< const gz_sensor_msgs::Actuators > GzActuatorsMsgPtr
event::ConnectionPtr updateConnection_
Pointer to the update event connection.
void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf)
Called when the plugin is first created, and after the world has been loaded. This function should no...
gazebo::transport::SubscriberPtr wind_speed_sub_
Subscriber ror receiving wind speed readings.
double delta_aileron_left_
Left aileron deflection [rad].
ignition::math::Vector3d W_wind_speed_W_B_
Most current wind speed reading [m/s].
void OnUpdate(const common::UpdateInfo &)
This gets called by the world update start event.
std::string roll_pitch_yawrate_thrust_sub_topic_
Topic name for roll_pitch_yawrate_thrust commands.
FWVehicleParameters vehicle_params_
The physical properties of the aircraft.
std::string namespace_
Transport namespace.
physics::ModelPtr model_
Pointer to the model.
void UpdateForcesAndMoments()
Calculates the forces and moments to be applied to the fixed-wing body.
gazebo::transport::SubscriberPtr actuators_sub_
Subscriber for receiving actuator commands.
double delta_rudder_
Rudder deflection [rad].
double delta_flap_
Flap deflection [rad].
void WindSpeedCallback(GzWindSpeedMsgPtr &wind_speed_msg)
Processes the wind speed readings.
void RollPitchYawrateThrustCallback(GzRollPitchYawrateThrustMsgPtr &roll_pitch_yawrate_thrust_msg)
Process the roll_pitch_yawrate_thrust commands.
bool is_input_joystick_
Are the input commands coming from a joystick (as opposed to a remote control via HIL interface...
physics::WorldPtr world_
Pointer to the world.
FWAerodynamicParameters aero_params_
The aerodynamic properties of the aircraft.
std::string wind_speed_sub_topic_
Topic name for wind speed readings.
gazebo::transport::SubscriberPtr roll_pitch_yawrate_thrust_sub_
Subscriber for receiving roll_pitch_yawrate_thrust commands.
static constexpr double kGravity
static constexpr double kMinAirSpeedThresh
double delta_elevator_
Elevator deflection [rad].
GazeboFwDynamicsPlugin()
Constructor.
virtual ~GazeboFwDynamicsPlugin()
Destructor.
bool pubs_and_subs_created_
Flag that is set to true once CreatePubsAndSubs() is called, used to prevent CreatePubsAndSubs() from...
double delta_aileron_right_
Right aileron deflection [rad].