pub struct SpeedTrace {
pub time: Vec<Time>,
pub speed: Vec<Velocity>,
pub engine_on: Option<Vec<bool>>,
}Fields§
§time: Vec<Time>simulation time
speed: Vec<Velocity>simulation speed
engine_on: Option<Vec<bool>>Whether engine is on
Implementations§
Source§impl SpeedTrace
impl SpeedTrace
pub fn new( time_s: Vec<f64>, speed_mps: Vec<f64>, engine_on: Option<Vec<bool>>, ) -> Self
pub fn trim( &mut self, start_idx: Option<usize>, end_idx: Option<usize>, ) -> Result<()>
pub fn dt(&self, i: usize) -> Time
pub fn mean(&self, i: usize) -> Velocity
pub fn acc(&self, i: usize) -> Acceleration
pub fn len(&self) -> usize
pub fn push(&mut self, speed_element: SpeedTraceElement) -> Result<()>
pub fn empty() -> Self
Sourcepub fn from_csv_file<P: AsRef<Path>>(filepath: P) -> Result<Self>
pub fn from_csv_file<P: AsRef<Path>>(filepath: P) -> Result<Self>
Load speed trace from csv file
Trait Implementations§
Source§impl Clone for SpeedTrace
impl Clone for SpeedTrace
Source§fn clone(&self) -> SpeedTrace
fn clone(&self) -> SpeedTrace
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SpeedTrace
impl Debug for SpeedTrace
Source§impl Default for SpeedTrace
impl Default for SpeedTrace
Source§impl<'de> Deserialize<'de> for SpeedTrace
impl<'de> Deserialize<'de> for SpeedTrace
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Init for SpeedTrace
impl Init for SpeedTrace
Source§impl PartialEq for SpeedTrace
impl PartialEq for SpeedTrace
Source§impl SerdeAPI for SpeedTrace
impl SerdeAPI for SpeedTrace
const ACCEPTED_BYTE_FORMATS: &'static [&'static str] = _
const ACCEPTED_STR_FORMATS: &'static [&'static str] = _
const RESOURCES_SUBDIR: &'static str = ""
const RESOURCES_DIR: &'static Dir<'_> = _
Source§fn from_resource<P: AsRef<Path>>(
filepath: P,
skip_init: bool,
) -> Result<Self, Error>
fn from_resource<P: AsRef<Path>>( filepath: P, skip_init: bool, ) -> Result<Self, Error>
Read (deserialize) an object from a resource file packaged with the
altrios-core crate Read moreSource§fn list_resources() -> Result<Vec<PathBuf>, Error>
fn list_resources() -> Result<Vec<PathBuf>, Error>
List the available resources in the resources directory Read more
Source§fn to_file<P: AsRef<Path>>(&self, filepath: P) -> Result<()>
fn to_file<P: AsRef<Path>>(&self, filepath: P) -> Result<()>
Write (serialize) an object to a file.
Supported file extensions are listed in
ACCEPTED_BYTE_FORMATS.
Creates a new file if it does not already exist, otherwise truncates the existing file. Read moreSource§fn from_file<P: AsRef<Path>>(
filepath: P,
skip_init: bool,
) -> Result<Self, Error>
fn from_file<P: AsRef<Path>>( filepath: P, skip_init: bool, ) -> Result<Self, Error>
Read (deserialize) an object from a file.
Supported file extensions are listed in
ACCEPTED_BYTE_FORMATS. Read moreSource§fn to_writer<W: Write>(&self, wtr: W, format: &str) -> Result<()>
fn to_writer<W: Write>(&self, wtr: W, format: &str) -> Result<()>
Write (serialize) an object into anything that implements
std::io::Write Read moreSource§fn to_str(&self, format: &str) -> Result<String>
fn to_str(&self, format: &str) -> Result<String>
Write (serialize) an object into a string Read more
Source§fn from_str<S: AsRef<str>>(
contents: S,
format: &str,
skip_init: bool,
) -> Result<Self>
fn from_str<S: AsRef<str>>( contents: S, format: &str, skip_init: bool, ) -> Result<Self>
Read (deserialize) an object from a string Read more
Source§fn from_reader<R: Read>(
rdr: &mut R,
format: &str,
skip_init: bool,
) -> Result<Self, Error>
fn from_reader<R: Read>( rdr: &mut R, format: &str, skip_init: bool, ) -> Result<Self, Error>
Deserialize an object from anything that implements
std::io::Read Read moreSource§fn from_json<S: AsRef<str>>(json_str: S, skip_init: bool) -> Result<Self>
fn from_json<S: AsRef<str>>(json_str: S, skip_init: bool) -> Result<Self>
Read (deserialize) an object from a JSON string Read more
Source§fn from_msg_pack(msg_pack: &[u8], skip_init: bool) -> Result<Self>
fn from_msg_pack(msg_pack: &[u8], skip_init: bool) -> Result<Self>
Read (deserialize) an object from a message pack Read more
Source§impl Serialize for SpeedTrace
impl Serialize for SpeedTrace
impl StructuralPartialEq for SpeedTrace
Auto Trait Implementations§
impl Freeze for SpeedTrace
impl RefUnwindSafe for SpeedTrace
impl Send for SpeedTrace
impl Sync for SpeedTrace
impl Unpin for SpeedTrace
impl UnwindSafe for SpeedTrace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> EqDefault for T
impl<T> EqDefault for T
Source§fn eq_default(&self) -> bool
fn eq_default(&self) -> bool
Checks if an instance of
Self is equal to Self::defaultSource§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more