Class inertialsim::sensors::Magnetometer¶
ClassList > inertialsim > sensors > Magnetometer
Simulate magnetometer sensors. More...
#include <magnetometer.h>
Inherits the following classes: inertialsim::sensors::Sensor
Public Functions¶
| Type | Name |
|---|---|
| Magnetometer (const MagnetometerModel & model, const MagnetometerSpecification & specification, std::optional< uint64_t > seed=std::nullopt, SimulationMode mode=SimulationMode::BATCH, std::optional< double > max_duration=std::nullopt) Construct a Magnetometer from a model and specification. |
|
| MagnetometerData | Simulate (const geometry::Vector & magnetic_field, const std::optional< Scalar1D > & temperature=std::nullopt) Simulate magnetometer measurements from magnetic field Vector. |
| MagnetometerData | Simulate (const geometry::Vector & magnetic_field, const geometry::Rotation & attitude, const std::optional< Scalar1D > & temperature=std::nullopt) Simulate magnetometer measurements from magnetic field and attitude. |
| MagnetometerData | Simulate (const geodesy::GlobalPose & global_pose, const geodesy::MagneticDatum & datum, std::optional< double > date=std::nullopt, const std::optional< Scalar1D > & temperature=std::nullopt) Simulate magnetometer measurements from global pose. |
| ~Magnetometer () override |
Public Functions inherited from inertialsim::sensors::Sensor¶
See inertialsim::sensors::Sensor
| Type | Name |
|---|---|
| Sensor (const SensorModel & model, const SensorSpecification & specification, std::optional< uint64_t > seed=std::nullopt, SimulationMode mode=SimulationMode::BATCH, std::optional< double > max_duration=std::nullopt) Construct a Sensor . |
|
| virtual const SensorModel & | model () const Get the sensor model. |
| const std::mt19937_64 & | rng () const Get the rng generator. |
| virtual const SensorSpecification & | specification () const Get the sensor specification. |
| virtual SensorState & | state () Get the sensor state. |
| virtual const SensorState & | state () const |
| virtual | ~Sensor () = default |
Public Static Functions inherited from inertialsim::sensors::Sensor¶
See inertialsim::sensors::Sensor
| Type | Name |
|---|---|
| Array | ApplyQuantization (const Array & signal, const SpecificationArray & quantization) Apply quantization to a signal. |
Protected Attributes inherited from inertialsim::sensors::Sensor¶
See inertialsim::sensors::Sensor
| Type | Name |
|---|---|
| bool | initialized_ |
| std::optional< double > | max_duration_ |
| SimulationMode | mode_ |
| const SensorModel & | model_ |
| int | noise_index_ |
| std::mt19937_64 | rng_ |
| double | sample_rate_ |
| const SensorSpecification & | specification_ |
| SensorState | state_ |
| std::optional< Array > | wgn_buffer_ |
Protected Functions inherited from inertialsim::sensors::Sensor¶
See inertialsim::sensors::Sensor
| Type | Name |
|---|---|
| virtual void | Initialize (int samples, double sample_rate) Initialize the sensor for simulation. |
| void | SetBias () Set bias parameters. |
| void | SetInputLimits () Set input limit parameters. |
| void | SetMisalignment () Set misalignment parameters. |
| virtual void | SetNoise (Eigen::Index samples, double sample_rate) Set noise parameters. |
| virtual void | SetQuantization () Set quantization parameters. |
| void | SetScaleFactor () Set scale factor parameters. |
| void | SimulateBias (Array & signal, const std::optional< Scalar1D > & temperature=std::nullopt) Simulate bias. |
| Measurement | SimulateFromRate (const geometry::Vector & signal, const std::optional< Scalar1D > & temperature=std::nullopt) Simulate sensor errors on a rate signal. |
| void | SimulateInputLimits (Array & signal) Simulate input limits. |
| Array | SimulateMisalignment (const Vector3D & signal) Simulate axis misalignment. |
| virtual void | SimulateNoise (Array & signal) Simulate noise. |
| void | SimulateScaleFactor (Array & signal) Simulate scale factor. |
| geometry::Vector | ValidateInput (const geometry::Vector & signal) Validate and potentially interpolate input signal. |
Detailed Description¶
A magnetometer is a sensor that measures the component of the ambient magnetic field along its input axis(es). In Earth-based applications, the primary source of the magnetic field is Earth's core.
Public Functions Documentation¶
function Magnetometer¶
Construct a Magnetometer from a model and specification.
inertialsim::sensors::Magnetometer::Magnetometer (
const MagnetometerModel & model,
const MagnetometerSpecification & specification,
std::optional< uint64_t > seed=std::nullopt,
SimulationMode mode=SimulationMode::BATCH,
std::optional< double > max_duration=std::nullopt
)
Parameters:
modelMagnetometer model options.specificationMagnetometer specification.seedRandom number generator seed. If not provided (std::nullopt), the RNG is seeded with fresh randomness from std::random_device.modeSimulation mode (batch or real-time).max_durationMaximum simulation duration in seconds (required for real-time mode).
function Simulate [⅓]¶
Simulate magnetometer measurements from magnetic field Vector.
MagnetometerData inertialsim::sensors::Magnetometer::Simulate (
const geometry::Vector & magnetic_field,
const std::optional< Scalar1D > & temperature=std::nullopt
)
The input Vector must be the magnetic field in magnetometer (sensor body) coordinates.
Parameters:
magnetic_fieldMagnetic field Vector with time in sensor frame.temperatureOptional temperature array.
Returns:
MagnetometerData with simulated measurements.
function Simulate [⅔]¶
Simulate magnetometer measurements from magnetic field and attitude.
MagnetometerData inertialsim::sensors::Magnetometer::Simulate (
const geometry::Vector & magnetic_field,
const geometry::Rotation & attitude,
const std::optional< Scalar1D > & temperature=std::nullopt
)
The magnetic field is expected in a world frame. The attitude rotation transforms from world frame to sensor body frame.
Parameters:
magnetic_fieldMagnetic field Vector in world frame.attitudeRotation from world frame to sensor body frame.temperatureOptional temperature array.
Returns:
MagnetometerData with simulated measurements.
Exception:
std::invalid_argumentif attitude has no time.
function Simulate [3/3]¶
Simulate magnetometer measurements from global pose.
MagnetometerData inertialsim::sensors::Magnetometer::Simulate (
const geodesy::GlobalPose & global_pose,
const geodesy::MagneticDatum & datum,
std::optional< double > date=std::nullopt,
const std::optional< Scalar1D > & temperature=std::nullopt
)
Magnetic field is computed from the global pose position using the World Magnetic Model. The pose must use Earth-referenced coordinates (GEODETIC, ECEF, or TOPOCENTRIC), not LOCAL or INERTIAL frames.
Parameters:
global_poseGlobalPose with attitude, position, and time.datumMagnetic datum for the World Magnetic Model.dateDate as decimal year (e.g., 2025.5). If not provided, uses the default date for the datum.temperatureOptional temperature array.
Returns:
MagnetometerData with simulated measurements.
Exception:
std::invalid_argumentif global_pose has no time.std::invalid_argumentif navigation frame is LOCAL or INERTIAL.
function ~Magnetometer¶
The documentation for this class was generated from the following file cpp/include/inertialsim/sensors/magnetometer.h