ThunderLib
Loading...
Searching...
No Matches
thunder::ThunderAutoSendableChooser Class Referencefinal

#include <ThunderAutoSendableChooser.hpp>

Public Member Functions

 ThunderAutoSendableChooser () noexcept
 
 ThunderAutoSendableChooser (std::string_view smartDashboardKey) noexcept
 
 ThunderAutoSendableChooser (const TrajectoryRunnerProperties &runnerProps) noexcept
 
 ThunderAutoSendableChooser (std::string_view smartDashboardKey, const TrajectoryRunnerProperties &runnerProps) noexcept
 
void setTrajectoryRunnerProperties (const TrajectoryRunnerProperties &runnerProps) noexcept
 
void publish (std::string_view smartDashboardKey) noexcept
 
void includeProjectSource (std::shared_ptr< ThunderAutoProject > project, bool addAllAutoModes=false, bool addAllTrajectories=false) noexcept
 
void addAllTrajectoriesFromProject (const std::string &projectName) noexcept
 
void addAllAutoModesFromProject (const std::string &projectName) noexcept
 
bool addTrajectoryFromProject (const std::string &projectName, const std::string &trajectoryName) noexcept
 
bool addAutoModeFromProject (const std::string &projectName, const std::string &autoModeName) noexcept
 
bool addCustomCommand (const std::string &name, frc2::CommandPtr command) noexcept
 
bool addCustomCommand (const std::string &name, std::shared_ptr< frc2::Command > command) noexcept
 
frc2::CommandPtr getSelectedCommand () const noexcept
 
ThunderAutoSendableChooserSelection getSelected () const noexcept
 
driver::ThunderAutoSendableChooser * getHandle () noexcept
 
const driver::ThunderAutoSendableChooser * getHandle () const noexcept
 

Detailed Description

A wrapper around frc::SendableChooser to handle ThunderAuto trajectory, auto mode, and command selections.

This chooser will automatically update its options when the associated project gets updated.

Constructor & Destructor Documentation

◆ ThunderAutoSendableChooser() [1/4]

thunder::ThunderAutoSendableChooser::ThunderAutoSendableChooser ( )
noexcept

Default constructor. The chooser will not be published to SmartDashboard until publish() is called.

◆ ThunderAutoSendableChooser() [2/4]

thunder::ThunderAutoSendableChooser::ThunderAutoSendableChooser ( std::string_view smartDashboardKey)
explicitnoexcept

Constructs an empty chooser and publishes it to SmartDashboard under the given key.

Parameters
smartDashboardKeyThe key in SmartDashboard to publish the chooser under.

◆ ThunderAutoSendableChooser() [3/4]

thunder::ThunderAutoSendableChooser::ThunderAutoSendableChooser ( const TrajectoryRunnerProperties & runnerProps)
explicitnoexcept

Constructs a chooser with the given trajectory runner properties. The chooser will not be published to SmartDashboard until publish() is called.

Parameters
runnerPropsThe trajectory runner properties to use for making trajectory commands.

◆ ThunderAutoSendableChooser() [4/4]

thunder::ThunderAutoSendableChooser::ThunderAutoSendableChooser ( std::string_view smartDashboardKey,
const TrajectoryRunnerProperties & runnerProps )
noexcept

Constructs a chooser with the given trajectory runner properties and publishes it to SmartDashboard under the given key.

Parameters
smartDashboardKeyThe key in SmartDashboard to publish the chooser under.
runnerPropsThe trajectory runner properties to use for making trajectory commands.

Member Function Documentation

◆ addAllAutoModesFromProject()

void thunder::ThunderAutoSendableChooser::addAllAutoModesFromProject ( const std::string & projectName)
noexcept

Add all auto modes from a previously included project to the chooser.

Parameters
projectNameThe name of the project to add auto modes from. This must match the name of a project previously included using includeProjectSource().

◆ addAllTrajectoriesFromProject()

void thunder::ThunderAutoSendableChooser::addAllTrajectoriesFromProject ( const std::string & projectName)
noexcept

Add all trajectories from a previously included project to the chooser.

Parameters
projectNameThe name of the project to add trajectories from. This must match the name of a project previously included using includeProjectSource().

◆ addAutoModeFromProject()

bool thunder::ThunderAutoSendableChooser::addAutoModeFromProject ( const std::string & projectName,
const std::string & autoModeName )
noexcept

Add an auto mode from a previously included project to the chooser.

Parameters
projectNameThe name of the project to add the auto mode from. This must match the name of a project previously included using includeProjectSource().
autoModeNameThe name of the auto mode to add from the project.
Returns
True if the auto mode was successfully added, false if the project or auto mode was not found, or another item with the same name was already added to the chooser.

◆ addCustomCommand() [1/2]

bool thunder::ThunderAutoSendableChooser::addCustomCommand ( const std::string & name,
frc2::CommandPtr command )
noexcept

Add a custom command to the chooser.

Parameters
nameThe name of the custom command.
commandThe command to add.
Returns
True if the command was successfully added, false if another item with the same name was already added to the chooser.

◆ addCustomCommand() [2/2]

bool thunder::ThunderAutoSendableChooser::addCustomCommand ( const std::string & name,
std::shared_ptr< frc2::Command > command )
noexcept

Add a custom command to the chooser.

Parameters
nameThe name of the custom command.
commandThe command to add.
Returns
True if the command was successfully added, false if another item with the same name was already added to the chooser.

◆ addTrajectoryFromProject()

bool thunder::ThunderAutoSendableChooser::addTrajectoryFromProject ( const std::string & projectName,
const std::string & trajectoryName )
noexcept

Add a trajectory from a previously included project to the chooser.

Parameters
projectNameThe name of the project to add the trajectory from. This must match the name of a project previously included using includeProjectSource().
trajectoryNameThe name of the trajectory to add from the project.
Returns
True if the trajectory was successfully added, false if the project or trajectory was not found, or another item with the same name was already added to the chooser.

◆ getSelected()

ThunderAutoSendableChooserSelection thunder::ThunderAutoSendableChooser::getSelected ( ) const
noexcept

Get the currently selected item from the chooser.

◆ getSelectedCommand()

frc2::CommandPtr thunder::ThunderAutoSendableChooser::getSelectedCommand ( ) const
noexcept

Get the currently selected command from the chooser.

Returns
The selected command.

◆ includeProjectSource()

void thunder::ThunderAutoSendableChooser::includeProjectSource ( std::shared_ptr< ThunderAutoProject > project,
bool addAllAutoModes = false,
bool addAllTrajectories = false )
noexcept

Include a ThunderAuto project as a source for trajectories and auto modes. Trajectories and auto modes from this project can later be added to the chooser using the appropriate methods.

Parameters
projectThe ThunderAuto project to include.
addAllAutoModesIf true, all auto modes from the project will be added to the chooser.
addAllTrajectoriesIf true, all trajectories from the project will be added to the chooser.

◆ publish()

void thunder::ThunderAutoSendableChooser::publish ( std::string_view smartDashboardKey)
noexcept

Publishes the chooser to SmartDashboard. This only needs to be called once, as the chooser will automatically refresh the chooser when changes are made.

Parameters
smartDashboardKeyThe key to publish the chooser under.

◆ setTrajectoryRunnerProperties()

void thunder::ThunderAutoSendableChooser::setTrajectoryRunnerProperties ( const TrajectoryRunnerProperties & runnerProps)
noexcept

Sets the trajectory runner properties to use for making trajectory commands.

Parameters
runnerPropsThe trajectory runner properties to set.

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