mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
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:
@@ -21,6 +21,8 @@ std::shared_ptr<nt::NetworkTable> SendableBuilderImpl::GetTable() {
|
||||
return m_table;
|
||||
}
|
||||
|
||||
bool SendableBuilderImpl::IsActuator() const { return m_actuator; }
|
||||
|
||||
void SendableBuilderImpl::UpdateTable() {
|
||||
uint64_t time = nt::Now();
|
||||
for (auto& property : m_properties) {
|
||||
@@ -53,6 +55,11 @@ void SendableBuilderImpl::SetSmartDashboardType(const wpi::Twine& type) {
|
||||
m_table->GetEntry(".type").SetString(type);
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::SetActuator(bool value) {
|
||||
m_table->GetEntry(".actuator").SetBoolean(value);
|
||||
m_actuator = value;
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::SetSafeState(std::function<void()> func) {
|
||||
m_safeState = func;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user