Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ opt-level = 3 # Enable a large amount of optimization in the dev profile for dep
codegen-units = 1 # Compile the entire crate as one unit.
lto = "thin" # Do a second optimization pass over the entire program, including dependencies.
[dependencies]
rand = "0.9.1"
rand = "0.10.0"
nalgebra = "0.34.0"
rand_distr = "0.5.1"
rand_chacha = "0.9.0"
rand_distr = "0.6.0"
rand_chacha = "0.10.0"
rerun = "0.29"
thiserror = "2.0.12"
serde = { version = "1.0.219", features = ["derive"] }
Expand Down
34 changes: 14 additions & 20 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
//! let inertia_matrix = [0.0347563, 0.0, 0.0, 0.0, 0.0458929, 0.0, 0.0, 0.0, 0.0977];
//! let quadrotor = Quadrotor::new(time_step, mass, gravity, drag_coefficient, inertia_matrix);
//! ```
use rand::SeedableRng;
use rand::{RngExt, SeedableRng};
use rayon::prelude::*;
pub mod config;
use nalgebra::{
Expand Down Expand Up @@ -437,7 +437,7 @@ impl Imu {
gyro_noise: Normal::new(0.0, gyro_noise_std)?,
accel_bias_drift: Normal::new(0.0, accel_bias_std)?,
gyro_bias_drift: Normal::new(0.0, gyro_bias_std)?,
rng: ChaCha8Rng::from_os_rng(),
rng: ChaCha8Rng::from_rng(&mut rand::rng()),
})
}
/// Updates the IMU biases over time
Expand Down Expand Up @@ -2712,7 +2712,7 @@ impl Obstacle {
/// obstacles: vec![Obstacle::new(Vector3::new(0.0, 0.0, 0.0), Vector3::new(0.0, 0.0, 0.0), 1.0)],
/// obstacles_velocity_bounds: [0.0, 0.0, 0.0],
/// obstacles_radius_bounds: [0.0, 0.0],
/// rng: ChaCha8Rng::from_os_rng(),
/// rng: ChaCha8Rng::from_rng(&mut rand::rng()),
/// };
/// ```
pub struct Maze {
Expand Down Expand Up @@ -2756,7 +2756,7 @@ impl Maze {
obstacles: Vec::new(),
obstacles_velocity_bounds,
obstacles_radius_bounds,
rng: ChaCha8Rng::from_os_rng(),
rng: ChaCha8Rng::from_rng(&mut rand::rng()),
};
maze.generate_obstacles(num_obstacles);
maze
Expand All @@ -2774,27 +2774,21 @@ impl Maze {
self.obstacles = (0..num_obstacles)
.map(|_| {
let position = Vector3::new(
rand::Rng::random_range(
&mut self.rng,
self.lower_bounds[0]..self.upper_bounds[0],
),
rand::Rng::random_range(
&mut self.rng,
self.lower_bounds[1]..self.upper_bounds[1],
),
rand::Rng::random_range(
&mut self.rng,
self.lower_bounds[2]..self.upper_bounds[2],
),
self.rng
.random_range(self.lower_bounds[0]..self.upper_bounds[0]),
self.rng
.random_range(self.lower_bounds[1]..self.upper_bounds[1]),
self.rng
.random_range(self.lower_bounds[2]..self.upper_bounds[2]),
);
let v_bounds = self.obstacles_velocity_bounds;
let r_bounds = self.obstacles_radius_bounds;
let velocity = Vector3::new(
rand::Rng::random_range(&mut self.rng, -v_bounds[0]..v_bounds[0]),
rand::Rng::random_range(&mut self.rng, -v_bounds[1]..v_bounds[1]),
rand::Rng::random_range(&mut self.rng, -v_bounds[2]..v_bounds[2]),
self.rng.random_range(-v_bounds[0]..v_bounds[0]),
self.rng.random_range(-v_bounds[1]..v_bounds[1]),
self.rng.random_range(-v_bounds[2]..v_bounds[2]),
);
let radius = rand::Rng::random_range(&mut self.rng, r_bounds[0]..r_bounds[1]);
let radius = self.rng.random_range(r_bounds[0]..r_bounds[1]);
Obstacle::new(position, velocity, radius)
})
.collect();
Expand Down
Loading