Add a way to indicate a Sendable is an actuator (#1226)

SendableBuilder.setActuator() sets the .actuator key in the network table
so dashboards can change behavior on the client side if desired, and also
sets a local flag (retrievable via isActuator()).

Both make drive bases actuators and call setSafeState on them.
This commit is contained in:
Peter Johnson
2018-07-28 14:04:46 -07:00
committed by GitHub
parent 5fafaf6272
commit 0614913f1a
25 changed files with 78 additions and 0 deletions

View File

@@ -46,6 +46,12 @@ class SendableBuilderImpl : public SendableBuilder {
*/
std::shared_ptr<nt::NetworkTable> GetTable();
/**
* Return whether this sendable should be treated as an actuator.
* @return True if actuator, false if not.
*/
bool IsActuator() const;
/**
* Update the network table values by calling the getters for all properties.
*/
@@ -74,6 +80,7 @@ class SendableBuilderImpl : public SendableBuilder {
void StopLiveWindowMode();
void SetSmartDashboardType(const wpi::Twine& type) override;
void SetActuator(bool value) override;
void SetSafeState(std::function<void()> func) override;
void SetUpdateTable(std::function<void()> func) override;
nt::NetworkTableEntry GetEntry(const wpi::Twine& key) override;
@@ -188,6 +195,7 @@ class SendableBuilderImpl : public SendableBuilder {
std::function<void()> m_updateTable;
std::shared_ptr<nt::NetworkTable> m_table;
nt::NetworkTableEntry m_controllableEntry;
bool m_actuator = false;
};
} // namespace frc