32 #include <GeographicLib/Geoid.hpp> 34 #include <sensor_msgs/Imu.h> 35 #include <sensor_msgs/NavSatFix.h> 41 #define UAS_FCU(uasobjptr) \ 42 ((uasobjptr)->fcu_link) 47 #define UAS_DIAG(uasobjptr) \ 48 ((uasobjptr)->diag_updater) 69 using lock_guard = std::lock_guard<std::recursive_mutex>;
104 void update_heartbeat(uint8_t type_, uint8_t autopilot_, uint8_t base_mode_);
120 std::underlying_type<MAV_TYPE>::type type_ =
type;
121 return static_cast<MAV_TYPE>(type_);
128 std::underlying_type<MAV_AUTOPILOT>::type autopilot_ =
autopilot;
166 inline void set_tgt(uint8_t sys, uint8_t comp) {
223 float eph,
float epv,
224 int fix_type,
int satellites_visible);
227 void get_gps_epts(
float &eph,
float &epv,
int &fix_type,
int &satellites_visible);
239 std::shared_ptr<GeographicLib::Geoid>
egm96_5;
249 return GeographicLib::Geoid::GEOIDTOELLIPSOID * (*egm96_5)(lla->latitude, lla->longitude);
262 return GeographicLib::Geoid::ELLIPSOIDTOGEOID * (*egm96_5)(lla->latitude, lla->longitude);
326 std_msgs::Header out;
327 out.frame_id = frame_id;
337 template<
typename _T>
395 bool cmode_from_str(std::string cmode_str, uint32_t &custom_mode);
bool is_connected()
Return connection status.
std::atomic< uint8_t > autopilot
bool cmode_from_str(std::string cmode_str, uint32_t &custom_mode)
Lookup custom mode for given string.
mavconn::MAVConnInterface::Ptr fcu_link
MAVLink FCU device conection.
std_msgs::Header synchronized_header(const std::string &frame_id, const T time_stamp)
Create message header from time_boot_ms or time_usec stamps and frame_id.
sensor_msgs::NavSatFix::Ptr gps_fix
double ellipsoid_to_geoid_height(T lla)
Conversion from height above ellipsoid (WGS-84) to height above geoid (AMSL)
void publish_static_transform(const std::string &frame_id, const std::string &child_id, const Eigen::Affine3d &tr)
Publishes static transform.
tf2_ros::TransformListener tf2_listener
geometry_msgs::Quaternion get_attitude_orientation_enu()
Get Attitude orientation quaternion.
uint64_t get_time_offset(void)
MAV_AUTOPILOT get_autopilot()
Returns autopilot type.
void update_connection_status(bool conn_)
void set_time_offset(uint64_t offset_ns)
diagnostic_updater::Updater diag_updater
Mavros diagnostic updater.
sensor_msgs::Imu::Ptr imu_enu_data
void msg_set_target(_T &msg)
mavlink::common::MAV_TYPE MAV_TYPE
mavlink::common::MAV_AUTOPILOT MAV_AUTOPILOT
tf2_ros::StaticTransformBroadcaster tf2_static_broadcaster
bool get_hil_state()
Returns HIL status.
std::function< void(bool)> ConnectionCb
tf2_ros::TransformBroadcaster tf2_broadcaster
geometry_msgs::Quaternion get_attitude_orientation_ned()
Get Attitude orientation quaternion.
void update_capabilities(bool known, uint64_t caps=0)
void update_attitude_imu_enu(sensor_msgs::Imu::Ptr &imu)
Store IMU data [ENU].
uint8_t get_tgt_system()
Return communication target system.
std::atomic< uint8_t > type
std::string str_mode_v10(uint8_t base_mode, uint32_t custom_mode)
Represent FCU mode as string.
tf2_ros::Buffer tf2_buffer
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.
bool is_ardupilotmega()
Check that FCU is APM.
ros::Time synchronise_stamp(uint32_t time_boot_ms)
Compute FCU message time from time_boot_ms or time_usec field.
void set_timesync_mode(timesync_mode mode)
void set_tgt(uint8_t sys, uint8_t comp)
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
std::atomic< bool > fcu_caps_known
bool get_armed()
Returns arming status.
MAV_TYPE get_type()
Returns vehicle type.
sensor_msgs::Imu::Ptr get_attitude_imu_ned()
Get IMU data [NED].
bool is_my_target(uint8_t sysid, uint8_t compid)
Check that sys/comp id's is my target.
std::recursive_mutex mutex
void update_heartbeat(uint8_t type_, uint8_t autopilot_, uint8_t base_mode_)
std::unique_lock< std::recursive_mutex > unique_lock
sensor_msgs::NavSatFix::Ptr get_gps_fix()
Retunrs last GPS RAW message.
timesync_mode get_timesync_mode(void)
uint64_t get_capabilities()
mavlink::common::MAV_MODE_FLAG MAV_MODE_FLAG
std::atomic< uint8_t > base_mode
bool is_my_target(uint8_t sysid)
Check that system id is my target.
sensor_msgs::Imu::Ptr imu_ned_data
void update_attitude_imu_ned(sensor_msgs::Imu::Ptr &imu)
Store IMU data [NED].
std::atomic< uint64_t > time_offset
sensor_msgs::Imu::Ptr get_attitude_imu_enu()
Get IMU data [ENU].
Frame transformation utilities.
bool is_px4()
Check that FCU is PX4.
mavlink::common::MAV_STATE MAV_STATE
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
uint8_t get_tgt_component()
Return communication target component.
geometry_msgs::Vector3 get_attitude_angular_velocity_enu()
Get angular velocity from IMU data.
double geoid_to_ellipsoid_height(T lla)
Conversion from height above geoid (AMSL) to height above ellipsoid (WGS-84)
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