PX4 ROS 2 Interface Library
Library to interface with PX4 from a companion computer using ROS 2
Frame Conversion
template<typename Type >
Eigen::Quaternion< Type > px4_ros2::attitudeNedToEnu (const Eigen::Quaternion< Type > &q_ned)
 Converts attitude from NED to ENU frame. Performs reference frame change and quaternion rotation s.t. the identity quaternion points along the x-axis within its reference frame. More...
 
template<typename Type >
Eigen::Quaternion< Type > px4_ros2::attitudeEnuToNed (const Eigen::Quaternion< Type > &q_enu)
 Converts attitude from ENU to NED frame. Performs reference frame change and quaternion rotation s.t. the identity quaternion points along the x-axis within its reference frame. More...
 
template<typename Type >
Eigen::Matrix< Type, 3, 1 > px4_ros2::yawBodyToWorld (Type yaw, const Eigen::Matrix< Type, 3, 1 > &point_body)
 Transforms a point from body frame to world frame given the yaw of the body's attitude. More...
 
template<typename T >
static T px4_ros2::yawNedToEnu (const T yaw_ned_rad)
 Converts yaw from NED to ENU frame. More...
 
template<typename T >
static T px4_ros2::yawEnuToNed (const T yaw_enu_rad)
 Converts yaw from ENU to NED frame. More...
 
template<typename T >
static T px4_ros2::yawRateNedToEnu (const T yaw_rate_ned)
 Converts yaw rate from NED to ENU frame. More...
 
template<typename T >
static T px4_ros2::yawRateEnuToNed (const T yaw_rate_enu)
 Converts yaw rate from ENU to NED frame. More...
 
template<typename T >
static Eigen::Matrix< T, 3, 1 > px4_ros2::positionNedToEnu (const Eigen::Matrix< T, 3, 1 > &ned)
 Converts coordinates from NED to ENU frame. More...
 
template<typename T >
static Eigen::Matrix< T, 3, 1 > px4_ros2::positionEnuToNed (const Eigen::Matrix< T, 3, 1 > &enu)
 Converts coordinates from ENU to NED frame. More...
 
template<typename T >
static Eigen::Matrix< T, 3, 1 > px4_ros2::frdToFlu (const Eigen::Matrix< T, 3, 1 > &frd)
 Converts coordinates from FRD to FLU frame. More...
 
template<typename T >
static Eigen::Matrix< T, 3, 1 > px4_ros2::fluToFrd (const Eigen::Matrix< T, 3, 1 > &flu)
 Converts coordinates from FLU to FRD frame. More...
 
template<typename T >
static Eigen::Matrix< T, 3, 1 > px4_ros2::varianceNedToEnu (const Eigen::Matrix< T, 3, 1 > &v_ned)
 Converts variance from NED to ENU frame. More...
 
template<typename T >
static Eigen::Matrix< T, 3, 1 > px4_ros2::varianceEnuToNed (const Eigen::Matrix< T, 3, 1 > &v_enu)
 Converts variance from ENU to NED frame. More...
 

Detailed Description

This group contains helper functions to switch between reference frames.

Function Documentation

◆ attitudeEnuToNed()

template<typename Type >
Eigen::Quaternion<Type> px4_ros2::attitudeEnuToNed ( const Eigen::Quaternion< Type > &  q_enu)

Converts attitude from ENU to NED frame. Performs reference frame change and quaternion rotation s.t. the identity quaternion points along the x-axis within its reference frame.

Parameters
q_enuAttitude quaternion in ENU frame.
Returns
Attitude quaternion in NED frame.

◆ attitudeNedToEnu()

template<typename Type >
Eigen::Quaternion<Type> px4_ros2::attitudeNedToEnu ( const Eigen::Quaternion< Type > &  q_ned)

Converts attitude from NED to ENU frame. Performs reference frame change and quaternion rotation s.t. the identity quaternion points along the x-axis within its reference frame.

Parameters
q_nedAttitude quaternion in NED frame.
Returns
Attitude quaternion in ENU frame.

◆ fluToFrd()

template<typename T >
static Eigen::Matrix<T, 3, 1> px4_ros2::fluToFrd ( const Eigen::Matrix< T, 3, 1 > &  flu)
inlinestatic

Converts coordinates from FLU to FRD frame.

Parameters
fluCoordinates in FLU frame.
Returns
Coordinates in FRD frame.

◆ frdToFlu()

template<typename T >
static Eigen::Matrix<T, 3, 1> px4_ros2::frdToFlu ( const Eigen::Matrix< T, 3, 1 > &  frd)
inlinestatic

Converts coordinates from FRD to FLU frame.

Parameters
frdCoordinates in FRD frame.
Returns
Coordinates in FLU frame.

◆ positionEnuToNed()

template<typename T >
static Eigen::Matrix<T, 3, 1> px4_ros2::positionEnuToNed ( const Eigen::Matrix< T, 3, 1 > &  enu)
inlinestatic

Converts coordinates from ENU to NED frame.

Parameters
enuCoordinates in ENU frame.
Returns
Coordinates in NED frame.

◆ positionNedToEnu()

template<typename T >
static Eigen::Matrix<T, 3, 1> px4_ros2::positionNedToEnu ( const Eigen::Matrix< T, 3, 1 > &  ned)
inlinestatic

Converts coordinates from NED to ENU frame.

Parameters
nedCoordinates in NED frame.
Returns
Coordinates in ENU frame.

◆ varianceEnuToNed()

template<typename T >
static Eigen::Matrix<T, 3, 1> px4_ros2::varianceEnuToNed ( const Eigen::Matrix< T, 3, 1 > &  v_enu)
inlinestatic

Converts variance from ENU to NED frame.

Parameters
v_enuVariance vector in ENU frame.
Returns
Variance vector in NED frame.

◆ varianceNedToEnu()

template<typename T >
static Eigen::Matrix<T, 3, 1> px4_ros2::varianceNedToEnu ( const Eigen::Matrix< T, 3, 1 > &  v_ned)
inlinestatic

Converts variance from NED to ENU frame.

Parameters
v_nedVariance vector in NED frame.
Returns
Variance vector in ENU frame.

◆ yawBodyToWorld()

template<typename Type >
Eigen::Matrix<Type, 3, 1> px4_ros2::yawBodyToWorld ( Type  yaw,
const Eigen::Matrix< Type, 3, 1 > &  point_body 
)

Transforms a point from body frame to world frame given the yaw of the body's attitude.

Parameters
yawThe yaw of the body's attitude [rad].
point_bodyThe point coordinates in the body frame.
Returns
The yaw rotated point in the world frame.

◆ yawEnuToNed()

template<typename T >
static T px4_ros2::yawEnuToNed ( const T  yaw_enu_rad)
inlinestatic

Converts yaw from ENU to NED frame.

Parameters
yaw_enu_radYaw angle in ENU frame [rad].
Returns
Yaw angle in NED frame [rad], wrapped to [-pi, pi].

◆ yawNedToEnu()

template<typename T >
static T px4_ros2::yawNedToEnu ( const T  yaw_ned_rad)
inlinestatic

Converts yaw from NED to ENU frame.

Parameters
yaw_ned_radYaw angle in NED frame [rad].
Returns
Yaw angle in ENU frame [rad], wrapped to [-pi, pi].

◆ yawRateEnuToNed()

template<typename T >
static T px4_ros2::yawRateEnuToNed ( const T  yaw_rate_enu)
inlinestatic

Converts yaw rate from ENU to NED frame.

Parameters
yaw_rate_enuYaw rate in ENU frame.
Returns
Yaw rate in NED frame.

◆ yawRateNedToEnu()

template<typename T >
static T px4_ros2::yawRateNedToEnu ( const T  yaw_rate_ned)
inlinestatic

Converts yaw rate from NED to ENU frame.

Parameters
yaw_rate_nedYaw rate in NED frame.
Returns
Yaw rate in ENU frame.