15 #include <unordered_map> 25 tf2_listener(tf2_buffer, true),
35 gps_satellites_visible(0),
38 fcu_caps_known(false),
45 egm96_5 = std::make_shared<GeographicLib::Geoid>(
"egm96-5",
"",
true,
true);
47 catch (
const std::exception &
e) {
50 " | Run install_geographiclib_dataset.sh script in order to install Geoid Model dataset!");
55 std::vector<geometry_msgs::TransformStamped> transform_vector;
111 bool process_cb_queue =
false;
115 process_cb_queue =
true;
120 process_cb_queue =
true;
125 if (process_cb_queue) {
128 cb(static_cast<MAV_CAP>(caps));
172 geometry_msgs::Quaternion q;
173 q.w = 1.0; q.x = q.y = q.z = 0.0;
185 geometry_msgs::Quaternion q;
186 q.w = 1.0; q.x = q.y = q.z = 0.0;
198 geometry_msgs::Vector3 v;
199 v.x = v.y = v.z = 0.0;
211 geometry_msgs::Vector3 v;
212 v.x = v.y = v.z = 0.0;
221 float eph,
float epv,
222 int fix_type,
int satellites_visible)
254 void UAS::add_static_transform(
const std::string &frame_id,
const std::string &child_id,
const Eigen::Affine3d &tr, std::vector<geometry_msgs::TransformStamped>& vector)
256 geometry_msgs::TransformStamped static_transform;
259 static_transform.header.frame_id = frame_id;
260 static_transform.child_frame_id = child_id;
263 vector.emplace_back(static_transform);
269 geometry_msgs::TransformStamped static_transformStamped;
272 static_transformStamped.header.frame_id = frame_id;
273 static_transformStamped.child_frame_id = child_id;
std::atomic< uint8_t > autopilot
mavlink::minimal::MAV_TYPE MAV_TYPE
sensor_msgs::NavSatFix::Ptr gps_fix
void add_capabilities_change_handler(CapabilitiesCb cb)
Adds a function to the capabilities callback queue.
void publish_static_transform(const std::string &frame_id, const std::string &child_id, const Eigen::Affine3d &tr)
Publishes static transform.
geometry_msgs::Quaternion get_attitude_orientation_enu()
Get Attitude orientation quaternion.
MAV_AUTOPILOT get_autopilot()
Returns autopilot type.
void update_connection_status(bool conn_)
void transformEigenToMsg(const Eigen::Affine3d &e, geometry_msgs::Transform &m)
sensor_msgs::Imu::Ptr imu_enu_data
tf2_ros::StaticTransformBroadcaster tf2_static_broadcaster
std::function< void(bool)> ConnectionCb
geometry_msgs::Quaternion get_attitude_orientation_ned()
Get Attitude orientation quaternion.
void update_capabilities(bool known, uint64_t caps=0)
Update the capabilities if they've changed every VERSION/timeout.
void update_attitude_imu_enu(sensor_msgs::Imu::Ptr &imu)
Store IMU data [ENU].
std::atomic< uint8_t > type
#define ROS_FATAL_STREAM(args)
std::shared_ptr< GeographicLib::Geoid > egm96_5
Geoid dataset used to convert between AMSL and WGS-84.
void add_connection_change_handler(ConnectionCb cb)
Add connection change handler callback.
geometry_msgs::Vector3 get_attitude_angular_velocity_ned()
Get angular velocity from IMU data.
std::lock_guard< std::recursive_mutex > lock_guard
std::atomic< bool > connected
static uint64_t get_default_caps(UAS::MAV_AUTOPILOT ap_type)
std::atomic< bool > fcu_caps_known
std::vector< CapabilitiesCb > capabilities_cb_vec
std::function< void(MAV_CAP)> CapabilitiesCb
sensor_msgs::Imu::Ptr get_attitude_imu_ned()
Get IMU data [NED].
std::recursive_mutex mutex
void update_heartbeat(uint8_t type_, uint8_t autopilot_, uint8_t base_mode_)
Eigen::Quaterniond quaternion_from_rpy(const Eigen::Vector3d &rpy)
Convert euler angles to quaternion.
sensor_msgs::NavSatFix::Ptr get_gps_fix()
Retunrs last GPS RAW message.
mavlink::minimal::MAV_AUTOPILOT MAV_AUTOPILOT
uint64_t get_capabilities()
PX4 custom mode constantsPX4 custom flight modes.
std::atomic< uint8_t > base_mode
ROSCPP_DECL void shutdown()
sensor_msgs::Imu::Ptr imu_ned_data
void update_attitude_imu_ned(sensor_msgs::Imu::Ptr &imu)
Store IMU data [NED].
sensor_msgs::Imu::Ptr get_attitude_imu_enu()
Get IMU data [ENU].
void update_gps_fix_epts(sensor_msgs::NavSatFix::Ptr &fix, float eph, float epv, int fix_type, int satellites_visible)
Store GPS RAW data.
std::atomic< uint64_t > fcu_capabilities
geometry_msgs::Vector3 get_attitude_angular_velocity_enu()
Get angular velocity from IMU data.
void add_static_transform(const std::string &frame_id, const std::string &child_id, const Eigen::Affine3d &tr, std::vector< geometry_msgs::TransformStamped > &vector)
Add static transform. To publish all static transforms at once, we stack them in a std::vector...
int gps_satellites_visible
std::vector< ConnectionCb > connection_cb_vec
constexpr std::underlying_type< _T >::type enum_value(_T e)
void get_gps_epts(float &eph, float &epv, int &fix_type, int &satellites_visible)
Returns EPH, EPV, Fix type and satellites visible.
std::shared_ptr< MAVConnInterface > Ptr