mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Split Sendable into NT and non-NT portions (#3432)
The non-NT portion has been moved to wpiutil. The NT portion has been moved to ntcore (as NTSendable). SendableBuilder similarly split and moved. SendableRegistry moved to wpiutil. In C++, SendableHelper also moved to wpiutil. This enables use of Sendable from wpimath and also enables moving several classes from wpilib to wpimath.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import edu.wpi.first.util.sendable.Sendable;
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
|
||||
/** Interface for NetworkTable Sendable objects. */
|
||||
public interface NTSendable extends Sendable {
|
||||
/**
|
||||
* Initializes this {@link Sendable} object.
|
||||
*
|
||||
* @param builder sendable builder
|
||||
*/
|
||||
void initSendable(NTSendableBuilder builder);
|
||||
|
||||
@Override
|
||||
default void initSendable(SendableBuilder builder) {
|
||||
if (builder.getBackendKind() == SendableBuilder.BackendKind.kNetworkTables) {
|
||||
initSendable((NTSendableBuilder) builder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public interface NTSendableBuilder extends SendableBuilder {
|
||||
/**
|
||||
* Set the function that should be called to update the network table for things other than
|
||||
* properties. Note this function is not passed the network table object; instead it should use
|
||||
* the entry handles returned by getEntry().
|
||||
*
|
||||
* @param func function
|
||||
*/
|
||||
void setUpdateTable(Runnable func);
|
||||
|
||||
/**
|
||||
* Add a property without getters or setters. This can be used to get entry handles for the
|
||||
* function called by setUpdateTable().
|
||||
*
|
||||
* @param key property name
|
||||
* @return Network table entry
|
||||
*/
|
||||
NetworkTableEntry getEntry(String key);
|
||||
|
||||
/**
|
||||
* Add a NetworkTableValue property.
|
||||
*
|
||||
* @param key property name
|
||||
* @param getter getter function (returns current value)
|
||||
* @param setter setter function (sets new value)
|
||||
*/
|
||||
void addValueProperty(
|
||||
String key, Supplier<NetworkTableValue> getter, Consumer<NetworkTableValue> setter);
|
||||
|
||||
/**
|
||||
* Get the network table.
|
||||
*
|
||||
* @return The network table
|
||||
*/
|
||||
NetworkTable getTable();
|
||||
|
||||
@Override
|
||||
default BackendKind getBackendKind() {
|
||||
return BackendKind.kNetworkTables;
|
||||
}
|
||||
}
|
||||
17
ntcore/src/main/native/cpp/networktables/NTSendable.cpp
Normal file
17
ntcore/src/main/native/cpp/networktables/NTSendable.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include "networktables/NTSendable.h"
|
||||
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
|
||||
#include "networktables/NTSendableBuilder.h"
|
||||
|
||||
using namespace nt;
|
||||
|
||||
void NTSendable::InitSendable(wpi::SendableBuilder& builder) {
|
||||
if (builder.GetBackendKind() == wpi::SendableBuilder::kNetworkTables) {
|
||||
InitSendable(static_cast<NTSendableBuilder&>(builder));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include "networktables/NTSendableBuilder.h"
|
||||
|
||||
using namespace nt;
|
||||
|
||||
NTSendableBuilder::BackendKind NTSendableBuilder::GetBackendKind() const {
|
||||
return kNetworkTables;
|
||||
}
|
||||
28
ntcore/src/main/native/include/networktables/NTSendable.h
Normal file
28
ntcore/src/main/native/include/networktables/NTSendable.h
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
|
||||
namespace nt {
|
||||
|
||||
class NTSendableBuilder;
|
||||
|
||||
/**
|
||||
* Interface for NetworkTable Sendable objects.
|
||||
*/
|
||||
class NTSendable : public wpi::Sendable {
|
||||
public:
|
||||
/**
|
||||
* Initializes this Sendable object.
|
||||
*
|
||||
* @param builder sendable builder
|
||||
*/
|
||||
virtual void InitSendable(NTSendableBuilder& builder) = 0;
|
||||
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
};
|
||||
|
||||
} // namespace nt
|
||||
@@ -0,0 +1,65 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
|
||||
#include "networktables/NetworkTable.h"
|
||||
#include "networktables/NetworkTableEntry.h"
|
||||
#include "networktables/NetworkTableValue.h"
|
||||
|
||||
namespace nt {
|
||||
|
||||
class NTSendableBuilder : public wpi::SendableBuilder {
|
||||
public:
|
||||
/**
|
||||
* Set the function that should be called to update the network table
|
||||
* for things other than properties. Note this function is not passed
|
||||
* the network table object; instead it should use the entry handles
|
||||
* returned by GetEntry().
|
||||
*
|
||||
* @param func function
|
||||
*/
|
||||
virtual void SetUpdateTable(std::function<void()> func) = 0;
|
||||
|
||||
/**
|
||||
* Add a property without getters or setters. This can be used to get
|
||||
* entry handles for the function called by SetUpdateTable().
|
||||
*
|
||||
* @param key property name
|
||||
* @return Network table entry
|
||||
*/
|
||||
virtual NetworkTableEntry GetEntry(std::string_view key) = 0;
|
||||
|
||||
/**
|
||||
* Add a NetworkTableValue property.
|
||||
*
|
||||
* @param key property name
|
||||
* @param getter getter function (returns current value)
|
||||
* @param setter setter function (sets new value)
|
||||
*/
|
||||
virtual void AddValueProperty(
|
||||
std::string_view key, std::function<std::shared_ptr<Value>()> getter,
|
||||
std::function<void(std::shared_ptr<Value>)> setter) = 0;
|
||||
|
||||
/**
|
||||
* Get the network table.
|
||||
* @return The network table
|
||||
*/
|
||||
virtual std::shared_ptr<NetworkTable> GetTable() = 0;
|
||||
|
||||
/**
|
||||
* Gets the kind of backend being used.
|
||||
*
|
||||
* @return Backend kind
|
||||
*/
|
||||
BackendKind GetBackendKind() const override;
|
||||
};
|
||||
|
||||
} // namespace nt
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
package edu.wpi.first.wpilibj2.command;
|
||||
|
||||
import edu.wpi.first.wpilibj.Sendable;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
|
||||
import edu.wpi.first.util.sendable.Sendable;
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
import edu.wpi.first.util.sendable.SendableRegistry;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@@ -7,15 +7,15 @@ package edu.wpi.first.wpilibj2.command;
|
||||
import edu.wpi.first.hal.FRCNetComm.tInstances;
|
||||
import edu.wpi.first.hal.FRCNetComm.tResourceType;
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.networktables.NTSendable;
|
||||
import edu.wpi.first.networktables.NTSendableBuilder;
|
||||
import edu.wpi.first.networktables.NetworkTableEntry;
|
||||
import edu.wpi.first.util.sendable.SendableRegistry;
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
import edu.wpi.first.wpilibj.RobotState;
|
||||
import edu.wpi.first.wpilibj.Sendable;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.Watchdog;
|
||||
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -34,7 +34,7 @@ import java.util.function.Consumer;
|
||||
* CommandScheduler#registerSubsystem(Subsystem...)} in order for their {@link Subsystem#periodic()}
|
||||
* methods to be called and for their default commands to be scheduled.
|
||||
*/
|
||||
public final class CommandScheduler implements Sendable, AutoCloseable {
|
||||
public final class CommandScheduler implements NTSendable, AutoCloseable {
|
||||
/** The Singleton Instance. */
|
||||
private static CommandScheduler instance;
|
||||
|
||||
@@ -501,7 +501,7 @@ public final class CommandScheduler implements Sendable, AutoCloseable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initSendable(SendableBuilder builder) {
|
||||
public void initSendable(NTSendableBuilder builder) {
|
||||
builder.setSmartDashboardType("Scheduler");
|
||||
final NetworkTableEntry namesEntry = builder.getEntry("Names");
|
||||
final NetworkTableEntry idsEntry = builder.getEntry("Ids");
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
package edu.wpi.first.wpilibj2.command;
|
||||
|
||||
import edu.wpi.first.wpilibj.Sendable;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
|
||||
import edu.wpi.first.util.sendable.Sendable;
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
import edu.wpi.first.util.sendable.SendableRegistry;
|
||||
|
||||
/**
|
||||
* A base for subsystems that handles registration in the constructor, and provides a more intuitive
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
package edu.wpi.first.wpilibj2.command;
|
||||
|
||||
import edu.wpi.first.util.sendable.SendableRegistry;
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
|
||||
|
||||
/**
|
||||
* A command that does nothing but takes a specified amount of time to finish. Useful for
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
|
||||
#include "frc2/command/CommandBase.h"
|
||||
|
||||
#include <frc/smartdashboard/SendableBuilder.h>
|
||||
#include <frc/smartdashboard/SendableRegistry.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
using namespace frc2;
|
||||
|
||||
CommandBase::CommandBase() {
|
||||
frc::SendableRegistry::GetInstance().Add(this, GetTypeName(*this));
|
||||
wpi::SendableRegistry::GetInstance().Add(this, GetTypeName(*this));
|
||||
}
|
||||
|
||||
void CommandBase::AddRequirements(
|
||||
@@ -31,22 +31,22 @@ wpi::SmallSet<Subsystem*, 4> CommandBase::GetRequirements() const {
|
||||
}
|
||||
|
||||
void CommandBase::SetName(std::string_view name) {
|
||||
frc::SendableRegistry::GetInstance().SetName(this, name);
|
||||
wpi::SendableRegistry::GetInstance().SetName(this, name);
|
||||
}
|
||||
|
||||
std::string CommandBase::GetName() const {
|
||||
return frc::SendableRegistry::GetInstance().GetName(this);
|
||||
return wpi::SendableRegistry::GetInstance().GetName(this);
|
||||
}
|
||||
|
||||
std::string CommandBase::GetSubsystem() const {
|
||||
return frc::SendableRegistry::GetInstance().GetSubsystem(this);
|
||||
return wpi::SendableRegistry::GetInstance().GetSubsystem(this);
|
||||
}
|
||||
|
||||
void CommandBase::SetSubsystem(std::string_view subsystem) {
|
||||
frc::SendableRegistry::GetInstance().SetSubsystem(this, subsystem);
|
||||
wpi::SendableRegistry::GetInstance().SetSubsystem(this, subsystem);
|
||||
}
|
||||
|
||||
void CommandBase::InitSendable(frc::SendableBuilder& builder) {
|
||||
void CommandBase::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Command");
|
||||
builder.AddStringProperty(
|
||||
".name", [this] { return GetName(); }, nullptr);
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
#include <frc/RobotState.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/livewindow/LiveWindow.h>
|
||||
#include <frc/smartdashboard/SendableBuilder.h>
|
||||
#include <frc/smartdashboard/SendableRegistry.h>
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <hal/HALBase.h>
|
||||
#include <networktables/NTSendableBuilder.h>
|
||||
#include <networktables/NetworkTableEntry.h>
|
||||
#include <wpi/DenseMap.h>
|
||||
#include <wpi/SmallVector.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc2/command/CommandGroupBase.h"
|
||||
#include "frc2/command/CommandState.h"
|
||||
@@ -70,7 +70,7 @@ CommandScheduler::CommandScheduler()
|
||||
}) {
|
||||
HAL_Report(HALUsageReporting::kResourceType_Command,
|
||||
HALUsageReporting::kCommand2_Scheduler);
|
||||
frc::SendableRegistry::GetInstance().AddLW(this, "Scheduler");
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "Scheduler");
|
||||
auto scheduler = frc::LiveWindow::GetInstance();
|
||||
scheduler->enabled = [this] {
|
||||
this->Disable();
|
||||
@@ -80,7 +80,7 @@ CommandScheduler::CommandScheduler()
|
||||
}
|
||||
|
||||
CommandScheduler::~CommandScheduler() {
|
||||
frc::SendableRegistry::GetInstance().Remove(this);
|
||||
wpi::SendableRegistry::GetInstance().Remove(this);
|
||||
auto scheduler = frc::LiveWindow::GetInstance();
|
||||
scheduler->enabled = nullptr;
|
||||
scheduler->disabled = nullptr;
|
||||
@@ -428,7 +428,7 @@ void CommandScheduler::OnCommandFinish(Action action) {
|
||||
m_impl->finishActions.emplace_back(std::move(action));
|
||||
}
|
||||
|
||||
void CommandScheduler::InitSendable(frc::SendableBuilder& builder) {
|
||||
void CommandScheduler::InitSendable(nt::NTSendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Scheduler");
|
||||
auto namesEntry = builder.GetEntry("Names");
|
||||
auto idsEntry = builder.GetEntry("Ids");
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "frc2/command/SubsystemBase.h"
|
||||
|
||||
#include <frc/smartdashboard/SendableBuilder.h>
|
||||
#include <frc/smartdashboard/SendableRegistry.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc2/command/Command.h"
|
||||
#include "frc2/command/CommandScheduler.h"
|
||||
@@ -13,11 +13,11 @@
|
||||
using namespace frc2;
|
||||
|
||||
SubsystemBase::SubsystemBase() {
|
||||
frc::SendableRegistry::GetInstance().AddLW(this, GetTypeName(*this));
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, GetTypeName(*this));
|
||||
CommandScheduler::GetInstance().RegisterSubsystem({this});
|
||||
}
|
||||
|
||||
void SubsystemBase::InitSendable(frc::SendableBuilder& builder) {
|
||||
void SubsystemBase::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Subsystem");
|
||||
builder.AddBooleanProperty(
|
||||
".hasDefault", [this] { return GetDefaultCommand() != nullptr; },
|
||||
@@ -48,22 +48,22 @@ void SubsystemBase::InitSendable(frc::SendableBuilder& builder) {
|
||||
}
|
||||
|
||||
std::string SubsystemBase::GetName() const {
|
||||
return frc::SendableRegistry::GetInstance().GetName(this);
|
||||
return wpi::SendableRegistry::GetInstance().GetName(this);
|
||||
}
|
||||
|
||||
void SubsystemBase::SetName(std::string_view name) {
|
||||
frc::SendableRegistry::GetInstance().SetName(this, name);
|
||||
wpi::SendableRegistry::GetInstance().SetName(this, name);
|
||||
}
|
||||
|
||||
std::string SubsystemBase::GetSubsystem() const {
|
||||
return frc::SendableRegistry::GetInstance().GetSubsystem(this);
|
||||
return wpi::SendableRegistry::GetInstance().GetSubsystem(this);
|
||||
}
|
||||
|
||||
void SubsystemBase::SetSubsystem(std::string_view name) {
|
||||
frc::SendableRegistry::GetInstance().SetSubsystem(this, name);
|
||||
wpi::SendableRegistry::GetInstance().SetSubsystem(this, name);
|
||||
}
|
||||
|
||||
void SubsystemBase::AddChild(std::string name, frc::Sendable* child) {
|
||||
auto& registry = frc::SendableRegistry::GetInstance();
|
||||
void SubsystemBase::AddChild(std::string name, wpi::Sendable* child) {
|
||||
auto& registry = wpi::SendableRegistry::GetInstance();
|
||||
registry.AddLW(child, GetSubsystem(), name);
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <frc/smartdashboard/Sendable.h>
|
||||
#include <frc/smartdashboard/SendableHelper.h>
|
||||
#include <wpi/SmallSet.h>
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
#include <wpi/span.h>
|
||||
|
||||
#include "frc2/command/Command.h"
|
||||
@@ -20,8 +20,8 @@ namespace frc2 {
|
||||
* A Sendable base class for Commands.
|
||||
*/
|
||||
class CommandBase : public Command,
|
||||
public frc::Sendable,
|
||||
public frc::SendableHelper<CommandBase> {
|
||||
public wpi::Sendable,
|
||||
public wpi::SendableHelper<CommandBase> {
|
||||
public:
|
||||
/**
|
||||
* Adds the specified requirements to the command.
|
||||
@@ -69,7 +69,7 @@ class CommandBase : public Command,
|
||||
*/
|
||||
void SetSubsystem(std::string_view subsystem);
|
||||
|
||||
void InitSendable(frc::SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
protected:
|
||||
CommandBase();
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
#include <frc/Errors.h>
|
||||
#include <frc/Watchdog.h>
|
||||
#include <frc/smartdashboard/Sendable.h>
|
||||
#include <frc/smartdashboard/SendableHelper.h>
|
||||
#include <networktables/NTSendable.h>
|
||||
#include <units/time.h>
|
||||
#include <wpi/FunctionExtras.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
#include <wpi/span.h>
|
||||
|
||||
namespace frc2 {
|
||||
@@ -27,8 +27,8 @@ class Subsystem;
|
||||
* with the scheduler using RegisterSubsystem() in order for their Periodic()
|
||||
* methods to be called and for their default commands to be scheduled.
|
||||
*/
|
||||
class CommandScheduler final : public frc::Sendable,
|
||||
public frc::SendableHelper<CommandScheduler> {
|
||||
class CommandScheduler final : public nt::NTSendable,
|
||||
public wpi::SendableHelper<CommandScheduler> {
|
||||
public:
|
||||
/**
|
||||
* Returns the Scheduler instance.
|
||||
@@ -332,7 +332,7 @@ class CommandScheduler final : public frc::Sendable,
|
||||
*/
|
||||
void OnCommandFinish(Action action);
|
||||
|
||||
void InitSendable(frc::SendableBuilder& builder) override;
|
||||
void InitSendable(nt::NTSendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
// Constructor; private as this is a singleton
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <frc/smartdashboard/Sendable.h>
|
||||
#include <frc/smartdashboard/SendableHelper.h>
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
#include "frc2/command/Subsystem.h"
|
||||
|
||||
@@ -18,10 +18,10 @@ namespace frc2 {
|
||||
* provides a more intuitive method for setting the default command.
|
||||
*/
|
||||
class SubsystemBase : public Subsystem,
|
||||
public frc::Sendable,
|
||||
public frc::SendableHelper<SubsystemBase> {
|
||||
public wpi::Sendable,
|
||||
public wpi::SendableHelper<SubsystemBase> {
|
||||
public:
|
||||
void InitSendable(frc::SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
/**
|
||||
* Gets the name of this Subsystem.
|
||||
@@ -58,7 +58,7 @@ class SubsystemBase : public Subsystem,
|
||||
* @param name name to give child
|
||||
* @param child sendable
|
||||
*/
|
||||
void AddChild(std::string name, frc::Sendable* child);
|
||||
void AddChild(std::string name, wpi::Sendable* child);
|
||||
|
||||
protected:
|
||||
SubsystemBase();
|
||||
|
||||
@@ -10,8 +10,9 @@ import edu.wpi.first.hal.FRCNetComm.tResourceType;
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.hal.util.BoundaryException;
|
||||
import edu.wpi.first.math.filter.LinearFilter;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
|
||||
import edu.wpi.first.util.sendable.Sendable;
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
import edu.wpi.first.util.sendable.SendableRegistry;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
|
||||
/**
|
||||
* Class implements a PID Control Loop.
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.buttons;
|
||||
|
||||
import edu.wpi.first.wpilibj.Sendable;
|
||||
import edu.wpi.first.util.sendable.Sendable;
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
import edu.wpi.first.wpilibj.command.Command;
|
||||
import edu.wpi.first.wpilibj.command.Scheduler;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
|
||||
|
||||
/**
|
||||
* This class provides an easy way to link commands to inputs.
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.command;
|
||||
|
||||
import edu.wpi.first.util.sendable.Sendable;
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
import edu.wpi.first.util.sendable.SendableRegistry;
|
||||
import edu.wpi.first.wpilibj.RobotState;
|
||||
import edu.wpi.first.wpilibj.Sendable;
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.command;
|
||||
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
import edu.wpi.first.wpilibj.PIDController;
|
||||
import edu.wpi.first.wpilibj.PIDOutput;
|
||||
import edu.wpi.first.wpilibj.PIDSource;
|
||||
import edu.wpi.first.wpilibj.PIDSourceType;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
|
||||
|
||||
/**
|
||||
* This class defines a {@link Command} which interacts heavily with a PID loop.
|
||||
|
||||
@@ -7,12 +7,12 @@ package edu.wpi.first.wpilibj.command;
|
||||
import edu.wpi.first.hal.FRCNetComm.tInstances;
|
||||
import edu.wpi.first.hal.FRCNetComm.tResourceType;
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.networktables.NTSendable;
|
||||
import edu.wpi.first.networktables.NTSendableBuilder;
|
||||
import edu.wpi.first.networktables.NetworkTableEntry;
|
||||
import edu.wpi.first.wpilibj.Sendable;
|
||||
import edu.wpi.first.util.sendable.SendableRegistry;
|
||||
import edu.wpi.first.wpilibj.buttons.Trigger.ButtonScheduler;
|
||||
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
@@ -30,7 +30,7 @@ import java.util.Vector;
|
||||
*
|
||||
* @see Command
|
||||
*/
|
||||
public final class Scheduler implements Sendable, AutoCloseable {
|
||||
public final class Scheduler implements NTSendable, AutoCloseable {
|
||||
/** The Singleton Instance. */
|
||||
private static Scheduler instance;
|
||||
|
||||
@@ -301,7 +301,7 @@ public final class Scheduler implements Sendable, AutoCloseable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initSendable(SendableBuilder builder) {
|
||||
public void initSendable(NTSendableBuilder builder) {
|
||||
builder.setSmartDashboardType("Scheduler");
|
||||
final NetworkTableEntry namesEntry = builder.getEntry("Names");
|
||||
final NetworkTableEntry idsEntry = builder.getEntry("Ids");
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.command;
|
||||
|
||||
import edu.wpi.first.wpilibj.Sendable;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
|
||||
import edu.wpi.first.util.sendable.Sendable;
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
import edu.wpi.first.util.sendable.SendableRegistry;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
#include <cmath>
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/PIDOutput.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -41,7 +41,7 @@ PIDBase::PIDBase(double Kp, double Ki, double Kd, double Kf, PIDSource& source,
|
||||
static int instances = 0;
|
||||
instances++;
|
||||
HAL_Report(HALUsageReporting::kResourceType_PIDController, instances);
|
||||
SendableRegistry::GetInstance().Add(this, "PIDController", instances);
|
||||
wpi::SendableRegistry::GetInstance().Add(this, "PIDController", instances);
|
||||
}
|
||||
|
||||
double PIDBase::Get() const {
|
||||
@@ -228,7 +228,7 @@ void PIDBase::PIDWrite(double output) {
|
||||
SetSetpoint(output);
|
||||
}
|
||||
|
||||
void PIDBase::InitSendable(SendableBuilder& builder) {
|
||||
void PIDBase::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("PIDController");
|
||||
builder.SetSafeState([=] { Reset(); });
|
||||
builder.AddDoubleProperty(
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
|
||||
#include "frc/PIDController.h"
|
||||
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
|
||||
#include "frc/Notifier.h"
|
||||
#include "frc/PIDOutput.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -75,7 +76,7 @@ void PIDController::Reset() {
|
||||
PIDBase::Reset();
|
||||
}
|
||||
|
||||
void PIDController::InitSendable(SendableBuilder& builder) {
|
||||
void PIDController::InitSendable(wpi::SendableBuilder& builder) {
|
||||
PIDBase::InitSendable(builder);
|
||||
builder.AddBooleanProperty(
|
||||
"enabled", [=] { return IsEnabled(); },
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
|
||||
#include "frc/buttons/Button.h"
|
||||
#include "frc/buttons/CancelButtonScheduler.h"
|
||||
#include "frc/buttons/HeldButtonScheduler.h"
|
||||
#include "frc/buttons/PressedButtonScheduler.h"
|
||||
#include "frc/buttons/ReleasedButtonScheduler.h"
|
||||
#include "frc/buttons/ToggleButtonScheduler.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -62,7 +63,7 @@ void Trigger::ToggleWhenActive(Command* command) {
|
||||
tbs->Start();
|
||||
}
|
||||
|
||||
void Trigger::InitSendable(SendableBuilder& builder) {
|
||||
void Trigger::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Button");
|
||||
builder.SetSafeState([=] { m_sendablePressed = false; });
|
||||
builder.AddBooleanProperty(
|
||||
|
||||
@@ -6,14 +6,15 @@
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/RobotState.h"
|
||||
#include "frc/Timer.h"
|
||||
#include "frc/commands/CommandGroup.h"
|
||||
#include "frc/commands/Scheduler.h"
|
||||
#include "frc/livewindow/LiveWindow.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -40,10 +41,10 @@ Command::Command(std::string_view name, units::second_t timeout) {
|
||||
|
||||
// If name contains an empty string
|
||||
if (name.empty()) {
|
||||
SendableRegistry::GetInstance().Add(
|
||||
wpi::SendableRegistry::GetInstance().Add(
|
||||
this, fmt::format("Command_{}", typeid(*this).name()));
|
||||
} else {
|
||||
SendableRegistry::GetInstance().Add(this, name);
|
||||
wpi::SendableRegistry::GetInstance().Add(this, name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,25 +278,26 @@ void Command::StartTiming() {
|
||||
}
|
||||
|
||||
std::string Command::GetName() const {
|
||||
return SendableRegistry::GetInstance().GetName(this);
|
||||
return wpi::SendableRegistry::GetInstance().GetName(this);
|
||||
}
|
||||
|
||||
void Command::SetName(std::string_view name) {
|
||||
SendableRegistry::GetInstance().SetName(this, name);
|
||||
wpi::SendableRegistry::GetInstance().SetName(this, name);
|
||||
}
|
||||
|
||||
std::string Command::GetSubsystem() const {
|
||||
return SendableRegistry::GetInstance().GetSubsystem(this);
|
||||
return wpi::SendableRegistry::GetInstance().GetSubsystem(this);
|
||||
}
|
||||
|
||||
void Command::SetSubsystem(std::string_view name) {
|
||||
SendableRegistry::GetInstance().SetSubsystem(this, name);
|
||||
wpi::SendableRegistry::GetInstance().SetSubsystem(this, name);
|
||||
}
|
||||
|
||||
void Command::InitSendable(SendableBuilder& builder) {
|
||||
void Command::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Command");
|
||||
builder.AddStringProperty(
|
||||
".name", [=] { return SendableRegistry::GetInstance().GetName(this); },
|
||||
".name",
|
||||
[=] { return wpi::SendableRegistry::GetInstance().GetName(this); },
|
||||
nullptr);
|
||||
builder.AddBooleanProperty(
|
||||
"running", [=] { return IsRunning(); },
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "frc/commands/PIDCommand.h"
|
||||
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -112,7 +112,7 @@ double PIDCommand::GetPosition() {
|
||||
return ReturnPIDInput();
|
||||
}
|
||||
|
||||
void PIDCommand::InitSendable(SendableBuilder& builder) {
|
||||
void PIDCommand::InitSendable(wpi::SendableBuilder& builder) {
|
||||
m_controller->InitSendable(builder);
|
||||
Command::InitSendable(builder);
|
||||
builder.SetSmartDashboardType("PIDCommand");
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
#include <vector>
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <networktables/NTSendableBuilder.h>
|
||||
#include <networktables/NetworkTableEntry.h>
|
||||
#include <wpi/mutex.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/buttons/ButtonScheduler.h"
|
||||
#include "frc/commands/Command.h"
|
||||
#include "frc/commands/Subsystem.h"
|
||||
#include "frc/livewindow/LiveWindow.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -157,7 +157,7 @@ void Scheduler::SetEnabled(bool enabled) {
|
||||
m_impl->enabled = enabled;
|
||||
}
|
||||
|
||||
void Scheduler::InitSendable(SendableBuilder& builder) {
|
||||
void Scheduler::InitSendable(nt::NTSendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Scheduler");
|
||||
auto namesEntry = builder.GetEntry("Names");
|
||||
auto idsEntry = builder.GetEntry("Ids");
|
||||
@@ -186,7 +186,7 @@ void Scheduler::InitSendable(SendableBuilder& builder) {
|
||||
if (m_impl->runningCommandsChanged) {
|
||||
m_impl->commandsBuf.resize(0);
|
||||
m_impl->idsBuf.resize(0);
|
||||
auto& registry = SendableRegistry::GetInstance();
|
||||
auto& registry = wpi::SendableRegistry::GetInstance();
|
||||
for (const auto& command : m_impl->commands) {
|
||||
m_impl->commandsBuf.emplace_back(registry.GetName(command));
|
||||
m_impl->idsBuf.emplace_back(command->GetID());
|
||||
@@ -200,7 +200,7 @@ void Scheduler::InitSendable(SendableBuilder& builder) {
|
||||
Scheduler::Scheduler() : m_impl(new Impl) {
|
||||
HAL_Report(HALUsageReporting::kResourceType_Command,
|
||||
HALUsageReporting::kCommand_Scheduler);
|
||||
SendableRegistry::GetInstance().AddLW(this, "Scheduler");
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "Scheduler");
|
||||
auto scheduler = frc::LiveWindow::GetInstance();
|
||||
scheduler->enabled = [this] {
|
||||
this->SetEnabled(false);
|
||||
@@ -210,7 +210,7 @@ Scheduler::Scheduler() : m_impl(new Impl) {
|
||||
}
|
||||
|
||||
Scheduler::~Scheduler() {
|
||||
SendableRegistry::GetInstance().Remove(this);
|
||||
wpi::SendableRegistry::GetInstance().Remove(this);
|
||||
auto scheduler = frc::LiveWindow::GetInstance();
|
||||
scheduler->enabled = nullptr;
|
||||
scheduler->disabled = nullptr;
|
||||
|
||||
@@ -4,17 +4,18 @@
|
||||
|
||||
#include "frc/commands/Subsystem.h"
|
||||
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/commands/Command.h"
|
||||
#include "frc/commands/Scheduler.h"
|
||||
#include "frc/livewindow/LiveWindow.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
Subsystem::Subsystem(std::string_view name) {
|
||||
SendableRegistry::GetInstance().AddLW(this, name, name);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, name, name);
|
||||
Scheduler::GetInstance()->RegisterSubsystem(this);
|
||||
}
|
||||
|
||||
@@ -43,7 +44,7 @@ Command* Subsystem::GetDefaultCommand() {
|
||||
std::string Subsystem::GetDefaultCommandName() {
|
||||
Command* defaultCommand = GetDefaultCommand();
|
||||
if (defaultCommand) {
|
||||
return SendableRegistry::GetInstance().GetName(defaultCommand);
|
||||
return wpi::SendableRegistry::GetInstance().GetName(defaultCommand);
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
@@ -61,7 +62,7 @@ Command* Subsystem::GetCurrentCommand() const {
|
||||
std::string Subsystem::GetCurrentCommandName() const {
|
||||
Command* currentCommand = GetCurrentCommand();
|
||||
if (currentCommand) {
|
||||
return SendableRegistry::GetInstance().GetName(currentCommand);
|
||||
return wpi::SendableRegistry::GetInstance().GetName(currentCommand);
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
@@ -72,19 +73,19 @@ void Subsystem::Periodic() {}
|
||||
void Subsystem::InitDefaultCommand() {}
|
||||
|
||||
std::string Subsystem::GetName() const {
|
||||
return SendableRegistry::GetInstance().GetName(this);
|
||||
return wpi::SendableRegistry::GetInstance().GetName(this);
|
||||
}
|
||||
|
||||
void Subsystem::SetName(std::string_view name) {
|
||||
SendableRegistry::GetInstance().SetName(this, name);
|
||||
wpi::SendableRegistry::GetInstance().SetName(this, name);
|
||||
}
|
||||
|
||||
std::string Subsystem::GetSubsystem() const {
|
||||
return SendableRegistry::GetInstance().GetSubsystem(this);
|
||||
return wpi::SendableRegistry::GetInstance().GetSubsystem(this);
|
||||
}
|
||||
|
||||
void Subsystem::SetSubsystem(std::string_view name) {
|
||||
SendableRegistry::GetInstance().SetSubsystem(this, name);
|
||||
wpi::SendableRegistry::GetInstance().SetSubsystem(this, name);
|
||||
}
|
||||
|
||||
void Subsystem::AddChild(std::string_view name,
|
||||
@@ -92,25 +93,25 @@ void Subsystem::AddChild(std::string_view name,
|
||||
AddChild(name, *child);
|
||||
}
|
||||
|
||||
void Subsystem::AddChild(std::string_view name, Sendable* child) {
|
||||
void Subsystem::AddChild(std::string_view name, wpi::Sendable* child) {
|
||||
AddChild(name, *child);
|
||||
}
|
||||
|
||||
void Subsystem::AddChild(std::string_view name, Sendable& child) {
|
||||
auto& registry = SendableRegistry::GetInstance();
|
||||
void Subsystem::AddChild(std::string_view name, wpi::Sendable& child) {
|
||||
auto& registry = wpi::SendableRegistry::GetInstance();
|
||||
registry.AddLW(&child, registry.GetSubsystem(this), name);
|
||||
}
|
||||
|
||||
void Subsystem::AddChild(std::shared_ptr<Sendable> child) {
|
||||
void Subsystem::AddChild(std::shared_ptr<wpi::Sendable> child) {
|
||||
AddChild(*child);
|
||||
}
|
||||
|
||||
void Subsystem::AddChild(Sendable* child) {
|
||||
void Subsystem::AddChild(wpi::Sendable* child) {
|
||||
AddChild(*child);
|
||||
}
|
||||
|
||||
void Subsystem::AddChild(Sendable& child) {
|
||||
auto& registry = SendableRegistry::GetInstance();
|
||||
void Subsystem::AddChild(wpi::Sendable& child) {
|
||||
auto& registry = wpi::SendableRegistry::GetInstance();
|
||||
registry.SetSubsystem(&child, registry.GetSubsystem(this));
|
||||
registry.EnableLiveWindow(&child);
|
||||
}
|
||||
@@ -121,7 +122,7 @@ void Subsystem::ConfirmCommand() {
|
||||
}
|
||||
}
|
||||
|
||||
void Subsystem::InitSendable(SendableBuilder& builder) {
|
||||
void Subsystem::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Subsystem");
|
||||
|
||||
builder.AddBooleanProperty(
|
||||
|
||||
@@ -9,19 +9,17 @@
|
||||
|
||||
#include <wpi/deprecated.h>
|
||||
#include <wpi/mutex.h>
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
#include "frc/PIDInterface.h"
|
||||
#include "frc/PIDOutput.h"
|
||||
#include "frc/PIDSource.h"
|
||||
#include "frc/Timer.h"
|
||||
#include "frc/filter/LinearFilter.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class SendableBuilder;
|
||||
|
||||
/**
|
||||
* Class implements a PID Control Loop.
|
||||
*
|
||||
@@ -36,8 +34,8 @@ class SendableBuilder;
|
||||
*/
|
||||
class PIDBase : public PIDInterface,
|
||||
public PIDOutput,
|
||||
public Sendable,
|
||||
public SendableHelper<PIDBase> {
|
||||
public wpi::Sendable,
|
||||
public wpi::SendableHelper<PIDBase> {
|
||||
public:
|
||||
/**
|
||||
* Allocate a PID object with the given constants for P, I, D.
|
||||
@@ -301,7 +299,7 @@ class PIDBase : public PIDInterface,
|
||||
*/
|
||||
void PIDWrite(double output) override;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
protected:
|
||||
// Is the pid controller enabled
|
||||
|
||||
@@ -126,7 +126,7 @@ class PIDController : public PIDBase, public Controller {
|
||||
*/
|
||||
void Reset() override;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Notifier> m_controlLoop;
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -26,7 +26,7 @@ class Command;
|
||||
* only have to write the {@link Trigger#Get()} method to get the full
|
||||
* functionality of the Trigger class.
|
||||
*/
|
||||
class Trigger : public Sendable, public SendableHelper<Trigger> {
|
||||
class Trigger : public wpi::Sendable, public wpi::SendableHelper<Trigger> {
|
||||
public:
|
||||
Trigger() = default;
|
||||
~Trigger() override = default;
|
||||
@@ -44,7 +44,7 @@ class Trigger : public Sendable, public SendableHelper<Trigger> {
|
||||
void CancelWhenActive(Command* command);
|
||||
void ToggleWhenActive(Command* command);
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
std::atomic_bool m_sendablePressed{false};
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
#include <units/time.h>
|
||||
#include <wpi/SmallPtrSet.h>
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
#include "frc/commands/Subsystem.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -43,7 +43,7 @@ class CommandGroup;
|
||||
* @see CommandGroup
|
||||
* @see Subsystem
|
||||
*/
|
||||
class Command : public Sendable, public SendableHelper<Command> {
|
||||
class Command : public wpi::Sendable, public wpi::SendableHelper<Command> {
|
||||
friend class CommandGroup;
|
||||
friend class Scheduler;
|
||||
|
||||
@@ -482,7 +482,7 @@ class Command : public Sendable, public SendableHelper<Command> {
|
||||
static int m_commandCounter;
|
||||
|
||||
public:
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -64,7 +64,7 @@ class PIDCommand : public Command, public PIDOutput, public PIDSource {
|
||||
std::shared_ptr<PIDController> m_controller;
|
||||
|
||||
public:
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
#include <networktables/NTSendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -15,7 +15,7 @@ class ButtonScheduler;
|
||||
class Command;
|
||||
class Subsystem;
|
||||
|
||||
class Scheduler : public Sendable, public SendableHelper<Scheduler> {
|
||||
class Scheduler : public nt::NTSendable, public wpi::SendableHelper<Scheduler> {
|
||||
public:
|
||||
/**
|
||||
* Returns the Scheduler, creating it if one does not exist.
|
||||
@@ -78,7 +78,7 @@ class Scheduler : public Sendable, public SendableHelper<Scheduler> {
|
||||
|
||||
void SetEnabled(bool enabled);
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(nt::NTSendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
Scheduler();
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
namespace frc {
|
||||
|
||||
class Command;
|
||||
|
||||
class Subsystem : public Sendable, public SendableHelper<Subsystem> {
|
||||
class Subsystem : public wpi::Sendable, public wpi::SendableHelper<Subsystem> {
|
||||
friend class Scheduler;
|
||||
|
||||
public:
|
||||
@@ -127,7 +127,7 @@ class Subsystem : public Sendable, public SendableHelper<Subsystem> {
|
||||
* @param name name to give child
|
||||
* @param child sendable
|
||||
*/
|
||||
void AddChild(std::string_view name, std::shared_ptr<Sendable> child);
|
||||
void AddChild(std::string_view name, std::shared_ptr<wpi::Sendable> child);
|
||||
|
||||
/**
|
||||
* Associate a Sendable with this Subsystem.
|
||||
@@ -136,7 +136,7 @@ class Subsystem : public Sendable, public SendableHelper<Subsystem> {
|
||||
* @param name name to give child
|
||||
* @param child sendable
|
||||
*/
|
||||
void AddChild(std::string_view name, Sendable* child);
|
||||
void AddChild(std::string_view name, wpi::Sendable* child);
|
||||
|
||||
/**
|
||||
* Associate a Sendable with this Subsystem.
|
||||
@@ -145,28 +145,28 @@ class Subsystem : public Sendable, public SendableHelper<Subsystem> {
|
||||
* @param name name to give child
|
||||
* @param child sendable
|
||||
*/
|
||||
void AddChild(std::string_view name, Sendable& child);
|
||||
void AddChild(std::string_view name, wpi::Sendable& child);
|
||||
|
||||
/**
|
||||
* Associate a {@link Sendable} with this Subsystem.
|
||||
*
|
||||
* @param child sendable
|
||||
*/
|
||||
void AddChild(std::shared_ptr<Sendable> child);
|
||||
void AddChild(std::shared_ptr<wpi::Sendable> child);
|
||||
|
||||
/**
|
||||
* Associate a {@link Sendable} with this Subsystem.
|
||||
*
|
||||
* @param child sendable
|
||||
*/
|
||||
void AddChild(Sendable* child);
|
||||
void AddChild(wpi::Sendable* child);
|
||||
|
||||
/**
|
||||
* Associate a {@link Sendable} with this Subsystem.
|
||||
*
|
||||
* @param child sendable
|
||||
*/
|
||||
void AddChild(Sendable& child);
|
||||
void AddChild(wpi::Sendable& child);
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -185,7 +185,7 @@ class Subsystem : public Sendable, public SendableHelper<Subsystem> {
|
||||
bool m_initializedDefaultCommand = false;
|
||||
|
||||
public:
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -12,7 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import edu.wpi.first.networktables.NetworkTableEntry;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import edu.wpi.first.wpilibj.Sendable;
|
||||
import edu.wpi.first.util.sendable.Sendable;
|
||||
import edu.wpi.first.wpilibj.command.InstantCommand;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "frc/commands/InstantCommand.h"
|
||||
#include "frc/shuffleboard/ShuffleboardInstance.h"
|
||||
#include "frc/shuffleboard/ShuffleboardTab.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "frc/shuffleboard/ShuffleboardInstance.h"
|
||||
#include "frc/shuffleboard/ShuffleboardTab.h"
|
||||
#include "frc/shuffleboard/ShuffleboardWidget.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
#include "frc/ADXL345_I2C.h"
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
#include <networktables/NTSendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -30,7 +29,7 @@ ADXL345_I2C::ADXL345_I2C(I2C::Port port, Range range, int deviceAddress)
|
||||
HAL_Report(HALUsageReporting::kResourceType_ADXL345,
|
||||
HALUsageReporting::kADXL345_I2C, 0);
|
||||
|
||||
SendableRegistry::GetInstance().AddLW(this, "ADXL345_I2C", port);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "ADXL345_I2C", port);
|
||||
}
|
||||
|
||||
void ADXL345_I2C::SetRange(Range range) {
|
||||
@@ -84,7 +83,7 @@ ADXL345_I2C::AllAxes ADXL345_I2C::GetAccelerations() {
|
||||
return data;
|
||||
}
|
||||
|
||||
void ADXL345_I2C::InitSendable(SendableBuilder& builder) {
|
||||
void ADXL345_I2C::InitSendable(nt::NTSendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("3AxisAccelerometer");
|
||||
auto x = builder.GetEntry("X").GetHandle();
|
||||
auto y = builder.GetEntry("Y").GetHandle();
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
#include "frc/ADXL345_SPI.h"
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
#include <networktables/NTSendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -38,7 +37,7 @@ ADXL345_SPI::ADXL345_SPI(SPI::Port port, ADXL345_SPI::Range range)
|
||||
HAL_Report(HALUsageReporting::kResourceType_ADXL345,
|
||||
HALUsageReporting::kADXL345_SPI);
|
||||
|
||||
SendableRegistry::GetInstance().AddLW(this, "ADXL345_SPI", port);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "ADXL345_SPI", port);
|
||||
}
|
||||
|
||||
void ADXL345_SPI::SetRange(Range range) {
|
||||
@@ -115,7 +114,7 @@ ADXL345_SPI::AllAxes ADXL345_SPI::GetAccelerations() {
|
||||
return data;
|
||||
}
|
||||
|
||||
void ADXL345_SPI::InitSendable(SendableBuilder& builder) {
|
||||
void ADXL345_SPI::InitSendable(nt::NTSendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("3AxisAccelerometer");
|
||||
auto x = builder.GetEntry("X").GetHandle();
|
||||
auto y = builder.GetEntry("Y").GetHandle();
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#include "frc/ADXL362.h"
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <networktables/NTSendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -72,7 +72,7 @@ ADXL362::ADXL362(SPI::Port port, Range range)
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_ADXL362, port + 1);
|
||||
|
||||
SendableRegistry::GetInstance().AddLW(this, "ADXL362", port);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "ADXL362", port);
|
||||
}
|
||||
|
||||
void ADXL362::SetRange(Range range) {
|
||||
@@ -178,7 +178,7 @@ ADXL362::AllAxes ADXL362::GetAccelerations() {
|
||||
return data;
|
||||
}
|
||||
|
||||
void ADXL362::InitSendable(SendableBuilder& builder) {
|
||||
void ADXL362::InitSendable(nt::NTSendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("3AxisAccelerometer");
|
||||
auto x = builder.GetEntry("X").GetHandle();
|
||||
auto y = builder.GetEntry("Y").GetHandle();
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
#include "frc/ADXRS450_Gyro.h"
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/Timer.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -58,7 +58,7 @@ ADXRS450_Gyro::ADXRS450_Gyro(SPI::Port port)
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_ADXRS450, port + 1);
|
||||
|
||||
SendableRegistry::GetInstance().AddLW(this, "ADXRS450_Gyro", port);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "ADXRS450_Gyro", port);
|
||||
}
|
||||
|
||||
static bool CalcParity(int v) {
|
||||
@@ -136,7 +136,7 @@ int ADXRS450_Gyro::GetPort() const {
|
||||
return m_port;
|
||||
}
|
||||
|
||||
void ADXRS450_Gyro::InitSendable(SendableBuilder& builder) {
|
||||
void ADXRS450_Gyro::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Gyro");
|
||||
builder.AddDoubleProperty(
|
||||
"Value", [=] { return GetAngle(); }, nullptr);
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/NullDeleter.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
AnalogAccelerometer::AnalogAccelerometer(int channel)
|
||||
: AnalogAccelerometer(std::make_shared<AnalogInput>(channel)) {
|
||||
SendableRegistry::GetInstance().AddChild(this, m_analogInput.get());
|
||||
wpi::SendableRegistry::GetInstance().AddChild(this, m_analogInput.get());
|
||||
}
|
||||
|
||||
AnalogAccelerometer::AnalogAccelerometer(AnalogInput* channel)
|
||||
@@ -46,7 +46,7 @@ void AnalogAccelerometer::SetZero(double zero) {
|
||||
m_zeroGVoltage = zero;
|
||||
}
|
||||
|
||||
void AnalogAccelerometer::InitSendable(SendableBuilder& builder) {
|
||||
void AnalogAccelerometer::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Accelerometer");
|
||||
builder.AddDoubleProperty(
|
||||
"Value", [=] { return GetAcceleration(); }, nullptr);
|
||||
@@ -56,6 +56,6 @@ void AnalogAccelerometer::InitAccelerometer() {
|
||||
HAL_Report(HALUsageReporting::kResourceType_Accelerometer,
|
||||
m_analogInput->GetChannel() + 1);
|
||||
|
||||
SendableRegistry::GetInstance().AddLW(this, "Accelerometer",
|
||||
m_analogInput->GetChannel());
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "Accelerometer",
|
||||
m_analogInput->GetChannel());
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
#include "frc/AnalogEncoder.h"
|
||||
|
||||
#include <wpi/NullDeleter.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
|
||||
#include "frc/AnalogInput.h"
|
||||
#include "frc/Counter.h"
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -50,8 +50,8 @@ void AnalogEncoder::Init() {
|
||||
m_counter.SetDownSource(
|
||||
m_analogTrigger.CreateOutput(AnalogTriggerType::kFallingPulse));
|
||||
|
||||
SendableRegistry::GetInstance().AddLW(this, "DutyCycle Encoder",
|
||||
m_analogInput->GetChannel());
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "DutyCycle Encoder",
|
||||
m_analogInput->GetChannel());
|
||||
}
|
||||
|
||||
units::turn_t AnalogEncoder::Get() const {
|
||||
@@ -105,7 +105,7 @@ int AnalogEncoder::GetChannel() const {
|
||||
return m_analogInput->GetChannel();
|
||||
}
|
||||
|
||||
void AnalogEncoder::InitSendable(SendableBuilder& builder) {
|
||||
void AnalogEncoder::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("AbsoluteEncoder");
|
||||
builder.AddDoubleProperty(
|
||||
"Distance", [this] { return this->GetDistance(); }, nullptr);
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/NullDeleter.h>
|
||||
#include <wpi/StackTrace.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/AnalogInput.h"
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/Timer.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
AnalogGyro::AnalogGyro(int channel)
|
||||
: AnalogGyro(std::make_shared<AnalogInput>(channel)) {
|
||||
SendableRegistry::GetInstance().AddChild(this, m_analog.get());
|
||||
wpi::SendableRegistry::GetInstance().AddChild(this, m_analog.get());
|
||||
}
|
||||
|
||||
AnalogGyro::AnalogGyro(AnalogInput* channel)
|
||||
@@ -41,7 +41,7 @@ AnalogGyro::AnalogGyro(std::shared_ptr<AnalogInput> channel)
|
||||
|
||||
AnalogGyro::AnalogGyro(int channel, int center, double offset)
|
||||
: AnalogGyro(std::make_shared<AnalogInput>(channel), center, offset) {
|
||||
SendableRegistry::GetInstance().AddChild(this, m_analog.get());
|
||||
wpi::SendableRegistry::GetInstance().AddChild(this, m_analog.get());
|
||||
}
|
||||
|
||||
AnalogGyro::AnalogGyro(std::shared_ptr<AnalogInput> channel, int center,
|
||||
@@ -124,8 +124,8 @@ void AnalogGyro::InitGyro() {
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_Gyro, m_analog->GetChannel() + 1);
|
||||
|
||||
SendableRegistry::GetInstance().AddLW(this, "AnalogGyro",
|
||||
m_analog->GetChannel());
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "AnalogGyro",
|
||||
m_analog->GetChannel());
|
||||
}
|
||||
|
||||
void AnalogGyro::Calibrate() {
|
||||
@@ -138,7 +138,7 @@ std::shared_ptr<AnalogInput> AnalogGyro::GetAnalogInput() const {
|
||||
return m_analog;
|
||||
}
|
||||
|
||||
void AnalogGyro::InitSendable(SendableBuilder& builder) {
|
||||
void AnalogGyro::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Gyro");
|
||||
builder.AddDoubleProperty(
|
||||
"Value", [=] { return GetAngle(); }, nullptr);
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
#include <hal/HALBase.h>
|
||||
#include <hal/Ports.h>
|
||||
#include <wpi/StackTrace.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/SensorUtil.h"
|
||||
#include "frc/Timer.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -34,7 +34,7 @@ AnalogInput::AnalogInput(int channel) {
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_AnalogChannel, channel + 1);
|
||||
|
||||
SendableRegistry::GetInstance().AddLW(this, "AnalogInput", channel);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "AnalogInput", channel);
|
||||
}
|
||||
|
||||
AnalogInput::~AnalogInput() {
|
||||
@@ -194,7 +194,7 @@ void AnalogInput::SetSimDevice(HAL_SimDeviceHandle device) {
|
||||
HAL_SetAnalogInputSimDevice(m_port, device);
|
||||
}
|
||||
|
||||
void AnalogInput::InitSendable(SendableBuilder& builder) {
|
||||
void AnalogInput::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Analog Input");
|
||||
builder.AddDoubleProperty(
|
||||
"Value", [=] { return GetAverageVoltage(); }, nullptr);
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
#include <hal/HALBase.h>
|
||||
#include <hal/Ports.h>
|
||||
#include <wpi/StackTrace.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/SensorUtil.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -34,7 +34,7 @@ AnalogOutput::AnalogOutput(int channel) {
|
||||
FRC_CheckErrorStatus(status, "Channel {}", channel);
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_AnalogOutput, m_channel + 1);
|
||||
SendableRegistry::GetInstance().AddLW(this, "AnalogOutput", m_channel);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "AnalogOutput", m_channel);
|
||||
}
|
||||
|
||||
AnalogOutput::~AnalogOutput() {
|
||||
@@ -58,7 +58,7 @@ int AnalogOutput::GetChannel() const {
|
||||
return m_channel;
|
||||
}
|
||||
|
||||
void AnalogOutput::InitSendable(SendableBuilder& builder) {
|
||||
void AnalogOutput::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Analog Output");
|
||||
builder.AddDoubleProperty(
|
||||
"Value", [=] { return GetVoltage(); },
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
#include <utility>
|
||||
|
||||
#include <wpi/NullDeleter.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/RobotController.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -18,7 +18,7 @@ AnalogPotentiometer::AnalogPotentiometer(int channel, double fullRange,
|
||||
double offset)
|
||||
: AnalogPotentiometer(std::make_shared<AnalogInput>(channel), fullRange,
|
||||
offset) {
|
||||
SendableRegistry::GetInstance().AddChild(this, m_analog_input.get());
|
||||
wpi::SendableRegistry::GetInstance().AddChild(this, m_analog_input.get());
|
||||
}
|
||||
|
||||
AnalogPotentiometer::AnalogPotentiometer(AnalogInput* input, double fullRange,
|
||||
@@ -32,8 +32,8 @@ AnalogPotentiometer::AnalogPotentiometer(std::shared_ptr<AnalogInput> input,
|
||||
: m_analog_input(std::move(input)),
|
||||
m_fullRange(fullRange),
|
||||
m_offset(offset) {
|
||||
SendableRegistry::GetInstance().AddLW(this, "AnalogPotentiometer",
|
||||
m_analog_input->GetChannel());
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "AnalogPotentiometer",
|
||||
m_analog_input->GetChannel());
|
||||
}
|
||||
|
||||
double AnalogPotentiometer::Get() const {
|
||||
@@ -43,7 +43,7 @@ double AnalogPotentiometer::Get() const {
|
||||
m_offset;
|
||||
}
|
||||
|
||||
void AnalogPotentiometer::InitSendable(SendableBuilder& builder) {
|
||||
void AnalogPotentiometer::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Analog Input");
|
||||
builder.AddDoubleProperty(
|
||||
"Value", [=] { return Get(); }, nullptr);
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
#include <hal/AnalogTrigger.h>
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/NullDeleter.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/AnalogInput.h"
|
||||
#include "frc/DutyCycle.h"
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
AnalogTrigger::AnalogTrigger(int channel)
|
||||
: AnalogTrigger(new AnalogInput(channel)) {
|
||||
m_ownsAnalog = true;
|
||||
SendableRegistry::GetInstance().AddChild(this, m_analogInput);
|
||||
wpi::SendableRegistry::GetInstance().AddChild(this, m_analogInput);
|
||||
}
|
||||
|
||||
AnalogTrigger::AnalogTrigger(AnalogInput* input) {
|
||||
@@ -31,7 +31,7 @@ AnalogTrigger::AnalogTrigger(AnalogInput* input) {
|
||||
int index = GetIndex();
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_AnalogTrigger, index + 1);
|
||||
SendableRegistry::GetInstance().AddLW(this, "AnalogTrigger", index);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "AnalogTrigger", index);
|
||||
}
|
||||
|
||||
AnalogTrigger::AnalogTrigger(DutyCycle* input) {
|
||||
@@ -42,7 +42,7 @@ AnalogTrigger::AnalogTrigger(DutyCycle* input) {
|
||||
int index = GetIndex();
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_AnalogTrigger, index + 1);
|
||||
SendableRegistry::GetInstance().AddLW(this, "AnalogTrigger", index);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "AnalogTrigger", index);
|
||||
}
|
||||
|
||||
AnalogTrigger::~AnalogTrigger() {
|
||||
@@ -113,7 +113,7 @@ std::shared_ptr<AnalogTriggerOutput> AnalogTrigger::CreateOutput(
|
||||
wpi::NullDeleter<AnalogTriggerOutput>());
|
||||
}
|
||||
|
||||
void AnalogTrigger::InitSendable(SendableBuilder& builder) {
|
||||
void AnalogTrigger::InitSendable(wpi::SendableBuilder& builder) {
|
||||
if (m_ownsAnalog) {
|
||||
m_analogInput->InitSendable(builder);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ int AnalogTriggerOutput::GetChannel() const {
|
||||
return m_trigger->GetIndex();
|
||||
}
|
||||
|
||||
void AnalogTriggerOutput::InitSendable(SendableBuilder&) {}
|
||||
void AnalogTriggerOutput::InitSendable(wpi::SendableBuilder&) {}
|
||||
|
||||
AnalogTriggerOutput::AnalogTriggerOutput(const AnalogTrigger& trigger,
|
||||
AnalogTriggerType outputType)
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
#include <hal/Accelerometer.h>
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -18,7 +18,7 @@ BuiltInAccelerometer::BuiltInAccelerometer(Range range) {
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_Accelerometer, 0, 0,
|
||||
"Built-in accelerometer");
|
||||
SendableRegistry::GetInstance().AddLW(this, "BuiltInAccel");
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "BuiltInAccel");
|
||||
}
|
||||
|
||||
void BuiltInAccelerometer::SetRange(Range range) {
|
||||
@@ -44,7 +44,7 @@ double BuiltInAccelerometer::GetZ() {
|
||||
return HAL_GetAccelerometerZ();
|
||||
}
|
||||
|
||||
void BuiltInAccelerometer::InitSendable(SendableBuilder& builder) {
|
||||
void BuiltInAccelerometer::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("3AxisAccelerometer");
|
||||
builder.AddDoubleProperty(
|
||||
"X", [=] { return GetX(); }, nullptr);
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
#include <hal/Counter.h>
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/NullDeleter.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/AnalogTrigger.h"
|
||||
#include "frc/DigitalInput.h"
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -27,7 +27,7 @@ Counter::Counter(Mode mode) {
|
||||
SetMaxPeriod(0.5_s);
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_Counter, m_index + 1, mode + 1);
|
||||
SendableRegistry::GetInstance().AddLW(this, "Counter", m_index);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "Counter", m_index);
|
||||
}
|
||||
|
||||
Counter::Counter(int channel) : Counter(kTwoPulse) {
|
||||
@@ -97,7 +97,7 @@ Counter::~Counter() {
|
||||
|
||||
void Counter::SetUpSource(int channel) {
|
||||
SetUpSource(std::make_shared<DigitalInput>(channel));
|
||||
SendableRegistry::GetInstance().AddChild(this, m_upSource.get());
|
||||
wpi::SendableRegistry::GetInstance().AddChild(this, m_upSource.get());
|
||||
}
|
||||
|
||||
void Counter::SetUpSource(AnalogTrigger* analogTrigger,
|
||||
@@ -152,7 +152,7 @@ void Counter::ClearUpSource() {
|
||||
|
||||
void Counter::SetDownSource(int channel) {
|
||||
SetDownSource(std::make_shared<DigitalInput>(channel));
|
||||
SendableRegistry::GetInstance().AddChild(this, m_downSource.get());
|
||||
wpi::SendableRegistry::GetInstance().AddChild(this, m_downSource.get());
|
||||
}
|
||||
|
||||
void Counter::SetDownSource(AnalogTrigger* analogTrigger,
|
||||
@@ -306,7 +306,7 @@ bool Counter::GetDirection() const {
|
||||
return value;
|
||||
}
|
||||
|
||||
void Counter::InitSendable(SendableBuilder& builder) {
|
||||
void Counter::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Counter");
|
||||
builder.AddDoubleProperty(
|
||||
"Value", [=] { return Get(); }, nullptr);
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
#include <hal/Constants.h>
|
||||
#include <hal/DIO.h>
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Counter.h"
|
||||
#include "frc/Encoder.h"
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/SensorUtil.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -35,8 +35,8 @@ DigitalGlitchFilter::DigitalGlitchFilter() {
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_DigitalGlitchFilter,
|
||||
m_channelIndex + 1);
|
||||
SendableRegistry::GetInstance().AddLW(this, "DigitalGlitchFilter",
|
||||
m_channelIndex);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "DigitalGlitchFilter",
|
||||
m_channelIndex);
|
||||
}
|
||||
|
||||
DigitalGlitchFilter::~DigitalGlitchFilter() {
|
||||
@@ -125,4 +125,4 @@ uint64_t DigitalGlitchFilter::GetPeriodNanoSeconds() {
|
||||
static_cast<uint64_t>(HAL_GetSystemClockTicksPerMicrosecond() / 4);
|
||||
}
|
||||
|
||||
void DigitalGlitchFilter::InitSendable(SendableBuilder&) {}
|
||||
void DigitalGlitchFilter::InitSendable(wpi::SendableBuilder&) {}
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
#include <hal/HALBase.h>
|
||||
#include <hal/Ports.h>
|
||||
#include <wpi/StackTrace.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/SensorUtil.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -33,7 +33,7 @@ DigitalInput::DigitalInput(int channel) {
|
||||
FRC_CheckErrorStatus(status, "Channel {}", channel);
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_DigitalInput, channel + 1);
|
||||
SendableRegistry::GetInstance().AddLW(this, "DigitalInput", channel);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "DigitalInput", channel);
|
||||
}
|
||||
|
||||
DigitalInput::~DigitalInput() {
|
||||
@@ -67,7 +67,7 @@ int DigitalInput::GetChannel() const {
|
||||
return m_channel;
|
||||
}
|
||||
|
||||
void DigitalInput::InitSendable(SendableBuilder& builder) {
|
||||
void DigitalInput::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Digital Input");
|
||||
builder.AddBooleanProperty(
|
||||
"Value", [=] { return Get(); }, nullptr);
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
#include <hal/HALBase.h>
|
||||
#include <hal/Ports.h>
|
||||
#include <wpi/StackTrace.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/SensorUtil.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -33,7 +33,7 @@ DigitalOutput::DigitalOutput(int channel) {
|
||||
FRC_CheckErrorStatus(status, "Channel {}", channel);
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_DigitalOutput, channel + 1);
|
||||
SendableRegistry::GetInstance().AddLW(this, "DigitalOutput", channel);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "DigitalOutput", channel);
|
||||
}
|
||||
|
||||
DigitalOutput::~DigitalOutput() {
|
||||
@@ -140,7 +140,7 @@ void DigitalOutput::SetSimDevice(HAL_SimDeviceHandle device) {
|
||||
HAL_SetDIOSimDevice(m_handle, device);
|
||||
}
|
||||
|
||||
void DigitalOutput::InitSendable(SendableBuilder& builder) {
|
||||
void DigitalOutput::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Digital Output");
|
||||
builder.AddBooleanProperty(
|
||||
"Value", [=] { return Get(); }, [=](bool value) { Set(value); });
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
#include <hal/HALBase.h>
|
||||
#include <hal/Ports.h>
|
||||
#include <wpi/NullDeleter.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/SensorUtil.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -53,7 +53,7 @@ DoubleSolenoid::DoubleSolenoid(std::shared_ptr<PneumaticsBase> module,
|
||||
m_module->GetModuleNumber() + 1);
|
||||
HAL_Report(HALUsageReporting::kResourceType_Solenoid, m_reverseChannel + 1,
|
||||
m_module->GetModuleNumber() + 1);
|
||||
SendableRegistry::GetInstance().AddLW(
|
||||
wpi::SendableRegistry::GetInstance().AddLW(
|
||||
this, "DoubleSolenoid", m_module->GetModuleNumber(), m_forwardChannel);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ bool DoubleSolenoid::IsRevSolenoidDisabled() const {
|
||||
return (m_module->GetSolenoidDisabledList() & m_reverseMask) != 0;
|
||||
}
|
||||
|
||||
void DoubleSolenoid::InitSendable(SendableBuilder& builder) {
|
||||
void DoubleSolenoid::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Double Solenoid");
|
||||
builder.SetActuator(true);
|
||||
builder.SetSafeState([=] { Set(kOff); });
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
#include <hal/DutyCycle.h>
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/NullDeleter.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
|
||||
#include "frc/DigitalSource.h"
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -49,7 +49,7 @@ void DutyCycle::InitDutyCycle() {
|
||||
FRC_CheckErrorStatus(status, "Channel {}", GetSourceChannel());
|
||||
int index = GetFPGAIndex();
|
||||
HAL_Report(HALUsageReporting::kResourceType_DutyCycle, index + 1);
|
||||
SendableRegistry::GetInstance().AddLW(this, "Duty Cycle", index);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "Duty Cycle", index);
|
||||
}
|
||||
|
||||
int DutyCycle::GetFPGAIndex() const {
|
||||
@@ -91,7 +91,7 @@ int DutyCycle::GetSourceChannel() const {
|
||||
return m_source->GetChannel();
|
||||
}
|
||||
|
||||
void DutyCycle::InitSendable(SendableBuilder& builder) {
|
||||
void DutyCycle::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Duty Cycle");
|
||||
builder.AddDoubleProperty(
|
||||
"Frequency", [this] { return this->GetFrequency(); }, nullptr);
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
#include "frc/DutyCycleEncoder.h"
|
||||
|
||||
#include <wpi/NullDeleter.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
|
||||
#include "frc/Counter.h"
|
||||
#include "frc/DigitalInput.h"
|
||||
#include "frc/DigitalSource.h"
|
||||
#include "frc/DutyCycle.h"
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -72,8 +72,8 @@ void DutyCycleEncoder::Init() {
|
||||
m_analogTrigger->CreateOutput(AnalogTriggerType::kFallingPulse));
|
||||
}
|
||||
|
||||
SendableRegistry::GetInstance().AddLW(this, "DutyCycle Encoder",
|
||||
m_dutyCycle->GetSourceChannel());
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "DutyCycle Encoder",
|
||||
m_dutyCycle->GetSourceChannel());
|
||||
}
|
||||
|
||||
units::turn_t DutyCycleEncoder::Get() const {
|
||||
@@ -148,7 +148,7 @@ int DutyCycleEncoder::GetSourceChannel() const {
|
||||
return m_dutyCycle->GetSourceChannel();
|
||||
}
|
||||
|
||||
void DutyCycleEncoder::InitSendable(SendableBuilder& builder) {
|
||||
void DutyCycleEncoder::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("AbsoluteEncoder");
|
||||
builder.AddDoubleProperty(
|
||||
"Distance", [this] { return this->GetDistance(); }, nullptr);
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
#include <hal/Encoder.h>
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/NullDeleter.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/DigitalInput.h"
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -22,7 +22,7 @@ Encoder::Encoder(int aChannel, int bChannel, bool reverseDirection,
|
||||
m_aSource = std::make_shared<DigitalInput>(aChannel);
|
||||
m_bSource = std::make_shared<DigitalInput>(bChannel);
|
||||
InitEncoder(reverseDirection, encodingType);
|
||||
auto& registry = SendableRegistry::GetInstance();
|
||||
auto& registry = wpi::SendableRegistry::GetInstance();
|
||||
registry.AddChild(this, m_aSource.get());
|
||||
registry.AddChild(this, m_bSource.get());
|
||||
}
|
||||
@@ -181,7 +181,7 @@ int Encoder::GetSamplesToAverage() const {
|
||||
void Encoder::SetIndexSource(int channel, Encoder::IndexingType type) {
|
||||
// Force digital input if just given an index
|
||||
m_indexSource = std::make_shared<DigitalInput>(channel);
|
||||
SendableRegistry::GetInstance().AddChild(this, m_indexSource.get());
|
||||
wpi::SendableRegistry::GetInstance().AddChild(this, m_indexSource.get());
|
||||
SetIndexSource(*m_indexSource.get(), type);
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ int Encoder::GetFPGAIndex() const {
|
||||
return val;
|
||||
}
|
||||
|
||||
void Encoder::InitSendable(SendableBuilder& builder) {
|
||||
void Encoder::InitSendable(wpi::SendableBuilder& builder) {
|
||||
int32_t status = 0;
|
||||
HAL_EncoderEncodingType type = HAL_GetEncoderEncodingType(m_encoder, &status);
|
||||
FRC_CheckErrorStatus(status, "{}", "GetEncodingType");
|
||||
@@ -240,8 +240,8 @@ void Encoder::InitEncoder(bool reverseDirection, EncodingType encodingType) {
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_Encoder, GetFPGAIndex() + 1,
|
||||
encodingType);
|
||||
SendableRegistry::GetInstance().AddLW(this, "Encoder",
|
||||
m_aSource->GetChannel());
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "Encoder",
|
||||
m_aSource->GetChannel());
|
||||
}
|
||||
|
||||
double Encoder::DecodingScaleFactor() const {
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
#include <hal/PWM.h>
|
||||
#include <hal/Ports.h>
|
||||
#include <wpi/StackTrace.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/SensorUtil.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -40,7 +40,7 @@ PWM::PWM(int channel, bool registerSendable) {
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_PWM, channel + 1);
|
||||
if (registerSendable) {
|
||||
SendableRegistry::GetInstance().AddLW(this, "PWM", channel);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "PWM", channel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ int PWM::GetChannel() const {
|
||||
return m_channel;
|
||||
}
|
||||
|
||||
void PWM::InitSendable(SendableBuilder& builder) {
|
||||
void PWM::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("PWM");
|
||||
builder.SetActuator(true);
|
||||
builder.SetSafeState([=] { SetDisabled(); });
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <hal/PDP.h>
|
||||
#include <hal/Ports.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/SensorUtil.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -24,7 +24,8 @@ PowerDistributionPanel::PowerDistributionPanel(int module) : m_module(module) {
|
||||
FRC_CheckErrorStatus(status, "Module {}", module);
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_PDP, module + 1);
|
||||
SendableRegistry::GetInstance().AddLW(this, "PowerDistributionPanel", module);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "PowerDistributionPanel",
|
||||
module);
|
||||
}
|
||||
|
||||
double PowerDistributionPanel::GetVoltage() const {
|
||||
@@ -93,7 +94,7 @@ int PowerDistributionPanel::GetModule() const {
|
||||
return m_module;
|
||||
}
|
||||
|
||||
void PowerDistributionPanel::InitSendable(SendableBuilder& builder) {
|
||||
void PowerDistributionPanel::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("PowerDistributionPanel");
|
||||
for (int i = 0; i < SensorUtil::kPDPChannels; ++i) {
|
||||
builder.AddDoubleProperty(
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
#include <hal/Ports.h>
|
||||
#include <hal/Relay.h>
|
||||
#include <wpi/StackTrace.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/SensorUtil.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -56,7 +56,7 @@ Relay::Relay(int channel, Relay::Direction direction)
|
||||
FRC_CheckErrorStatus(status, "Channel {}", m_channel);
|
||||
}
|
||||
|
||||
SendableRegistry::GetInstance().AddLW(this, "Relay", m_channel);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "Relay", m_channel);
|
||||
}
|
||||
|
||||
Relay::~Relay() {
|
||||
@@ -172,7 +172,7 @@ std::string Relay::GetDescription() const {
|
||||
return fmt::format("Relay {}", GetChannel());
|
||||
}
|
||||
|
||||
void Relay::InitSendable(SendableBuilder& builder) {
|
||||
void Relay::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Relay");
|
||||
builder.SetActuator(true);
|
||||
builder.SetSafeState([=] { Set(kOff); });
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
#include "frc/Servo.h"
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -25,7 +24,7 @@ Servo::Servo(int channel) : PWM(channel) {
|
||||
SetPeriodMultiplier(kPeriodMultiplier_4X);
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_Servo, channel + 1);
|
||||
SendableRegistry::GetInstance().SetName(this, "Servo", channel);
|
||||
wpi::SendableRegistry::GetInstance().SetName(this, "Servo", channel);
|
||||
}
|
||||
|
||||
void Servo::Set(double value) {
|
||||
@@ -62,7 +61,7 @@ double Servo::GetMinAngle() const {
|
||||
return kMinServoAngle;
|
||||
}
|
||||
|
||||
void Servo::InitSendable(SendableBuilder& builder) {
|
||||
void Servo::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Servo");
|
||||
builder.AddDoubleProperty(
|
||||
"Value", [=] { return Get(); }, [=](double value) { Set(value); });
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/NullDeleter.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/SensorUtil.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -36,8 +36,8 @@ Solenoid::Solenoid(std::shared_ptr<PneumaticsBase> module, int channel)
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_Solenoid, m_channel + 1,
|
||||
m_module->GetModuleNumber() + 1);
|
||||
SendableRegistry::GetInstance().AddLW(this, "Solenoid",
|
||||
m_module->GetModuleNumber(), m_channel);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(
|
||||
this, "Solenoid", m_module->GetModuleNumber(), m_channel);
|
||||
}
|
||||
|
||||
Solenoid::~Solenoid() {}
|
||||
@@ -72,7 +72,7 @@ void Solenoid::StartPulse() {
|
||||
m_module->FireOneShot(m_channel);
|
||||
}
|
||||
|
||||
void Solenoid::InitSendable(SendableBuilder& builder) {
|
||||
void Solenoid::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Solenoid");
|
||||
builder.SetActuator(true);
|
||||
builder.SetSafeState([=] { Set(false); });
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "frc/SpeedControllerGroup.h"
|
||||
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -20,11 +20,12 @@ SpeedControllerGroup::SpeedControllerGroup(
|
||||
|
||||
void SpeedControllerGroup::Initialize() {
|
||||
for (auto& speedController : m_speedControllers) {
|
||||
SendableRegistry::GetInstance().AddChild(this, &speedController.get());
|
||||
wpi::SendableRegistry::GetInstance().AddChild(this, &speedController.get());
|
||||
}
|
||||
static int instances = 0;
|
||||
++instances;
|
||||
SendableRegistry::GetInstance().Add(this, "SpeedControllerGroup", instances);
|
||||
wpi::SendableRegistry::GetInstance().Add(this, "SpeedControllerGroup",
|
||||
instances);
|
||||
}
|
||||
|
||||
void SpeedControllerGroup::Set(double speed) {
|
||||
@@ -60,7 +61,7 @@ void SpeedControllerGroup::StopMotor() {
|
||||
}
|
||||
}
|
||||
|
||||
void SpeedControllerGroup::InitSendable(SendableBuilder& builder) {
|
||||
void SpeedControllerGroup::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Speed Controller");
|
||||
builder.SetActuator(true);
|
||||
builder.SetSafeState([=] { StopMotor(); });
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/NullDeleter.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Counter.h"
|
||||
#include "frc/DigitalInput.h"
|
||||
#include "frc/DigitalOutput.h"
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/Timer.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -30,7 +30,7 @@ Ultrasonic::Ultrasonic(int pingChannel, int echoChannel)
|
||||
m_echoChannel(std::make_shared<DigitalInput>(echoChannel)),
|
||||
m_counter(m_echoChannel) {
|
||||
Initialize();
|
||||
auto& registry = SendableRegistry::GetInstance();
|
||||
auto& registry = wpi::SendableRegistry::GetInstance();
|
||||
registry.AddChild(this, m_pingChannel.get());
|
||||
registry.AddChild(this, m_echoChannel.get());
|
||||
}
|
||||
@@ -156,7 +156,7 @@ void Ultrasonic::SetEnabled(bool enable) {
|
||||
m_enabled = enable;
|
||||
}
|
||||
|
||||
void Ultrasonic::InitSendable(SendableBuilder& builder) {
|
||||
void Ultrasonic::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Ultrasonic");
|
||||
builder.AddDoubleProperty(
|
||||
"Value", [=] { return units::inch_t{GetRange()}.to<double>(); }, nullptr);
|
||||
@@ -185,8 +185,8 @@ void Ultrasonic::Initialize() {
|
||||
static int instances = 0;
|
||||
instances++;
|
||||
HAL_Report(HALUsageReporting::kResourceType_Ultrasonic, instances);
|
||||
SendableRegistry::GetInstance().AddLW(this, "Ultrasonic",
|
||||
m_echoChannel->GetChannel());
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, "Ultrasonic",
|
||||
m_echoChannel->GetChannel());
|
||||
}
|
||||
|
||||
void Ultrasonic::UltrasonicChecker() {
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include <cmath>
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/MathUtil.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc2;
|
||||
|
||||
@@ -31,7 +31,7 @@ PIDController::PIDController(double Kp, double Ki, double Kd,
|
||||
static int instances = 0;
|
||||
instances++;
|
||||
HAL_Report(HALUsageReporting::kResourceType_PIDController2, instances);
|
||||
frc::SendableRegistry::GetInstance().Add(this, "PIDController", instances);
|
||||
wpi::SendableRegistry::GetInstance().Add(this, "PIDController", instances);
|
||||
}
|
||||
|
||||
void PIDController::SetPID(double Kp, double Ki, double Kd) {
|
||||
@@ -161,7 +161,7 @@ void PIDController::Reset() {
|
||||
m_totalError = 0;
|
||||
}
|
||||
|
||||
void PIDController::InitSendable(frc::SendableBuilder& builder) {
|
||||
void PIDController::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("PIDController");
|
||||
builder.AddDoubleProperty(
|
||||
"p", [this] { return GetP(); }, [this](double value) { SetP(value); });
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
#include <cmath>
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/SpeedController.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -26,7 +26,7 @@ using namespace frc;
|
||||
DifferentialDrive::DifferentialDrive(SpeedController& leftMotor,
|
||||
SpeedController& rightMotor)
|
||||
: m_leftMotor(&leftMotor), m_rightMotor(&rightMotor) {
|
||||
auto& registry = SendableRegistry::GetInstance();
|
||||
auto& registry = wpi::SendableRegistry::GetInstance();
|
||||
registry.AddChild(this, m_leftMotor);
|
||||
registry.AddChild(this, m_rightMotor);
|
||||
static int instances = 0;
|
||||
@@ -193,7 +193,7 @@ std::string DifferentialDrive::GetDescription() const {
|
||||
return "DifferentialDrive";
|
||||
}
|
||||
|
||||
void DifferentialDrive::InitSendable(SendableBuilder& builder) {
|
||||
void DifferentialDrive::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("DifferentialDrive");
|
||||
builder.SetActuator(true);
|
||||
builder.SetSafeState([=] { StopMotor(); });
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/numbers>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/SpeedController.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -43,7 +43,7 @@ KilloughDrive::KilloughDrive(SpeedController& leftMotor,
|
||||
std::sin(rightMotorAngle * (wpi::numbers::pi / 180.0))};
|
||||
m_backVec = {std::cos(backMotorAngle * (wpi::numbers::pi / 180.0)),
|
||||
std::sin(backMotorAngle * (wpi::numbers::pi / 180.0))};
|
||||
auto& registry = SendableRegistry::GetInstance();
|
||||
auto& registry = wpi::SendableRegistry::GetInstance();
|
||||
registry.AddChild(this, m_leftMotor);
|
||||
registry.AddChild(this, m_rightMotor);
|
||||
registry.AddChild(this, m_backMotor);
|
||||
@@ -118,7 +118,7 @@ std::string KilloughDrive::GetDescription() const {
|
||||
return "KilloughDrive";
|
||||
}
|
||||
|
||||
void KilloughDrive::InitSendable(SendableBuilder& builder) {
|
||||
void KilloughDrive::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("KilloughDrive");
|
||||
builder.SetActuator(true);
|
||||
builder.SetSafeState([=] { StopMotor(); });
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <wpi/numbers>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/SpeedController.h"
|
||||
#include "frc/drive/Vector2d.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -33,7 +33,7 @@ MecanumDrive::MecanumDrive(SpeedController& frontLeftMotor,
|
||||
m_rearLeftMotor(&rearLeftMotor),
|
||||
m_frontRightMotor(&frontRightMotor),
|
||||
m_rearRightMotor(&rearRightMotor) {
|
||||
auto& registry = SendableRegistry::GetInstance();
|
||||
auto& registry = wpi::SendableRegistry::GetInstance();
|
||||
registry.AddChild(this, m_frontLeftMotor);
|
||||
registry.AddChild(this, m_rearLeftMotor);
|
||||
registry.AddChild(this, m_frontRightMotor);
|
||||
@@ -113,7 +113,7 @@ std::string MecanumDrive::GetDescription() const {
|
||||
return "MecanumDrive";
|
||||
}
|
||||
|
||||
void MecanumDrive::InitSendable(SendableBuilder& builder) {
|
||||
void MecanumDrive::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("MecanumDrive");
|
||||
builder.SetActuator(true);
|
||||
builder.SetSafeState([=] { StopMotor(); });
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
#include <networktables/NetworkTableEntry.h>
|
||||
#include <networktables/NetworkTableInstance.h>
|
||||
#include <wpi/mutex.h>
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableBuilderImpl.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -25,7 +25,7 @@ struct LiveWindow::Impl {
|
||||
|
||||
wpi::mutex mutex;
|
||||
|
||||
SendableRegistry& registry;
|
||||
wpi::SendableRegistry& registry;
|
||||
int dataHandle;
|
||||
|
||||
std::shared_ptr<nt::NetworkTable> liveWindowTable;
|
||||
@@ -36,20 +36,22 @@ struct LiveWindow::Impl {
|
||||
bool liveWindowEnabled = false;
|
||||
bool telemetryEnabled = true;
|
||||
|
||||
std::shared_ptr<Component> GetOrAdd(Sendable* sendable);
|
||||
std::shared_ptr<Component> GetOrAdd(wpi::Sendable* sendable);
|
||||
};
|
||||
|
||||
LiveWindow::Impl::Impl()
|
||||
: registry(SendableRegistry::GetInstance()),
|
||||
: registry(wpi::SendableRegistry::GetInstance()),
|
||||
dataHandle(registry.GetDataHandle()),
|
||||
liveWindowTable(
|
||||
nt::NetworkTableInstance::GetDefault().GetTable("LiveWindow")) {
|
||||
registry.SetLiveWindowBuilderFactory(
|
||||
[] { return std::make_unique<SendableBuilderImpl>(); });
|
||||
statusTable = liveWindowTable->GetSubTable(".status");
|
||||
enabledEntry = statusTable->GetEntry("LW Enabled");
|
||||
}
|
||||
|
||||
std::shared_ptr<LiveWindow::Impl::Component> LiveWindow::Impl::GetOrAdd(
|
||||
Sendable* sendable) {
|
||||
wpi::Sendable* sendable) {
|
||||
auto data = std::static_pointer_cast<Component>(
|
||||
registry.GetData(sendable, dataHandle));
|
||||
if (!data) {
|
||||
@@ -64,14 +66,14 @@ LiveWindow* LiveWindow::GetInstance() {
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void LiveWindow::EnableTelemetry(Sendable* sendable) {
|
||||
void LiveWindow::EnableTelemetry(wpi::Sendable* sendable) {
|
||||
std::scoped_lock lock(m_impl->mutex);
|
||||
// Re-enable global setting in case DisableAllTelemetry() was called.
|
||||
m_impl->telemetryEnabled = true;
|
||||
m_impl->GetOrAdd(sendable)->telemetryEnabled = true;
|
||||
}
|
||||
|
||||
void LiveWindow::DisableTelemetry(Sendable* sendable) {
|
||||
void LiveWindow::DisableTelemetry(wpi::Sendable* sendable) {
|
||||
std::scoped_lock lock(m_impl->mutex);
|
||||
m_impl->GetOrAdd(sendable)->telemetryEnabled = false;
|
||||
}
|
||||
@@ -108,7 +110,7 @@ void LiveWindow::SetEnabled(bool enabled) {
|
||||
}
|
||||
} else {
|
||||
m_impl->registry.ForeachLiveWindow(m_impl->dataHandle, [&](auto& cbdata) {
|
||||
cbdata.builder.StopLiveWindowMode();
|
||||
static_cast<SendableBuilderImpl&>(cbdata.builder).StopLiveWindowMode();
|
||||
});
|
||||
if (this->disabled) {
|
||||
this->disabled();
|
||||
@@ -160,7 +162,7 @@ void LiveWindow::UpdateValuesUnsafe() {
|
||||
table = ssTable->GetSubTable(cbdata.name);
|
||||
}
|
||||
table->GetEntry(".name").SetString(cbdata.name);
|
||||
cbdata.builder.SetTable(table);
|
||||
static_cast<SendableBuilderImpl&>(cbdata.builder).SetTable(table);
|
||||
cbdata.sendable->InitSendable(cbdata.builder);
|
||||
ssTable->GetEntry(".type").SetString("LW Subsystem");
|
||||
|
||||
@@ -168,9 +170,9 @@ void LiveWindow::UpdateValuesUnsafe() {
|
||||
}
|
||||
|
||||
if (m_impl->startLiveWindow) {
|
||||
cbdata.builder.StartLiveWindowMode();
|
||||
static_cast<SendableBuilderImpl&>(cbdata.builder).StartLiveWindowMode();
|
||||
}
|
||||
cbdata.builder.UpdateTable();
|
||||
cbdata.builder.Update();
|
||||
});
|
||||
|
||||
m_impl->startLiveWindow = false;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "frc/motorcontrol/MotorControllerGroup.h"
|
||||
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -20,11 +20,12 @@ MotorControllerGroup::MotorControllerGroup(
|
||||
|
||||
void MotorControllerGroup::Initialize() {
|
||||
for (auto& motorController : m_motorControllers) {
|
||||
SendableRegistry::GetInstance().AddChild(this, &motorController.get());
|
||||
wpi::SendableRegistry::GetInstance().AddChild(this, &motorController.get());
|
||||
}
|
||||
static int instances = 0;
|
||||
++instances;
|
||||
SendableRegistry::GetInstance().Add(this, "MotorControllerGroup", instances);
|
||||
wpi::SendableRegistry::GetInstance().Add(this, "MotorControllerGroup",
|
||||
instances);
|
||||
}
|
||||
|
||||
void MotorControllerGroup::Set(double speed) {
|
||||
@@ -60,7 +61,7 @@ void MotorControllerGroup::StopMotor() {
|
||||
}
|
||||
}
|
||||
|
||||
void MotorControllerGroup::InitSendable(SendableBuilder& builder) {
|
||||
void MotorControllerGroup::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Motor Controller");
|
||||
builder.SetActuator(true);
|
||||
builder.SetSafeState([=] { StopMotor(); });
|
||||
|
||||
@@ -6,15 +6,14 @@
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
NidecBrushless::NidecBrushless(int pwmChannel, int dioChannel)
|
||||
: m_dio(dioChannel), m_pwm(pwmChannel) {
|
||||
auto& registry = SendableRegistry::GetInstance();
|
||||
auto& registry = wpi::SendableRegistry::GetInstance();
|
||||
registry.AddChild(this, &m_dio);
|
||||
registry.AddChild(this, &m_pwm);
|
||||
SetExpiration(0_s);
|
||||
@@ -72,7 +71,7 @@ int NidecBrushless::GetChannel() const {
|
||||
return m_pwm.GetChannel();
|
||||
}
|
||||
|
||||
void NidecBrushless::InitSendable(SendableBuilder& builder) {
|
||||
void NidecBrushless::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Nidec Brushless");
|
||||
builder.SetActuator(true);
|
||||
builder.SetSafeState([=] { StopMotor(); });
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include "frc/motorcontrol/PWMMotorController.h"
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -44,10 +44,10 @@ int PWMMotorController::GetChannel() const {
|
||||
|
||||
PWMMotorController::PWMMotorController(std::string_view name, int channel)
|
||||
: m_pwm(channel, false) {
|
||||
SendableRegistry::GetInstance().AddLW(this, name, channel);
|
||||
wpi::SendableRegistry::GetInstance().AddLW(this, name, channel);
|
||||
}
|
||||
|
||||
void PWMMotorController::InitSendable(SendableBuilder& builder) {
|
||||
void PWMMotorController::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Motor Controller");
|
||||
builder.SetActuator(true);
|
||||
builder.SetSafeState([=] { Disable(); });
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
PWMSparkMax::PWMSparkMax(int channel)
|
||||
|
||||
@@ -4,36 +4,41 @@
|
||||
|
||||
#include "frc/shuffleboard/ComplexWidget.h"
|
||||
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
|
||||
#include "frc/smartdashboard/SendableBuilderImpl.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
ComplexWidget::ComplexWidget(ShuffleboardContainer& parent,
|
||||
std::string_view title, Sendable& sendable)
|
||||
std::string_view title, wpi::Sendable& sendable)
|
||||
: ShuffleboardValue(title),
|
||||
ShuffleboardWidget(parent, title),
|
||||
m_sendable(sendable) {}
|
||||
|
||||
ComplexWidget::~ComplexWidget() = default;
|
||||
|
||||
void ComplexWidget::EnableIfActuator() {
|
||||
if (m_builder.IsActuator()) {
|
||||
m_builder.StartLiveWindowMode();
|
||||
if (m_builder && static_cast<SendableBuilderImpl&>(*m_builder).IsActuator()) {
|
||||
static_cast<SendableBuilderImpl&>(*m_builder).StartLiveWindowMode();
|
||||
}
|
||||
}
|
||||
|
||||
void ComplexWidget::DisableIfActuator() {
|
||||
if (m_builder.IsActuator()) {
|
||||
m_builder.StopLiveWindowMode();
|
||||
if (m_builder && static_cast<SendableBuilderImpl&>(*m_builder).IsActuator()) {
|
||||
static_cast<SendableBuilderImpl&>(*m_builder).StopLiveWindowMode();
|
||||
}
|
||||
}
|
||||
|
||||
void ComplexWidget::BuildInto(std::shared_ptr<nt::NetworkTable> parentTable,
|
||||
std::shared_ptr<nt::NetworkTable> metaTable) {
|
||||
BuildMetadata(metaTable);
|
||||
if (!m_builderInit) {
|
||||
m_builder.SetTable(parentTable->GetSubTable(GetTitle()));
|
||||
m_sendable.InitSendable(m_builder);
|
||||
m_builder.StartListeners();
|
||||
m_builderInit = true;
|
||||
if (!m_builder) {
|
||||
m_builder = std::make_unique<SendableBuilderImpl>();
|
||||
static_cast<SendableBuilderImpl&>(*m_builder)
|
||||
.SetTable(parentTable->GetSubTable(GetTitle()));
|
||||
m_sendable.InitSendable(static_cast<SendableBuilderImpl&>(*m_builder));
|
||||
static_cast<SendableBuilderImpl&>(*m_builder).StartListeners();
|
||||
}
|
||||
m_builder.UpdateTable();
|
||||
m_builder->Update();
|
||||
}
|
||||
|
||||
@@ -9,9 +9,8 @@
|
||||
#include <string>
|
||||
|
||||
#include <wpi/DenseMap.h>
|
||||
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
namespace frc {
|
||||
namespace detail {
|
||||
@@ -21,12 +20,12 @@ std::shared_ptr<SendableCameraWrapper>& GetSendableCameraWrapper(
|
||||
return wrappers[static_cast<int>(source)];
|
||||
}
|
||||
|
||||
void AddToSendableRegistry(frc::Sendable* sendable, std::string name) {
|
||||
SendableRegistry::GetInstance().Add(sendable, name);
|
||||
void AddToSendableRegistry(wpi::Sendable* sendable, std::string name) {
|
||||
wpi::SendableRegistry::GetInstance().Add(sendable, name);
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
void SendableCameraWrapper::InitSendable(SendableBuilder& builder) {
|
||||
void SendableCameraWrapper::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.AddStringProperty(
|
||||
".ShuffleboardURI", [this] { return m_uri; }, nullptr);
|
||||
}
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
|
||||
#include "frc/shuffleboard/ShuffleboardContainer.h"
|
||||
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/shuffleboard/ComplexWidget.h"
|
||||
#include "frc/shuffleboard/ShuffleboardComponent.h"
|
||||
#include "frc/shuffleboard/ShuffleboardLayout.h"
|
||||
#include "frc/shuffleboard/SimpleWidget.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -57,7 +58,7 @@ ShuffleboardLayout& ShuffleboardContainer::GetLayout(std::string_view title) {
|
||||
}
|
||||
|
||||
ComplexWidget& ShuffleboardContainer::Add(std::string_view title,
|
||||
Sendable& sendable) {
|
||||
wpi::Sendable& sendable) {
|
||||
CheckTitle(title);
|
||||
auto widget = std::make_unique<ComplexWidget>(*this, title, sendable);
|
||||
auto ptr = widget.get();
|
||||
@@ -65,8 +66,8 @@ ComplexWidget& ShuffleboardContainer::Add(std::string_view title,
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
ComplexWidget& ShuffleboardContainer::Add(Sendable& sendable) {
|
||||
auto name = SendableRegistry::GetInstance().GetName(&sendable);
|
||||
ComplexWidget& ShuffleboardContainer::Add(wpi::Sendable& sendable) {
|
||||
auto name = wpi::SendableRegistry::GetInstance().GetName(&sendable);
|
||||
if (name.empty()) {
|
||||
FRC_ReportError(err::Error, "{}", "Sendable must have a name");
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "frc/smartdashboard/Field2d.h"
|
||||
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
#include <networktables/NTSendableBuilder.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -13,7 +13,7 @@ Field2d::Field2d() {
|
||||
m_objects.emplace_back(
|
||||
std::make_unique<FieldObject2d>("Robot", FieldObject2d::private_init{}));
|
||||
m_objects[0]->SetPose(Pose2d{});
|
||||
SendableRegistry::GetInstance().Add(this, "Field");
|
||||
wpi::SendableRegistry::GetInstance().Add(this, "Field");
|
||||
}
|
||||
|
||||
Field2d::Field2d(Field2d&& rhs) : SendableHelper(std::move(rhs)) {
|
||||
@@ -67,7 +67,7 @@ FieldObject2d* Field2d::GetRobotObject() {
|
||||
return m_objects[0].get();
|
||||
}
|
||||
|
||||
void Field2d::InitSendable(SendableBuilder& builder) {
|
||||
void Field2d::InitSendable(nt::NTSendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Field2d");
|
||||
m_table = builder.GetTable();
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
#include <networktables/NTSendableBuilder.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -41,7 +41,7 @@ void Mechanism2d::SetBackgroundColor(const Color8Bit& color) {
|
||||
}
|
||||
}
|
||||
|
||||
void Mechanism2d::InitSendable(SendableBuilder& builder) {
|
||||
void Mechanism2d::InitSendable(nt::NTSendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Mechanism2d");
|
||||
m_table = builder.GetTable();
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
#include "frc/smartdashboard/MechanismRoot2d.h"
|
||||
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
#include "frc/util/Color8Bit.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -20,7 +20,7 @@ std::shared_ptr<nt::NetworkTable> SendableBuilderImpl::GetTable() {
|
||||
return m_table;
|
||||
}
|
||||
|
||||
bool SendableBuilderImpl::HasTable() const {
|
||||
bool SendableBuilderImpl::IsPublished() const {
|
||||
return m_table != nullptr;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ bool SendableBuilderImpl::IsActuator() const {
|
||||
return m_actuator;
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::UpdateTable() {
|
||||
void SendableBuilderImpl::Update() {
|
||||
uint64_t time = nt::Now();
|
||||
for (auto& property : m_properties) {
|
||||
if (property.update) {
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
|
||||
#include "frc/smartdashboard/SendableChooserBase.h"
|
||||
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
std::atomic_int SendableChooserBase::s_instances{0};
|
||||
|
||||
SendableChooserBase::SendableChooserBase() : m_instance{s_instances++} {
|
||||
SendableRegistry::GetInstance().Add(this, "SendableChooser", m_instance);
|
||||
wpi::SendableRegistry::GetInstance().Add(this, "SendableChooser", m_instance);
|
||||
}
|
||||
|
||||
SendableChooserBase::SendableChooserBase(SendableChooserBase&& oth)
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
#include <networktables/NetworkTableInstance.h>
|
||||
#include <wpi/StringMap.h>
|
||||
#include <wpi/mutex.h>
|
||||
#include <wpi/sendable/SendableRegistry.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
#include "frc/smartdashboard/SendableBuilderImpl.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -21,7 +22,7 @@ class Singleton {
|
||||
static Singleton& GetInstance();
|
||||
|
||||
std::shared_ptr<nt::NetworkTable> table;
|
||||
wpi::StringMap<SendableRegistry::UID> tablesToData;
|
||||
wpi::StringMap<wpi::SendableRegistry::UID> tablesToData;
|
||||
wpi::mutex tablesToDataMutex;
|
||||
|
||||
private:
|
||||
@@ -84,41 +85,45 @@ nt::NetworkTableEntry SmartDashboard::GetEntry(std::string_view key) {
|
||||
return Singleton::GetInstance().table->GetEntry(key);
|
||||
}
|
||||
|
||||
void SmartDashboard::PutData(std::string_view key, Sendable* data) {
|
||||
void SmartDashboard::PutData(std::string_view key, wpi::Sendable* data) {
|
||||
if (!data) {
|
||||
throw FRC_MakeError(err::NullParameter, "{}", "value");
|
||||
}
|
||||
auto& inst = Singleton::GetInstance();
|
||||
std::scoped_lock lock(inst.tablesToDataMutex);
|
||||
auto& uid = inst.tablesToData[key];
|
||||
auto& registry = SendableRegistry::GetInstance();
|
||||
Sendable* sddata = registry.GetSendable(uid);
|
||||
auto& registry = wpi::SendableRegistry::GetInstance();
|
||||
wpi::Sendable* sddata = registry.GetSendable(uid);
|
||||
if (sddata != data) {
|
||||
uid = registry.GetUniqueId(data);
|
||||
auto dataTable = inst.table->GetSubTable(key);
|
||||
registry.Publish(uid, dataTable);
|
||||
auto builder = std::make_unique<SendableBuilderImpl>();
|
||||
auto builderPtr = builder.get();
|
||||
builderPtr->SetTable(dataTable);
|
||||
registry.Publish(uid, std::move(builder));
|
||||
builderPtr->StartListeners();
|
||||
dataTable->GetEntry(".name").SetString(key);
|
||||
}
|
||||
}
|
||||
|
||||
void SmartDashboard::PutData(Sendable* value) {
|
||||
void SmartDashboard::PutData(wpi::Sendable* value) {
|
||||
if (!value) {
|
||||
throw FRC_MakeError(err::NullParameter, "{}", "value");
|
||||
}
|
||||
auto name = SendableRegistry::GetInstance().GetName(value);
|
||||
auto name = wpi::SendableRegistry::GetInstance().GetName(value);
|
||||
if (!name.empty()) {
|
||||
PutData(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
Sendable* SmartDashboard::GetData(std::string_view key) {
|
||||
wpi::Sendable* SmartDashboard::GetData(std::string_view key) {
|
||||
auto& inst = Singleton::GetInstance();
|
||||
std::scoped_lock lock(inst.tablesToDataMutex);
|
||||
auto it = inst.tablesToData.find(key);
|
||||
if (it == inst.tablesToData.end()) {
|
||||
throw FRC_MakeError(err::SmartDashboardMissingKey, "{}", key);
|
||||
}
|
||||
return SendableRegistry::GetInstance().GetSendable(it->getValue());
|
||||
return wpi::SendableRegistry::GetInstance().GetSendable(it->getValue());
|
||||
}
|
||||
|
||||
bool SmartDashboard::PutBoolean(std::string_view keyName, bool value) {
|
||||
@@ -257,7 +262,7 @@ void SmartDashboard::PostListenerTask(std::function<void()> task) {
|
||||
}
|
||||
|
||||
void SmartDashboard::UpdateValues() {
|
||||
auto& registry = SendableRegistry::GetInstance();
|
||||
auto& registry = wpi::SendableRegistry::GetInstance();
|
||||
auto& inst = Singleton::GetInstance();
|
||||
listenerExecutor.RunListenerTasks();
|
||||
std::scoped_lock lock(inst.tablesToDataMutex);
|
||||
|
||||
@@ -5,16 +5,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <hal/SimDevice.h>
|
||||
#include <networktables/NTSendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
#include "frc/I2C.h"
|
||||
#include "frc/interfaces/Accelerometer.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class SendableBuilder;
|
||||
|
||||
/**
|
||||
* ADXL345 Accelerometer on I2C.
|
||||
*
|
||||
@@ -23,8 +21,8 @@ class SendableBuilder;
|
||||
* 0x1D (7-bit address).
|
||||
*/
|
||||
class ADXL345_I2C : public Accelerometer,
|
||||
public Sendable,
|
||||
public SendableHelper<ADXL345_I2C> {
|
||||
public nt::NTSendable,
|
||||
public wpi::SendableHelper<ADXL345_I2C> {
|
||||
public:
|
||||
enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 };
|
||||
|
||||
@@ -70,7 +68,7 @@ class ADXL345_I2C : public Accelerometer,
|
||||
*/
|
||||
virtual AllAxes GetAccelerations();
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(nt::NTSendableBuilder& builder) override;
|
||||
|
||||
protected:
|
||||
I2C m_i2c;
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <hal/SimDevice.h>
|
||||
#include <networktables/NTSendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
#include "frc/SPI.h"
|
||||
#include "frc/interfaces/Accelerometer.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace frc {
|
||||
* via SPI. This class assumes the sensor is wired in 4-wire SPI mode.
|
||||
*/
|
||||
class ADXL345_SPI : public Accelerometer,
|
||||
public Sendable,
|
||||
public SendableHelper<ADXL345_SPI> {
|
||||
public nt::NTSendable,
|
||||
public wpi::SendableHelper<ADXL345_SPI> {
|
||||
public:
|
||||
enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 };
|
||||
|
||||
@@ -66,7 +66,7 @@ class ADXL345_SPI : public Accelerometer,
|
||||
*/
|
||||
virtual AllAxes GetAccelerations();
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(nt::NTSendableBuilder& builder) override;
|
||||
|
||||
protected:
|
||||
SPI m_spi;
|
||||
|
||||
@@ -5,24 +5,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <hal/SimDevice.h>
|
||||
#include <networktables/NTSendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
#include "frc/SPI.h"
|
||||
#include "frc/interfaces/Accelerometer.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class SendableBuilder;
|
||||
|
||||
/**
|
||||
* ADXL362 SPI Accelerometer.
|
||||
*
|
||||
* This class allows access to an Analog Devices ADXL362 3-axis accelerometer.
|
||||
*/
|
||||
class ADXL362 : public Accelerometer,
|
||||
public Sendable,
|
||||
public SendableHelper<ADXL362> {
|
||||
public nt::NTSendable,
|
||||
public wpi::SendableHelper<ADXL362> {
|
||||
public:
|
||||
enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 };
|
||||
struct AllAxes {
|
||||
@@ -74,7 +72,7 @@ class ADXL362 : public Accelerometer,
|
||||
*/
|
||||
virtual AllAxes GetAccelerations();
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(nt::NTSendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
SPI m_spi;
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <hal/SimDevice.h>
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
#include "frc/SPI.h"
|
||||
#include "frc/interfaces/Gyro.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace frc {
|
||||
* Only one instance of an ADXRS Gyro is supported.
|
||||
*/
|
||||
class ADXRS450_Gyro : public Gyro,
|
||||
public Sendable,
|
||||
public SendableHelper<ADXRS450_Gyro> {
|
||||
public wpi::Sendable,
|
||||
public wpi::SendableHelper<ADXRS450_Gyro> {
|
||||
public:
|
||||
/**
|
||||
* Gyro constructor on onboard CS0.
|
||||
@@ -100,7 +100,7 @@ class ADXRS450_Gyro : public Gyro,
|
||||
*/
|
||||
int GetPort() const;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
SPI m_spi;
|
||||
|
||||
@@ -6,14 +6,13 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
#include "frc/AnalogInput.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class SendableBuilder;
|
||||
|
||||
/**
|
||||
* Handle operation of an analog accelerometer.
|
||||
*
|
||||
@@ -21,8 +20,8 @@ class SendableBuilder;
|
||||
* sensors have multiple axis and can be treated as multiple devices. Each is
|
||||
* calibrated by finding the center value over a period of time.
|
||||
*/
|
||||
class AnalogAccelerometer : public Sendable,
|
||||
public SendableHelper<AnalogAccelerometer> {
|
||||
class AnalogAccelerometer : public wpi::Sendable,
|
||||
public wpi::SendableHelper<AnalogAccelerometer> {
|
||||
public:
|
||||
/**
|
||||
* Create a new instance of an accelerometer.
|
||||
@@ -93,7 +92,7 @@ class AnalogAccelerometer : public Sendable,
|
||||
*/
|
||||
void SetZero(double zero);
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
#include <hal/SimDevice.h>
|
||||
#include <hal/Types.h>
|
||||
#include <units/angle.h>
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
#include "frc/AnalogTrigger.h"
|
||||
#include "frc/Counter.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
class AnalogInput;
|
||||
@@ -21,7 +21,8 @@ class AnalogInput;
|
||||
/**
|
||||
* Class for supporting continuous analog encoders, such as the US Digital MA3.
|
||||
*/
|
||||
class AnalogEncoder : public Sendable, public SendableHelper<AnalogEncoder> {
|
||||
class AnalogEncoder : public wpi::Sendable,
|
||||
public wpi::SendableHelper<AnalogEncoder> {
|
||||
public:
|
||||
/**
|
||||
* Construct a new AnalogEncoder attached to a specific AnalogIn channel.
|
||||
@@ -116,7 +117,7 @@ class AnalogEncoder : public Sendable, public SendableHelper<AnalogEncoder> {
|
||||
*/
|
||||
int GetChannel() const;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
#include <memory>
|
||||
|
||||
#include <hal/Types.h>
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
#include "frc/interfaces/Gyro.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -30,8 +30,8 @@ class AnalogInput;
|
||||
* This class is for gyro sensors that connect to an analog input.
|
||||
*/
|
||||
class AnalogGyro : public Gyro,
|
||||
public Sendable,
|
||||
public SendableHelper<AnalogGyro> {
|
||||
public wpi::Sendable,
|
||||
public wpi::SendableHelper<AnalogGyro> {
|
||||
public:
|
||||
static constexpr int kOversampleBits = 10;
|
||||
static constexpr int kAverageBits = 0;
|
||||
@@ -192,7 +192,7 @@ class AnalogGyro : public Gyro,
|
||||
*/
|
||||
std::shared_ptr<AnalogInput> GetAnalogInput() const;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<AnalogInput> m_analog;
|
||||
|
||||
@@ -7,13 +7,11 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <hal/Types.h>
|
||||
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
namespace frc {
|
||||
|
||||
class SendableBuilder;
|
||||
class DMA;
|
||||
class DMASample;
|
||||
|
||||
@@ -29,7 +27,8 @@ class DMASample;
|
||||
* are divided by the number of samples to retain the resolution, but get more
|
||||
* stable values.
|
||||
*/
|
||||
class AnalogInput : public Sendable, public SendableHelper<AnalogInput> {
|
||||
class AnalogInput : public wpi::Sendable,
|
||||
public wpi::SendableHelper<AnalogInput> {
|
||||
friend class AnalogTrigger;
|
||||
friend class AnalogGyro;
|
||||
friend class DMA;
|
||||
@@ -282,7 +281,7 @@ class AnalogInput : public Sendable, public SendableHelper<AnalogInput> {
|
||||
*/
|
||||
void SetSimDevice(HAL_SimDeviceHandle device);
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
int m_channel;
|
||||
|
||||
@@ -5,18 +5,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <hal/Types.h>
|
||||
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
namespace frc {
|
||||
|
||||
class SendableBuilder;
|
||||
|
||||
/**
|
||||
* MXP analog output class.
|
||||
*/
|
||||
class AnalogOutput : public Sendable, public SendableHelper<AnalogOutput> {
|
||||
class AnalogOutput : public wpi::Sendable,
|
||||
public wpi::SendableHelper<AnalogOutput> {
|
||||
public:
|
||||
/**
|
||||
* Construct an analog output on the given channel.
|
||||
@@ -51,7 +49,7 @@ class AnalogOutput : public Sendable, public SendableHelper<AnalogOutput> {
|
||||
*/
|
||||
int GetChannel() const;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
protected:
|
||||
int m_channel;
|
||||
|
||||
@@ -6,22 +6,21 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
#include "frc/AnalogInput.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class SendableBuilder;
|
||||
|
||||
/**
|
||||
* Class for reading analog potentiometers. Analog potentiometers read in an
|
||||
* analog voltage that corresponds to a position. The position is in whichever
|
||||
* units you choose, by way of the scaling and offset constants passed to the
|
||||
* constructor.
|
||||
*/
|
||||
class AnalogPotentiometer : public Sendable,
|
||||
public SendableHelper<AnalogPotentiometer> {
|
||||
class AnalogPotentiometer : public wpi::Sendable,
|
||||
public wpi::SendableHelper<AnalogPotentiometer> {
|
||||
public:
|
||||
/**
|
||||
* Construct an Analog Potentiometer object from a channel number.
|
||||
@@ -103,7 +102,7 @@ class AnalogPotentiometer : public Sendable,
|
||||
*/
|
||||
double Get() const;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<AnalogInput> m_analog_input;
|
||||
|
||||
@@ -7,18 +7,18 @@
|
||||
#include <memory>
|
||||
|
||||
#include <hal/Types.h>
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
#include "frc/AnalogTriggerOutput.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class AnalogInput;
|
||||
class DutyCycle;
|
||||
class SendableBuilder;
|
||||
|
||||
class AnalogTrigger : public Sendable, public SendableHelper<AnalogTrigger> {
|
||||
class AnalogTrigger : public wpi::Sendable,
|
||||
public wpi::SendableHelper<AnalogTrigger> {
|
||||
friend class AnalogTriggerOutput;
|
||||
|
||||
public:
|
||||
@@ -148,7 +148,7 @@ class AnalogTrigger : public Sendable, public SendableHelper<AnalogTrigger> {
|
||||
std::shared_ptr<AnalogTriggerOutput> CreateOutput(
|
||||
AnalogTriggerType type) const;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
int GetSourceChannel() const;
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
#include "frc/DigitalSource.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -44,8 +45,8 @@ class AnalogTrigger;
|
||||
* may help with this, but rotational speeds of the sensor will then be limited.
|
||||
*/
|
||||
class AnalogTriggerOutput : public DigitalSource,
|
||||
public Sendable,
|
||||
public SendableHelper<AnalogTriggerOutput> {
|
||||
public wpi::Sendable,
|
||||
public wpi::SendableHelper<AnalogTriggerOutput> {
|
||||
friend class AnalogTrigger;
|
||||
|
||||
public:
|
||||
@@ -77,7 +78,7 @@ class AnalogTriggerOutput : public DigitalSource,
|
||||
*/
|
||||
int GetChannel() const override;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
||||
@@ -4,22 +4,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
#include "frc/interfaces/Accelerometer.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class SendableBuilder;
|
||||
|
||||
/**
|
||||
* Built-in accelerometer.
|
||||
*
|
||||
* This class allows access to the roboRIO's internal accelerometer.
|
||||
*/
|
||||
class BuiltInAccelerometer : public Accelerometer,
|
||||
public Sendable,
|
||||
public SendableHelper<BuiltInAccelerometer> {
|
||||
public wpi::Sendable,
|
||||
public wpi::SendableHelper<BuiltInAccelerometer> {
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -56,7 +55,7 @@ class BuiltInAccelerometer : public Accelerometer,
|
||||
*/
|
||||
double GetZ() override;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -8,16 +8,15 @@
|
||||
|
||||
#include <hal/Types.h>
|
||||
#include <units/time.h>
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
#include "frc/AnalogTrigger.h"
|
||||
#include "frc/CounterBase.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class DigitalGlitchFilter;
|
||||
class SendableBuilder;
|
||||
class DMA;
|
||||
class DMASample;
|
||||
|
||||
@@ -32,8 +31,8 @@ class DMASample;
|
||||
* to be zeroed before use.
|
||||
*/
|
||||
class Counter : public CounterBase,
|
||||
public Sendable,
|
||||
public SendableHelper<Counter> {
|
||||
public wpi::Sendable,
|
||||
public wpi::SendableHelper<Counter> {
|
||||
friend class DMA;
|
||||
friend class DMASample;
|
||||
|
||||
@@ -421,7 +420,7 @@ class Counter : public CounterBase,
|
||||
*/
|
||||
bool GetDirection() const override;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
protected:
|
||||
// Makes the counter count up.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user