upkie 6.1.0
Open-source wheeled biped robots
Loading...
Searching...
No Matches
upkie::cpp::actuation::pi3hat Namespace Reference

Utility functions used in the pi3hat interface. More...

Typedefs

using Attitude = ::mjbots::pi3hat::Attitude
 Attitude data type from the mjbots library.
 

Functions

Eigen::Quaterniond get_orientation_imu_in_ars (const Attitude &attitude) noexcept
 Get orientation from the IMU frame to the ARS frame. More...
 
Eigen::Vector3d get_angular_velocity (const Attitude &attitude) noexcept
 Get the body angular velocity of the IMU frame. More...
 
Eigen::Vector3d get_linear_acceleration (const Attitude &attitude) noexcept
 Get the body linear acceleration of the IMU. More...
 
Eigen::Vector3d get_rate_dps (const Attitude &attitude) noexcept
 Get the body angular velocity of the IMU frame in [deg] / [s]. More...
 
Eigen::Vector3d get_bias_dps (const Attitude &attitude) noexcept
 Get the gyroscope bias in [deg] / [s]. More...
 
Eigen::Vector3d get_raw_angular_velocity (const Eigen::Vector3d &rate_dps, const Eigen::Vector3d &bias_dps) noexcept
 Get raw angular velocity measurement from the gyroscope. More...
 
Eigen::Vector3d get_raw_linear_acceleration (const Eigen::Quaterniond &orientation_imu_in_ars, const Eigen::Vector3d &accel_mps2) noexcept
 Recompute raw linear acceleration from UKF observations. More...
 

Variables

constexpr double kMjbotsGravity = 9.81
 Standard gravity constant used in the mjbots pi3hat firmware. More...
 

Detailed Description

Utility functions used in the pi3hat interface.

Function Documentation

◆ get_angular_velocity()

Eigen::Vector3d upkie::cpp::actuation::pi3hat::get_angular_velocity ( const Attitude attitude)
inlinenoexcept

Get the body angular velocity of the IMU frame.

Parameters
[in]attitudeAttitude object from the pi3hat library.
Returns
Body angular velocity of the IMU frame in [rad] / [s].
Note
This is the angular velocity \( {}_I \omega_{WI} \) from the IMU frame \( I \) to the world frame \( W \), expressed in the IMU frame.

◆ get_bias_dps()

Eigen::Vector3d upkie::cpp::actuation::pi3hat::get_bias_dps ( const Attitude attitude)
inlinenoexcept

Get the gyroscope bias in [deg] / [s].

Parameters
[in]attitudeAttitude object from the pi3hat library.
Returns
Gyroscope bias of the IMU in [deg] / [s].

◆ get_linear_acceleration()

Eigen::Vector3d upkie::cpp::actuation::pi3hat::get_linear_acceleration ( const Attitude attitude)
inlinenoexcept

Get the body linear acceleration of the IMU.

Parameters
[in]attitudeAttitude object from the pi3hat library.
Returns
Body linear acceleration of the IMU in [m] / [s]².
Note
This is the linear acceleration \( {}_I a_{WI} \) of the IMU frame \( I \) with respect to the world frame, expressed in the IMU frame.

◆ get_orientation_imu_in_ars()

Eigen::Quaterniond upkie::cpp::actuation::pi3hat::get_orientation_imu_in_ars ( const Attitude attitude)
inlinenoexcept

Get orientation from the IMU frame to the ARS frame.

Parameters
[in]attitudeAttitude object from the pi3hat library.
Returns
Orientation from the IMU frame to the ARS frame.

This orientation is computed by the Unscented Kalman filter (UKF) in pi3hat/fw/attitude_reference.h.

◆ get_rate_dps()

Eigen::Vector3d upkie::cpp::actuation::pi3hat::get_rate_dps ( const Attitude attitude)
inlinenoexcept

Get the body angular velocity of the IMU frame in [deg] / [s].

Parameters
[in]attitudeAttitude object from the pi3hat library.
Returns
Body angular velocity of the IMU frame in [deg] / [s].

◆ get_raw_angular_velocity()

Eigen::Vector3d upkie::cpp::actuation::pi3hat::get_raw_angular_velocity ( const Eigen::Vector3d &  rate_dps,
const Eigen::Vector3d &  bias_dps 
)
inlinenoexcept

Get raw angular velocity measurement from the gyroscope.

Parameters
[in]rate_dpsAngular velocity in [deg] / [s] from the pi3hat.
[in]bias_dpsGyroscope bias in [deg] / [s] from the pi3hat.
Returns
Raw angular velocity of the IMU in [rad] / [s].
Note
We reverse filter outputs for now as (1) it avoids an extra call to ReadSpi, and more generally customizing the Pi3Hat::Impl from mjbots, and (2) the pi3hat filter's code has been stable for the last four years.

◆ get_raw_linear_acceleration()

Eigen::Vector3d upkie::cpp::actuation::pi3hat::get_raw_linear_acceleration ( const Eigen::Quaterniond &  orientation_imu_in_ars,
const Eigen::Vector3d &  accel_mps2 
)
inlinenoexcept

Recompute raw linear acceleration from UKF observations.

Parameters
[in]orientation_imu_in_arsRotation from the IMU to the ARS.
[in]accel_mps2UKF output linear acceleration, in [m] / [s]².
Returns
Raw linear acceleration in [m] / [s]².
Note
We reverse filter outputs for now as (1) it avoids an extra call to ReadSpi, and more generally customizing the Pi3Hat::Impl from mjbots, and (2) the pi3hat filter's code has been stable for the last four years.

Variable Documentation

◆ kMjbotsGravity

constexpr double upkie::cpp::actuation::pi3hat::kMjbotsGravity = 9.81
constexpr

Standard gravity constant used in the mjbots pi3hat firmware.

We should use the same value to recover raw measurements from filter outputs.