mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +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:
@@ -107,6 +107,8 @@ void MecanumDrive::GetDescription(wpi::raw_ostream& desc) const {
|
||||
|
||||
void MecanumDrive::InitSendable(SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("MecanumDrive");
|
||||
builder.SetActuator(true);
|
||||
builder.SetSafeState([=] { StopMotor(); });
|
||||
builder.AddDoubleProperty("Front Left Motor Speed",
|
||||
[=]() { return m_frontLeftMotor.Get(); },
|
||||
[=](double value) { m_frontLeftMotor.Set(value); });
|
||||
|
||||
Reference in New Issue
Block a user