2022-Robot
Robot code for 2022 FRC Season by Argos, FRC team #1756
Loading...
Searching...
No Matches
FileSystemHomingStorage Class Reference

Accesses swerve module home positions in a file saved on the RoboRIO. More...

#include <file_system_homing_storage.h>

Inheritance diagram for FileSystemHomingStorage:
argos_lib::swerve::SwerveHomeStorageInterface

Public Member Functions

 FileSystemHomingStorage (const fs::path &swerveHomesPath)
 Construct a new File System Homing Storage object. More...
 
bool Save (const argos_lib::swerve::SwerveModulePositions &homePosition) override
 Save positions as new homes. More...
 
std::optional< argos_lib::swerve::SwerveModulePositionsLoad () override
 Load absolute positions that represent 0 degree module orientations. More...
 
virtual bool Save (const SwerveModulePositions &homePosition)=0
 Save home position to persistent storage. More...
 
virtual std::optional< SwerveModulePositionsLoad ()=0
 Load home position from persistent storage. More...
 

Private Member Functions

fs::path GetFilePath ()
 Get the path of the file to load from and save to. More...
 

Private Attributes

const fs::path m_swerveHomesPath
 Path of persistent storage file relative to home directory. More...
 

Detailed Description

Accesses swerve module home positions in a file saved on the RoboRIO.

Constructor & Destructor Documentation

◆ FileSystemHomingStorage()

FileSystemHomingStorage::FileSystemHomingStorage ( const fs::path &  swerveHomesPath)
explicit

Construct a new File System Homing Storage object.

Parameters
swerveHomesPathFile path relative to home directory to save into and load from

Member Function Documentation

◆ GetFilePath()

fs::path FileSystemHomingStorage::GetFilePath ( )
private

Get the path of the file to load from and save to.

Returns
fs::path Absolute path of persistent storage file

◆ Load()

std::optional< argos_lib::swerve::SwerveModulePositions > FileSystemHomingStorage::Load ( )
overridevirtual

Load absolute positions that represent 0 degree module orientations.

Returns
Saved module positions if they exist, otherwise std::nullopt to indicate failure

Implements argos_lib::swerve::SwerveHomeStorageInterface.

◆ Save()

bool FileSystemHomingStorage::Save ( const argos_lib::swerve::SwerveModulePositions homePosition)
overridevirtual

Save positions as new homes.

Parameters
homePositionPositions that represent 0 degree module orientations
Returns
true if save successful, false otherwise

Implements argos_lib::swerve::SwerveHomeStorageInterface.

Member Data Documentation

◆ m_swerveHomesPath

const fs::path FileSystemHomingStorage::m_swerveHomesPath
private

Path of persistent storage file relative to home directory.


The documentation for this class was generated from the following files: