Function log_data

Source
pub fn log_data(
    rec: &RecordingStream,
    quad: &Quadrotor,
    desired_position: &Vector3<f32>,
    desired_velocity: &Vector3<f32>,
    measured_accel: &Vector3<f32>,
    measured_gyro: &Vector3<f32>,
) -> Result<(), SimulationError>
Expand description

Logs simulation data to the rerun recording stream

§Arguments

  • rec - The rerun::RecordingStream instance
  • quad - The Quadrotor instance
  • desired_position - The desired position vector
  • measured_accel - The measured acceleration vector
  • measured_gyro - The measured angular velocity vector

§Errors

  • If the data cannot be logged to the recording stream

§Example

use peng_quad::{Quadrotor, log_data};
use nalgebra::Vector3;
let rec = rerun::RecordingStreamBuilder::new("peng").spawn().unwrap();
let (time_step, mass, gravity, drag_coefficient) = (0.01, 1.3, 9.81, 0.01);
let inertia_matrix = [0.0347563, 0.0, 0.0, 0.0, 0.0458929, 0.0, 0.0, 0.0, 0.0977];
let quad = Quadrotor::new(time_step, mass, gravity, drag_coefficient, inertia_matrix).unwrap();
let desired_position = Vector3::new(0.0, 0.0, 0.0);
let desired_velocity = Vector3::new(0.0, 0.0, 0.0);
let measured_accel = Vector3::new(0.0, 0.0, 0.0);
let measured_gyro = Vector3::new(0.0, 0.0, 0.0);
log_data(&rec, &quad, &desired_position, &desired_velocity, &measured_accel, &measured_gyro).unwrap();