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

@@ -3,23 +3,23 @@
#ifndef __FRC_SYSTEMCORE__
namespace frc::impl {
namespace wpi::impl {
void ResetSmartDashboardInstance();
void ResetMotorSafety();
} // namespace frc::impl
} // namespace wpi::impl
namespace wpi::impl {
void ResetSendableRegistry();
} // namespace wpi::impl
void resetWpilibSimulationData() {
frc::impl::ResetSmartDashboardInstance();
frc::impl::ResetMotorSafety();
wpi::impl::ResetSmartDashboardInstance();
wpi::impl::ResetMotorSafety();
wpi::impl::ResetSendableRegistry();
}
void resetMotorSafety() {
frc::impl::ResetMotorSafety();
wpi::impl::ResetMotorSafety();
}
#else

View File

@@ -6,15 +6,15 @@
#include "wpi/util/sendable/SendableBuilder.hpp"
using namespace frc;
using namespace wpi;
void PyMotorControllerGroup::Initialize() {
for (auto motorController : m_motorControllers) {
wpi::SendableRegistry::AddChild(this, motorController.get());
wpi::util::SendableRegistry::AddChild(this, motorController.get());
}
static int instances = 0;
++instances;
wpi::SendableRegistry::Add(this, "MotorControllerGroup", instances);
wpi::util::SendableRegistry::Add(this, "MotorControllerGroup", instances);
}
void PyMotorControllerGroup::Set(double speed) {
@@ -23,7 +23,7 @@ void PyMotorControllerGroup::Set(double speed) {
}
}
void PyMotorControllerGroup::SetVoltage(units::volt_t output) {
void PyMotorControllerGroup::SetVoltage(wpi::units::volt_t output) {
for (auto motorController : m_motorControllers) {
motorController->SetVoltage(m_isInverted ? -output : output);
}
@@ -54,7 +54,7 @@ void PyMotorControllerGroup::StopMotor() {
}
}
void PyMotorControllerGroup::InitSendable(wpi::SendableBuilder& builder) {
void PyMotorControllerGroup::InitSendable(wpi::util::SendableBuilder& builder) {
builder.SetSmartDashboardType("Motor Controller");
builder.SetActuator(true);
builder.AddDoubleProperty("Value", [=, this]() { return Get(); },

View File

@@ -13,13 +13,13 @@
#include "wpi/util/sendable/Sendable.hpp"
#include "wpi/util/sendable/SendableHelper.hpp"
namespace frc {
namespace wpi {
class PyMotorControllerGroup : public wpi::Sendable,
class PyMotorControllerGroup : public wpi::util::Sendable,
public MotorController,
public wpi::SendableHelper<PyMotorControllerGroup> {
public wpi::util::SendableHelper<PyMotorControllerGroup> {
public:
PyMotorControllerGroup(std::vector<std::shared_ptr<frc::MotorController>> &&args) :
PyMotorControllerGroup(std::vector<std::shared_ptr<wpi::MotorController>> &&args) :
m_motorControllers(args) {}
~PyMotorControllerGroup() override = default;
@@ -27,20 +27,20 @@ class PyMotorControllerGroup : public wpi::Sendable,
PyMotorControllerGroup& operator=(PyMotorControllerGroup&&) = default;
void Set(double speed) override;
void SetVoltage(units::volt_t output) override;
void SetVoltage(wpi::units::volt_t output) override;
double Get() const override;
void SetInverted(bool isInverted) override;
bool GetInverted() const override;
void Disable() override;
void StopMotor() override;
void InitSendable(wpi::SendableBuilder& builder) override;
void InitSendable(wpi::util::SendableBuilder& builder) override;
private:
void Initialize();
bool m_isInverted = false;
std::vector<std::shared_ptr<frc::MotorController>> m_motorControllers;
std::vector<std::shared_ptr<wpi::MotorController>> m_motorControllers;
};
} // namespace rpy

View File

@@ -16,7 +16,7 @@
#include <pybind11/functional.h>
#include <gilsafe_object.h>
using namespace frc;
using namespace wpi;
using namespace pybind11::literals;
// Hang the thread since returning to the caller is going to crash when we try
@@ -144,7 +144,7 @@ void PyNotifier::SetCallback(std::function<void()> handler) {
m_handler = handler;
}
void PyNotifier::StartSingle(units::second_t delay) {
void PyNotifier::StartSingle(wpi::units::second_t delay) {
std::scoped_lock lock(m_processMutex);
m_periodic = false;
m_period = delay;
@@ -152,7 +152,7 @@ void PyNotifier::StartSingle(units::second_t delay) {
UpdateAlarm();
}
void PyNotifier::StartPeriodic(units::second_t period) {
void PyNotifier::StartPeriodic(wpi::units::second_t period) {
std::scoped_lock lock(m_processMutex);
m_periodic = true;
m_period = period;

View File

@@ -19,7 +19,7 @@
#include <semiwrap.h>
namespace frc {
namespace wpi {
class PyNotifier {
public:
@@ -66,7 +66,7 @@ class PyNotifier {
*
* @param delay Amount of time to wait before the handler is called.
*/
void StartSingle(units::second_t delay);
void StartSingle(wpi::units::second_t delay);
/**
* Register for periodic event notification.
@@ -78,7 +78,7 @@ class PyNotifier {
* @param period Period to call the handler starting one period
* after the call to this method.
*/
void StartPeriodic(units::second_t period);
void StartPeriodic(wpi::units::second_t period);
/**
* Stop timer events from occurring.
@@ -125,7 +125,7 @@ private:
py::object m_thread;
// Held while updating process information
wpi::mutex m_processMutex;
wpi::util::mutex m_processMutex;
// HAL handle, atomic for proper destruction
std::atomic<HAL_NotifierHandle> m_notifier{0};
@@ -134,13 +134,13 @@ private:
std::function<void()> m_handler;
// The absolute expiration time
units::second_t m_expirationTime = 0_s;
wpi::units::second_t m_expirationTime = 0_s;
// The relative time (either periodic or single)
units::second_t m_period = 0_s;
wpi::units::second_t m_period = 0_s;
// True if this is a periodic event
bool m_periodic = false;
};
} // namespace frc
} // namespace wpi

View File

@@ -15,7 +15,7 @@ static py::dict &getSmartDashboardData() {
return data;
}
void addSmartDashboardData(py::str &key, std::shared_ptr<wpi::Sendable> data) {
void addSmartDashboardData(py::str &key, std::shared_ptr<wpi::util::Sendable> data) {
auto &sdData = getSmartDashboardData();
sdData[key] = py::cast(data);
}

View File

@@ -10,7 +10,7 @@ namespace rpy {
// These functions must be called with the GIL held
//
void addSmartDashboardData(py::str &key, std::shared_ptr<wpi::Sendable> data);
void addSmartDashboardData(py::str &key, std::shared_ptr<wpi::util::Sendable> data);
void clearSmartDashboardData();
void destroySmartDashboardData();