25 std::string air_speed_sub_topic;
26 std::string gps_sub_topic;
27 std::string ground_speed_sub_topic;
28 std::string imu_sub_topic;
42 air_speed_sub_topic, 1, boost::bind(
47 gps_sub_topic, 1, boost::bind(
52 ground_speed_sub_topic, 1, boost::bind(
57 imu_sub_topic, 1, boost::bind(
65 boost::mutex::scoped_lock lock(
mtx_);
71 std::vector<mavros_msgs::Mavlink> hil_msgs;
103 mavlink_msg_hil_state_quaternion_encode(1, 0, &mmsg, hil_state_qtrn_msg_ptr);
105 mavros_msgs::MavlinkPtr rmsg_hil_state_qtrn = boost::make_shared<mavros_msgs::Mavlink>();
106 rmsg_hil_state_qtrn->header.stamp.sec = current_time.
sec;
107 rmsg_hil_state_qtrn->header.stamp.nsec = current_time.
nsec;
110 hil_msgs.push_back(*rmsg_hil_state_qtrn);
std::vector< mavros_msgs::Mavlink > CollectData()
Gather data collected from ROS messages into MAVLINK messages.
boost::mutex mtx_
Mutex lock for thread safety of reading hil data.
void GroundSpeedCallback(const geometry_msgs::TwistStampedConstPtr &ground_speed_msg, HilData *hil_data)
Callback for handling Ground Speed messages.
static constexpr char AIR_SPEED[]
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
ros::Subscriber ground_speed_sub_
ROS ground speed subscriber.
Eigen::Matrix3f R_S_B_
Rotation, in matrix form, from body into sensor (NED) frame.
static constexpr float kGravityMagnitude_m_per_s2
Eigen::Vector3f acc_m_per_s2
bool convert(const mavros_msgs::Mavlink &rmsg, mavlink_message_t &mmsg)
static constexpr float kMetersToMm
HilData hil_data_
Object for storing the latest data.
ros::Subscriber imu_sub_
ROS IMU subscriber.
uint16_t true_airspeed_1e2m_per_s
ros::NodeHandle nh_
ROS node handle.
uint16_t ind_airspeed_1e2m_per_s
mavlink_hil_state_quaternion_t hil_state_qtrn_msg_
MAVLINK HIL_STATE_QUATERNION message.
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
HilStateLevelInterface(const Eigen::Quaterniond &q_S_B)
Constructor.
static constexpr char GPS[]
void AirSpeedCallback(const geometry_msgs::TwistStampedConstPtr &air_speed_msg, HilData *hil_data)
Callback for handling Air Speed messages.
static constexpr char GROUND_SPEED[]
Eigen::Quaterniond q_S_B_
Rotation, in quaternion form, from body into sensor (NED) frame.
void GpsCallback(const sensor_msgs::NavSatFixConstPtr &gps_msg, HilData *hil_data)
Callback for handling GPS messages.
u_int64_t RosTimeToMicroseconds(const ros::Time &rostime)
Convert ros::Time into single value in microseconds.
static constexpr char IMU[]
ros::Subscriber air_speed_sub_
ROS air speed subscriber.
virtual ~HilStateLevelInterface()
Destructor.
HilListeners hil_listeners_
Object with callbacks for receiving data.
Eigen::Vector3f gyro_rad_per_s
Eigen::Vector3i gps_vel_cm_per_s
ros::Subscriber gps_sub_
ROS GPS subscriber.
void ImuCallback(const sensor_msgs::ImuConstPtr &imu_msg, HilData *hil_data)
Callback for handling IMU messages.