SCRIPT namespace replacements

This commit is contained in:
PJ Reiniger
2025-11-07 20:00:05 -05:00
committed by Peter Johnson
parent ae6c043632
commit 9aca8e0fd6
2622 changed files with 22275 additions and 22275 deletions

View File

@@ -6,7 +6,7 @@
#include "wpi/hal/DriverStation.h"
using namespace frc;
using namespace wpi;
DSControlWord::DSControlWord() {
HAL_GetControlWord(&m_controlWord);

View File

@@ -33,7 +33,7 @@
#include "wpi/util/mutex.hpp"
#include "wpi/util/timestamp.h"
using namespace frc;
using namespace wpi;
static constexpr int availableToCount(uint64_t available) {
return 64 - std::countl_zero(available);
@@ -45,10 +45,10 @@ namespace {
template <typename Topic>
class MatchDataSenderEntry {
public:
MatchDataSenderEntry(const std::shared_ptr<nt::NetworkTable>& table,
MatchDataSenderEntry(const std::shared_ptr<wpi::nt::NetworkTable>& table,
std::string_view key,
typename Topic::ParamType initialVal,
wpi::json topicProperties = wpi::json::object())
wpi::util::json topicProperties = wpi::util::json::object())
: publisher{Topic{table->GetTopic(key)}.PublishEx(Topic::kTypeString,
topicProperties)},
prevVal{initialVal} {
@@ -70,22 +70,22 @@ class MatchDataSenderEntry {
static constexpr std::string_view kSmartDashboardType = "FMSInfo";
struct MatchDataSender {
std::shared_ptr<nt::NetworkTable> table =
nt::NetworkTableInstance::GetDefault().GetTable("FMSInfo");
MatchDataSenderEntry<nt::StringTopic> typeMetaData{
std::shared_ptr<wpi::nt::NetworkTable> table =
wpi::nt::NetworkTableInstance::GetDefault().GetTable("FMSInfo");
MatchDataSenderEntry<wpi::nt::StringTopic> typeMetaData{
table,
".type",
kSmartDashboardType,
{{"SmartDashboard", kSmartDashboardType}}};
MatchDataSenderEntry<nt::StringTopic> gameSpecificMessage{
MatchDataSenderEntry<wpi::nt::StringTopic> gameSpecificMessage{
table, "GameSpecificMessage", ""};
MatchDataSenderEntry<nt::StringTopic> eventName{table, "EventName", ""};
MatchDataSenderEntry<nt::IntegerTopic> matchNumber{table, "MatchNumber", 0};
MatchDataSenderEntry<nt::IntegerTopic> replayNumber{table, "ReplayNumber", 0};
MatchDataSenderEntry<nt::IntegerTopic> matchType{table, "MatchType", 0};
MatchDataSenderEntry<nt::BooleanTopic> alliance{table, "IsRedAlliance", true};
MatchDataSenderEntry<nt::IntegerTopic> station{table, "StationNumber", 1};
MatchDataSenderEntry<nt::IntegerTopic> controlWord{table, "FMSControlData",
MatchDataSenderEntry<wpi::nt::StringTopic> eventName{table, "EventName", ""};
MatchDataSenderEntry<wpi::nt::IntegerTopic> matchNumber{table, "MatchNumber", 0};
MatchDataSenderEntry<wpi::nt::IntegerTopic> replayNumber{table, "ReplayNumber", 0};
MatchDataSenderEntry<wpi::nt::IntegerTopic> matchType{table, "MatchType", 0};
MatchDataSenderEntry<wpi::nt::BooleanTopic> alliance{table, "IsRedAlliance", true};
MatchDataSenderEntry<wpi::nt::IntegerTopic> station{table, "StationNumber", 1};
MatchDataSenderEntry<wpi::nt::IntegerTopic> controlWord{table, "FMSControlData",
0};
};
@@ -129,12 +129,12 @@ struct Instance {
Instance();
~Instance();
wpi::EventVector refreshEvents;
wpi::util::EventVector refreshEvents;
MatchDataSender matchDataSender;
std::atomic<DataLogSender*> dataLogSender{nullptr};
// Joystick button rising/falling edge flags
wpi::mutex buttonEdgeMutex;
wpi::util::mutex buttonEdgeMutex;
std::array<HAL_JoystickButtons, DriverStation::kJoystickPorts>
previousButtonStates;
std::array<uint32_t, DriverStation::kJoystickPorts> joystickButtonsPressed;
@@ -148,7 +148,7 @@ struct Instance {
bool userInTeleop = false;
bool userInTest = false;
units::second_t nextMessageTime = 0_s;
wpi::units::second_t nextMessageTime = 0_s;
};
} // namespace
@@ -624,9 +624,9 @@ std::optional<int> DriverStation::GetLocation() {
}
}
units::second_t DriverStation::GetMatchTime() {
wpi::units::second_t DriverStation::GetMatchTime() {
int32_t status = 0;
return units::second_t{HAL_GetMatchTime(&status)};
return wpi::units::second_t{HAL_GetMatchTime(&status)};
}
double DriverStation::GetBatteryVoltage() {
@@ -670,7 +670,7 @@ void DriverStation::RefreshData() {
SendMatchData();
if (auto sender = inst.dataLogSender.load()) {
sender->Send(wpi::Now());
sender->Send(wpi::util::Now());
}
}
@@ -706,7 +706,7 @@ void DriverStation::StartDataLog(wpi::log::DataLog& log, bool logJoysticks) {
if (oldSender) {
delete newSender; // already had a sender
} else {
newSender->Init(log, logJoysticks, wpi::Now());
newSender->Init(log, logJoysticks, wpi::util::Now());
}
}

View File

@@ -8,7 +8,7 @@
#include "wpi/hal/UsageReporting.h"
#include "wpi/util/sendable/SendableBuilder.hpp"
using namespace frc;
using namespace wpi;
Gamepad::Gamepad(int port) : GenericHID(port) {
HAL_ReportUsage("HID", port, "Gamepad");
@@ -484,7 +484,7 @@ bool Gamepad::GetButtonForSendable(int button) const {
.value_or(false);
}
void Gamepad::InitSendable(wpi::SendableBuilder& builder) {
void Gamepad::InitSendable(wpi::util::SendableBuilder& builder) {
builder.SetSmartDashboardType("HID");
builder.PublishConstString("ControllerType", "Gamepad");
builder.AddDoubleProperty(

View File

@@ -11,7 +11,7 @@
#include "wpi/hal/DriverStation.h"
#include "wpi/system/Errors.hpp"
using namespace frc;
using namespace wpi;
GenericHID::GenericHID(int port) {
if (port < 0 || port >= DriverStation::kJoystickPorts) {

View File

@@ -9,7 +9,7 @@
#include "wpi/event/BooleanEvent.hpp"
#include "wpi/hal/UsageReporting.h"
using namespace frc;
using namespace wpi;
Joystick::Joystick(int port) : GenericHID(port) {
m_axes[Axis::kX] = kDefaultXChannel;
@@ -117,7 +117,7 @@ double Joystick::GetMagnitude() const {
return std::hypot(GetX(), GetY());
}
units::radian_t Joystick::GetDirection() const {
wpi::units::radian_t Joystick::GetDirection() const {
// https://docs.wpilib.org/en/stable/docs/software/basic-programming/coordinate-system.html#joystick-and-controller-coordinate-system
// A positive rotation around the X axis moves the joystick right, and a
// positive rotation around the Y axis moves the joystick backward. When
@@ -126,5 +126,5 @@ units::radian_t Joystick::GetDirection() const {
//
// It's rotated 90 degrees CCW (y is negated and the arguments are reversed)
// so that 0 radians is forward.
return units::radian_t{std::atan2(GetX(), -GetY())};
return wpi::units::radian_t{std::atan2(GetX(), -GetY())};
}