From 2af8c59858c48cbef42247da1b6bfed7512632b7 Mon Sep 17 00:00:00 2001 From: Thad House Date: Mon, 2 Jun 2025 16:42:56 -0700 Subject: [PATCH] Replace /home/lvuser with /home/systemcore (#8002) --- buildSrc/build.gradle | 2 +- .../native/cpp/cameraserver/CameraServer.cpp | 4 +- .../src/main/native/cpp/Downloader.cpp | 5 +- developerRobot/README.md | 3 +- hal/src/main/native/cpp/jni/HAL.cpp | 4 +- .../include/hal/handles/HandlesInternal.h | 2 +- .../src/main/native/cpp/DataLogManager.cpp | 171 +++++++++--------- .../src/main/native/include/DataLogManager.h | 2 +- .../src/main/native/cpp/DataLogManager.cpp | 14 +- wpilibc/src/main/native/cpp/Filesystem.cpp | 4 +- wpilibc/src/main/native/cpp/MotorSafety.cpp | 2 +- wpilibc/src/main/native/cpp/Preferences.cpp | 2 +- .../cpp/smartdashboard/SmartDashboard.cpp | 2 +- wpilibc/src/main/native/cppcs/RobotBase.cpp | 8 +- .../main/native/include/frc/DataLogManager.h | 2 +- .../src/main/native/include/frc/Filesystem.h | 6 +- .../src/main/native/include/frc/RobotBase.h | 8 +- .../src/main/native/include/frc/RuntimeType.h | 3 +- wpilibc/src/test/native/cpp/main.cpp | 4 +- .../edu/wpi/first/wpilibj/DataLogManager.java | 14 +- .../edu/wpi/first/wpilibj/Filesystem.java | 12 +- .../java/edu/wpi/first/wpilibj/RobotBase.java | 4 +- .../src/main/native/cpp/jni/WPIUtilJNI.cpp | 4 +- .../native/cpp/sendable/SendableRegistry.cpp | 2 +- .../main/native/include/wpi/priority_mutex.h | 2 + 25 files changed, 139 insertions(+), 147 deletions(-) diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 36829299fb..e65ba5abc2 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -9,5 +9,5 @@ repositories { } } dependencies { - implementation "edu.wpi.first:native-utils:2025.9.1" + implementation "edu.wpi.first:native-utils:2025.12.1" } diff --git a/cameraserver/src/main/native/cpp/cameraserver/CameraServer.cpp b/cameraserver/src/main/native/cpp/cameraserver/CameraServer.cpp index f92eb574bc..2266347aa2 100644 --- a/cameraserver/src/main/native/cpp/cameraserver/CameraServer.cpp +++ b/cameraserver/src/main/native/cpp/cameraserver/CameraServer.cpp @@ -184,9 +184,9 @@ std::vector Instance::GetSourceStreamValues(CS_Source source) { value = "mjpg:" + value; } -#ifdef __FRC_ROBORIO__ +#ifdef __FRC_SYSTEMCORE__ // Look to see if we have a passthrough server for this source - // Only do this on the roboRIO + // Only do this on the systemcore for (const auto& i : m_sinks) { CS_Sink sink = i.second.GetHandle(); CS_Source sinkSource = cs::GetSinkSource(sink, &status); diff --git a/datalogtool/src/main/native/cpp/Downloader.cpp b/datalogtool/src/main/native/cpp/Downloader.cpp index 84b186db2b..c9d76577d5 100644 --- a/datalogtool/src/main/native/cpp/Downloader.cpp +++ b/datalogtool/src/main/native/cpp/Downloader.cpp @@ -30,8 +30,9 @@ Downloader::Downloader(glass::Storage& storage) : m_serverTeam{storage.GetString("serverTeam")}, - m_remoteDir{storage.GetString("remoteDir", "/home/lvuser/logs")}, - m_username{storage.GetString("username", "lvuser")}, + m_remoteDir{storage.GetString("remoteDir", "/home/systemcore/logs")}, + m_username{storage.GetString("username", "systemcore")}, + m_password{"systemcore"}, m_localDir{storage.GetString("localDir")}, m_deleteAfter{storage.GetBool("deleteAfter", true)}, m_thread{[this] { ThreadMain(); }} {} diff --git a/developerRobot/README.md b/developerRobot/README.md index 2b332f8afe..8aa2479252 100644 --- a/developerRobot/README.md +++ b/developerRobot/README.md @@ -40,7 +40,8 @@ This command deploys the Java project and all required dependencies. It also ins Those commands won't start the robot executable, so you have to manually ssh in and start it. The following command will do that. ```bash -ssh lvuser@172.22.11.2 frcRunRobot.sh +ssh systemcore@172.28.0.1 sudo systemctl stop robot +ssh systemcore@172.22.11.2 sudo ~/robotCommand ``` Console log prints will appear in the terminal. diff --git a/hal/src/main/native/cpp/jni/HAL.cpp b/hal/src/main/native/cpp/jni/HAL.cpp index 837daa67be..f4ee086457 100644 --- a/hal/src/main/native/cpp/jni/HAL.cpp +++ b/hal/src/main/native/cpp/jni/HAL.cpp @@ -6,7 +6,7 @@ #include -#ifdef __FRC_ROBORIO__ +#ifdef __FRC_SYSTEMCORE__ #include #endif @@ -95,7 +95,7 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_hal_HAL_terminate (JNIEnv*, jclass) { -#ifdef __FRC_ROBORIO__ +#ifdef __FRC_SYSTEMCORE__ ::raise(SIGKILL); #endif } diff --git a/hal/src/main/native/include/hal/handles/HandlesInternal.h b/hal/src/main/native/include/hal/handles/HandlesInternal.h index 71f62f81df..5782b771eb 100644 --- a/hal/src/main/native/include/hal/handles/HandlesInternal.h +++ b/hal/src/main/native/include/hal/handles/HandlesInternal.h @@ -136,7 +136,7 @@ inline int16_t getHandleTypedIndex(HAL_Handle handle, HAL_HandleEnum enumType, if (!isHandleType(handle, enumType)) { return InvalidHandleIndex; } -#if !defined(__FRC_ROBORIO__) +#if !defined(__FRC_SYSTEMCORE__) if (!isHandleCorrectVersion(handle, version)) { return InvalidHandleIndex; } diff --git a/ntcoreffi/src/main/native/cpp/DataLogManager.cpp b/ntcoreffi/src/main/native/cpp/DataLogManager.cpp index 96377feef2..cbc347017c 100644 --- a/ntcoreffi/src/main/native/cpp/DataLogManager.cpp +++ b/ntcoreffi/src/main/native/cpp/DataLogManager.cpp @@ -20,11 +20,6 @@ #include #include -#ifdef __FRC_ROBORIO__ -#include -#include -#endif - using namespace wpi; /** Shims to keep the code as similar as possible to wpilibc */ @@ -38,17 +33,18 @@ namespace frc { void ReportErrorV(int32_t status, const char* fileName, int lineNumber, const char* funcName, fmt::string_view format, fmt::format_args args) { -#ifdef __FRC_ROBORIO__ - if (status == 0) { - return; - } - fmt::memory_buffer out; - fmt::format_to(fmt::appender{out}, "Warning: "); - fmt::vformat_to(fmt::appender{out}, format, args); - out.push_back('\0'); - FRC_NetworkCommunication_sendError(status < 0, status, 0, out.data(), - "DataLogManager", ""); -#endif + // TODO when we get a low level interface + // #ifdef __FRC_SYSTEMCORE__ + // if (status == 0) { + // return; + // } + // fmt::memory_buffer out; + // fmt::format_to(fmt::appender{out}, "Warning: "); + // fmt::vformat_to(fmt::appender{out}, format, args); + // out.push_back('\0'); + // FRC_NetworkCommunication_sendError(status < 0, status, 0, out.data(), + // "DataLogManager", ""); + // #endif } template @@ -70,10 +66,12 @@ inline void ReportError(int32_t status, const char* fileName, int lineNumber, namespace RobotController { inline bool IsSystemTimeValid() { -#ifdef __FRC_ROBORIO__ - uint8_t timeWasSet = 0; - FRC_NetworkCommunication_getTimeWasSet(&timeWasSet); - return timeWasSet != 0; +#ifdef __FRC_SYSTEMCORE__ + // TODO when we get a proper low level library, and time setting + return false; + // uint8_t timeWasSet = 0; + // FRC_NetworkCommunication_getTimeWasSet(&timeWasSet); + // return timeWasSet != 0; #else return true; #endif @@ -82,8 +80,8 @@ inline bool IsSystemTimeValid() { namespace filesystem { inline std::string GetOperatingDirectory() { -#ifdef __FRC_ROBORIO__ - return "/home/lvuser"; +#ifdef __FRC_SYSTEMCORE__ + return "/home/systemcore"; #else return fs::current_path().string(); #endif @@ -91,73 +89,75 @@ inline std::string GetOperatingDirectory() { } // namespace filesystem namespace DriverStation { -#ifdef __FRC_ROBORIO__ -using MatchType = MatchType_t; -constexpr int kNone = kMatchType_none; -constexpr int kPractice = kMatchType_practice; -constexpr int kQualification = kMatchType_qualification; -constexpr int kElimination = kMatchType_elimination; -char gEventName[128]; -MatchType_t gMatchType; -uint16_t gMatchNumber; -uint8_t gReplayNumber; -uint8_t gGameSpecificMessage[16]; -uint16_t gGameSpecificMessageSize; -#else +// #ifdef __FRC_SYSTEMCORE__ +// using MatchType = MatchType_t; +// constexpr int kNone = kMatchType_none; +// constexpr int kPractice = kMatchType_practice; +// constexpr int kQualification = kMatchType_qualification; +// constexpr int kElimination = kMatchType_elimination; +// char gEventName[128]; +// MatchType_t gMatchType; +// uint16_t gMatchNumber; +// uint8_t gReplayNumber; +// uint8_t gGameSpecificMessage[16]; +// uint16_t gGameSpecificMessageSize; +// #else enum MatchType { kNone, kPractice, kQualification, kElimination }; -#endif +// #endif inline void UpdateMatchInfo() { -#ifdef __FRC_ROBORIO__ - gGameSpecificMessageSize = sizeof(gGameSpecificMessage); - FRC_NetworkCommunication_getMatchInfo(gEventName, &gMatchType, &gMatchNumber, - &gReplayNumber, gGameSpecificMessage, - &gGameSpecificMessageSize); -#endif + // #ifdef __FRC_SYSTEMCORE__ + // gGameSpecificMessageSize = sizeof(gGameSpecificMessage); + // FRC_NetworkCommunication_getMatchInfo(gEventName, &gMatchType, + // &gMatchNumber, + // &gReplayNumber, + // gGameSpecificMessage, + // &gGameSpecificMessageSize); + // #endif } inline MatchType GetMatchType() { -#ifdef __FRC_ROBORIO__ - return gMatchType; -#else + // #ifdef __FRC_SYSTEMCORE__ + // return gMatchType; + // #else return kNone; -#endif + // #endif } inline std::string_view GetEventName() { -#ifdef __FRC_ROBORIO__ - return gEventName; -#else + // #ifdef __FRC_SYSTEMCORE__ + // return gEventName; + // #else return ""; -#endif + // #endif } inline uint16_t GetMatchNumber() { -#ifdef __FRC_ROBORIO__ - return gMatchNumber; -#else + // #ifdef __FRC_SYSTEMCORE__ + // return gMatchNumber; + // #else return 0; -#endif + // #endif } inline bool IsDSAttached() { -#ifdef __FRC_ROBORIO__ - struct ControlWord_t cw; - FRC_NetworkCommunication_getControlWord(&cw); - return cw.dsAttached; -#else + // #ifdef __FRC_SYSTEMCORE__ + // struct ControlWord_t cw; + // FRC_NetworkCommunication_getControlWord(&cw); + // return cw.dsAttached; + // #else return true; -#endif + // #endif } inline bool IsFMSAttached() { -#ifdef __FRC_ROBORIO__ - struct ControlWord_t cw; - FRC_NetworkCommunication_getControlWord(&cw); - return cw.fmsAttached; -#else + // #ifdef __FRC_SYSTEMCORE__ + // struct ControlWord_t cw; + // FRC_NetworkCommunication_getControlWord(&cw); + // return cw.fmsAttached; + // #else return false; -#endif + // #endif } WPI_EventHandle gNewDataEvent; @@ -170,19 +170,19 @@ inline void RemoveRefreshedDataEventHandle(WPI_EventHandle event) {} } // namespace DriverStation -#ifdef __FRC_ROBORIO__ -static constexpr int kRoboRIO = 0; -namespace RobotBase { -inline int GetRuntimeType() { - nLoadOut::tTargetClass targetClass = nLoadOut::getTargetClass(); - if (targetClass == nLoadOut::kTargetClass_RoboRIO2) { - return 1; - } else { - return 0; - } -} -} // namespace RobotBase -#endif +// #ifdef __FRC_SYSTEMCORE__ +// static constexpr int kRoboRIO = 0; +// namespace RobotBase { +// inline int GetRuntimeType() { +// nLoadOut::tTargetClass targetClass = nLoadOut::getTargetClass(); +// if (targetClass == nLoadOut::kTargetClass_RoboRIO2) { +// return 1; +// } else { +// return 0; +// } +// } +// } // namespace RobotBase +// #endif struct Thread final : public wpi::SafeThread { Thread(std::string_view dir, std::string_view filename, double period); @@ -222,7 +222,7 @@ static std::string MakeLogDir(std::string_view dir) { if (!dir.empty()) { return std::string{dir}; } -#ifdef __FRC_ROBORIO__ +#ifdef __FRC_SYSTEMCORE__ // prefer a mounted USB drive if one is accessible std::error_code ec; auto s = fs::status("/u", ec); @@ -231,13 +231,8 @@ static std::string MakeLogDir(std::string_view dir) { fs::create_directory("/u/logs", ec); return "/u/logs"; } - if (RobotBase::GetRuntimeType() == kRoboRIO) { - FRC_ReportError(warn::Warning, - "DataLogManager: Logging to RoboRIO 1 internal storage is " - "not recommended! Plug in a FAT32 formatted flash drive!"); - } - fs::create_directory("/home/lvuser/logs", ec); - return "/home/lvuser/logs"; + fs::create_directory("/home/systemcore/logs", ec); + return "/home/systemcore/logs"; #else std::string logDir = filesystem::GetOperatingDirectory() + "/logs"; std::error_code ec; @@ -460,7 +455,7 @@ void Thread::StopNTLog() { void Thread::StartConsoleLog() { if (!m_consoleLoggerEnabled) { m_consoleLoggerEnabled = true; - m_consoleLogger = {"/home/lvuser/FRC_UserProgram.log", m_log, "output"}; + m_consoleLogger = {"/home/systemcore/FRC_UserProgram.log", m_log, "output"}; } } diff --git a/ntcoreffi/src/main/native/include/DataLogManager.h b/ntcoreffi/src/main/native/include/DataLogManager.h index 442afe29de..71ad522deb 100644 --- a/ntcoreffi/src/main/native/include/DataLogManager.h +++ b/ntcoreffi/src/main/native/include/DataLogManager.h @@ -21,7 +21,7 @@ namespace wpi { * automatically cleans up old files when disk space is low and renames the file * based either on current date/time or (if available) competition match number. * The data file will be saved to a USB flash drive in a folder named "logs" if - * one is attached, or to /home/lvuser/logs otherwise. + * one is attached, or to /home/systemcore/logs otherwise. * * Log files are initially named "FRC_TBD_{random}.wpilog" until the DS * connects. After the DS connects, the log file is renamed to diff --git a/wpilibc/src/main/native/cpp/DataLogManager.cpp b/wpilibc/src/main/native/cpp/DataLogManager.cpp index 15c179e243..040a298bab 100644 --- a/wpilibc/src/main/native/cpp/DataLogManager.cpp +++ b/wpilibc/src/main/native/cpp/DataLogManager.cpp @@ -71,7 +71,7 @@ static std::string MakeLogDir(std::string_view dir) { if (!dir.empty()) { return std::string{dir}; } -#ifdef __FRC_ROBORIO__ +#ifdef __FRC_SYSTEMCORE__ // prefer a mounted USB drive if one is accessible std::error_code ec; auto s = fs::status("/u", ec); @@ -81,14 +81,9 @@ static std::string MakeLogDir(std::string_view dir) { return "/u/logs"; HAL_ReportUsage("DataLogManager", "USB"); } - if (RobotBase::GetRuntimeType() == kRoboRIO) { - FRC_ReportWarning( - "DataLogManager: Logging to RoboRIO 1 internal storage is " - "not recommended! Plug in a FAT32 formatted flash drive!"); - } - fs::create_directory("/home/lvuser/logs", ec); + fs::create_directory("/home/systemcore/logs", ec); HAL_ReportUsage("DataLogManager", "Onboard"); - return "/home/lvuser/logs"; + return "/home/systemcore/logs"; #else std::string logDir = filesystem::GetOperatingDirectory() + "/logs"; std::error_code ec; @@ -312,7 +307,8 @@ void Thread::StopNTLog() { void Thread::StartConsoleLog() { if (!m_consoleLoggerEnabled && RobotBase::IsReal()) { m_consoleLoggerEnabled = true; - m_consoleLogger = {"/home/lvuser/FRC_UserProgram.log", m_log, "console"}; + m_consoleLogger = {"/home/systemcore/FRC_UserProgram.log", m_log, + "console"}; } } diff --git a/wpilibc/src/main/native/cpp/Filesystem.cpp b/wpilibc/src/main/native/cpp/Filesystem.cpp index 7add0e8f8e..421bba3443 100644 --- a/wpilibc/src/main/native/cpp/Filesystem.cpp +++ b/wpilibc/src/main/native/cpp/Filesystem.cpp @@ -16,7 +16,7 @@ std::string frc::filesystem::GetLaunchDirectory() { std::string frc::filesystem::GetOperatingDirectory() { if constexpr (!RobotBase::IsSimulation()) { - return "/home/lvuser"; + return "/home/systemcore"; } else { return frc::filesystem::GetLaunchDirectory(); } @@ -24,7 +24,7 @@ std::string frc::filesystem::GetOperatingDirectory() { std::string frc::filesystem::GetDeployDirectory() { if constexpr (!RobotBase::IsSimulation()) { - return "/home/lvuser/deploy"; + return "/home/systemcore/deploy"; } else { return (fs::current_path() / "src" / "main" / "deploy").string(); } diff --git a/wpilibc/src/main/native/cpp/MotorSafety.cpp b/wpilibc/src/main/native/cpp/MotorSafety.cpp index 368092b221..f6434b965c 100644 --- a/wpilibc/src/main/native/cpp/MotorSafety.cpp +++ b/wpilibc/src/main/native/cpp/MotorSafety.cpp @@ -69,7 +69,7 @@ static MotorSafetyManager& GetManager() { return manager; } -#ifndef __FRC_ROBORIO__ +#ifndef __FRC_SYSTEMCORE__ namespace frc::impl { void ResetMotorSafety() { auto& manager = GetManager(); diff --git a/wpilibc/src/main/native/cpp/Preferences.cpp b/wpilibc/src/main/native/cpp/Preferences.cpp index 9ba4b68cda..7c95c8a7b8 100644 --- a/wpilibc/src/main/native/cpp/Preferences.cpp +++ b/wpilibc/src/main/native/cpp/Preferences.cpp @@ -41,7 +41,7 @@ static Instance& GetInstance() { return instance; } -#ifndef __FRC_ROBORIO__ +#ifndef __FRC_SYSTEMCORE__ namespace frc::impl { void ResetPreferencesInstance() { GetInstance() = Instance(); diff --git a/wpilibc/src/main/native/cpp/smartdashboard/SmartDashboard.cpp b/wpilibc/src/main/native/cpp/smartdashboard/SmartDashboard.cpp index 995f079119..3cd1208f94 100644 --- a/wpilibc/src/main/native/cpp/smartdashboard/SmartDashboard.cpp +++ b/wpilibc/src/main/native/cpp/smartdashboard/SmartDashboard.cpp @@ -41,7 +41,7 @@ static Instance& GetInstance() { return *GetInstanceHolder(); } -#ifndef __FRC_ROBORIO__ +#ifndef __FRC_SYSTEMCORE__ namespace frc::impl { void ResetSmartDashboardInstance() { std::make_unique().swap(GetInstanceHolder()); diff --git a/wpilibc/src/main/native/cppcs/RobotBase.cpp b/wpilibc/src/main/native/cppcs/RobotBase.cpp index f4d8600356..99f4baba26 100644 --- a/wpilibc/src/main/native/cppcs/RobotBase.cpp +++ b/wpilibc/src/main/native/cppcs/RobotBase.cpp @@ -4,7 +4,7 @@ #include "frc/RobotBase.h" -#ifdef __FRC_ROBORIO__ +#ifdef __FRC_SYSTEMCORE__ #include #endif @@ -34,6 +34,8 @@ static_assert(frc::RuntimeType::kRoboRIO2 == static_cast(HAL_Runtime_RoboRIO2)); static_assert(frc::RuntimeType::kSimulation == static_cast(HAL_Runtime_Simulation)); +static_assert(frc::RuntimeType::kSystemCore == + static_cast(HAL_Runtime_SystemCore)); using SetCameraServerSharedFP = void (*)(frc::CameraServerShared*); @@ -104,7 +106,7 @@ class WPILibMathShared : public wpi::math::MathShared { } // namespace static void SetupCameraServerShared() { -#ifdef __FRC_ROBORIO__ +#ifdef __FRC_SYSTEMCORE__ #ifdef DYNAMIC_CAMERA_SERVER #ifdef DYNAMIC_CAMERA_SERVER_DEBUG auto cameraServerLib = dlopen("libcameraserverd.so", RTLD_NOW); @@ -189,7 +191,7 @@ RobotBase::RobotBase() { // subscribe to "" to force persistent values to propagate to local nt::SubscribeMultiple(inst.GetHandle(), {{std::string_view{}}}); if constexpr (!IsSimulation()) { - inst.StartServer("/home/lvuser/networktables.json"); + inst.StartServer("/home/systemcore/networktables.json"); } else { inst.StartServer(); } diff --git a/wpilibc/src/main/native/include/frc/DataLogManager.h b/wpilibc/src/main/native/include/frc/DataLogManager.h index a624b5a012..e8b30cb142 100644 --- a/wpilibc/src/main/native/include/frc/DataLogManager.h +++ b/wpilibc/src/main/native/include/frc/DataLogManager.h @@ -18,7 +18,7 @@ namespace frc { * automatically cleans up old files when disk space is low and renames the file * based either on current date/time or (if available) competition match number. * The data file will be saved to a USB flash drive in a folder named "logs" if - * one is attached, or to /home/lvuser/logs otherwise. + * one is attached, or to /home/systemcore/logs otherwise. * * Log files are initially named "FRC_TBD_{random}.wpilog" until the DS * connects. After the DS connects, the log file is renamed to diff --git a/wpilibc/src/main/native/include/frc/Filesystem.h b/wpilibc/src/main/native/include/frc/Filesystem.h index fbfc681af4..59a3415931 100644 --- a/wpilibc/src/main/native/include/frc/Filesystem.h +++ b/wpilibc/src/main/native/include/frc/Filesystem.h @@ -19,7 +19,7 @@ std::string GetLaunchDirectory(); /** * Obtains the operating directory of the program. On the roboRIO, this - * is /home/lvuser. In simulation, it is where the simulation was launched + * is /home/systemcore. In simulation, it is where the simulation was launched * from (`pwd`). * * @return The result of the operating directory lookup. @@ -29,8 +29,8 @@ std::string GetOperatingDirectory(); /** * Obtains the deploy directory of the program, which is the remote location * src/main/deploy is deployed to by default. On the roboRIO, this is - * /home/lvuser/deploy. In simulation, it is where the simulation was launched - * from, in the subdirectory "src/main/deploy" (`pwd`/src/main/deploy). + * /home/systemcore/deploy. In simulation, it is where the simulation was + * launched from, in the subdirectory "src/main/deploy" (`pwd`/src/main/deploy). * * @return The result of the operating directory lookup */ diff --git a/wpilibc/src/main/native/include/frc/RobotBase.h b/wpilibc/src/main/native/include/frc/RobotBase.h index 52e62d094d..d388b98dc8 100644 --- a/wpilibc/src/main/native/include/frc/RobotBase.h +++ b/wpilibc/src/main/native/include/frc/RobotBase.h @@ -24,7 +24,7 @@ namespace frc { int RunHALInitialization(); namespace impl { -#ifndef __FRC_ROBORIO__ +#ifndef __FRC_SYSTEMCORE__ void ResetMotorSafety(); #endif @@ -124,7 +124,7 @@ int StartRobot() { impl::RunRobot(m, &robot); } -#ifndef __FRC_ROBORIO__ +#ifndef __FRC_SYSTEMCORE__ frc::impl::ResetMotorSafety(); #endif HAL_Shutdown(); @@ -235,7 +235,7 @@ class RobotBase { * @return If the robot is running in the real world. */ static constexpr bool IsReal() { -#ifdef __FRC_ROBORIO__ +#ifdef __FRC_SYSTEMCORE__ return true; #else return false; @@ -248,7 +248,7 @@ class RobotBase { * @return If the robot is running in simulation. */ static constexpr bool IsSimulation() { -#ifdef __FRC_ROBORIO__ +#ifdef __FRC_SYSTEMCORE__ return false; #else return true; diff --git a/wpilibc/src/main/native/include/frc/RuntimeType.h b/wpilibc/src/main/native/include/frc/RuntimeType.h index 2be444a60f..8705020f9c 100644 --- a/wpilibc/src/main/native/include/frc/RuntimeType.h +++ b/wpilibc/src/main/native/include/frc/RuntimeType.h @@ -14,6 +14,7 @@ enum RuntimeType { /// roboRIO 2.0. kRoboRIO2, /// Simulation runtime. - kSimulation + kSimulation, + kSystemCore }; } // namespace frc diff --git a/wpilibc/src/test/native/cpp/main.cpp b/wpilibc/src/test/native/cpp/main.cpp index e0bad04df3..97d307444b 100644 --- a/wpilibc/src/test/native/cpp/main.cpp +++ b/wpilibc/src/test/native/cpp/main.cpp @@ -5,7 +5,7 @@ #include #include -#ifndef __FRC_ROBORIO__ +#ifndef __FRC_SYSTEMCORE__ namespace frc::impl { void ResetMotorSafety(); } @@ -15,7 +15,7 @@ int main(int argc, char** argv) { HAL_Initialize(500, 0); ::testing::InitGoogleTest(&argc, argv); int ret = RUN_ALL_TESTS(); -#ifndef __FRC_ROBORIO__ +#ifndef __FRC_SYSTEMCORE__ frc::impl::ResetMotorSafety(); #endif return ret; diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DataLogManager.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DataLogManager.java index 450168f3e5..03e059dada 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DataLogManager.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DataLogManager.java @@ -29,7 +29,7 @@ import java.util.Random; * Centralized data log that provides automatic data log file management. It automatically cleans up * old files when disk space is low and renames the file based either on current date/time or (if * available) competition match number. The data file will be saved to a USB flash drive in a folder - * named "logs" if one is attached, or to /home/lvuser/logs otherwise. + * named "logs" if one is attached, or to /home/systemcore/logs otherwise. * *

Log files are initially named "FRC_TBD_{random}.wpilog" until the DS connects. After the DS * connects, the log file is renamed to "FRC_yyyyMMdd_HHmmss.wpilog" (where the date/time is UTC). @@ -251,17 +251,11 @@ public final class DataLogManager { } catch (IOException ex) { // ignored } - if (RobotBase.getRuntimeType() == RuntimeType.kRoboRIO) { - DriverStation.reportWarning( - "DataLogManager: Logging to RoboRIO 1 internal storage is not recommended!" - + " Plug in a FAT32 formatted flash drive!", - false); - } - if (!new File("/home/lvuser/logs").mkdir()) { + if (!new File("/home/systemcore/logs").mkdir()) { // ignored } HAL.reportUsage("DataLogManager", "Onboard"); - return "/home/lvuser/logs"; + return "/home/systemcore/logs"; } String logDir = Filesystem.getOperatingDirectory().getAbsolutePath() + "/logs"; if (!new File(logDir).mkdir()) { @@ -297,7 +291,7 @@ public final class DataLogManager { private static void startConsoleLog() { if (RobotBase.isReal()) { - m_consoleLogger = new FileLogger("/home/lvuser/FRC_UserProgram.log", m_log, "console"); + m_consoleLogger = new FileLogger("/home/systemcore/FRC_UserProgram.log", m_log, "console"); } } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Filesystem.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Filesystem.java index 782538d418..205d2f6ce8 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Filesystem.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Filesystem.java @@ -10,8 +10,8 @@ import java.io.File; * Class for interacting with the Filesystem, particularly, interacting with FRC-related paths on * the system, such as the launch and deploy directories. * - *

This class is primarily used for obtaining resources in src/main/deploy, and the RoboRIO path - * /home/lvuser in a simulation-compatible way. + *

This class is primarily used for obtaining resources in src/main/deploy, and the systemcore + * path /home/systemcore in a simulation-compatible way. */ public final class Filesystem { private Filesystem() {} @@ -33,14 +33,14 @@ public final class Filesystem { } /** - * Obtains the operating directory of the program. On the roboRIO, this is /home/lvuser. In + * Obtains the operating directory of the program. On the systemcore, this is /home/systemcore. In * simulation, it is where the simulation was launched from (`pwd`). * * @return The operating directory */ public static File getOperatingDirectory() { if (!RobotBase.isSimulation()) { - return new File("/home/lvuser"); + return new File("/home/systemcore"); } else { return getLaunchDirectory(); } @@ -48,8 +48,8 @@ public final class Filesystem { /** * Obtains the 'deploy' directory of the program, located at src/main/deploy, which is deployed by - * default. On the roboRIO, this is /home/lvuser/deploy. In simulation, it is where the simulation - * was launched from, in the subdirectory "src/main/deploy" (`pwd`/src/main/deploy). + * default. On the systemcore, this is /home/systemcore/deploy. In simulation, it is where the + * simulation was launched from, in the subdirectory "src/main/deploy" (`pwd`/src/main/deploy). * * @return The 'deploy' directory */ diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java index 661547e64c..2263aaed77 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java @@ -99,7 +99,7 @@ public abstract class RobotBase implements AutoCloseable { // subscribe to "" to force persistent values to propagate to local m_suball = new MultiSubscriber(inst, new String[] {""}); if (!isSimulation()) { - inst.startServer("/home/lvuser/networktables.json"); + inst.startServer("/home/systemcore/networktables.json"); } else { inst.startServer(); } @@ -168,7 +168,7 @@ public abstract class RobotBase implements AutoCloseable { */ public static boolean isReal() { RuntimeType runtimeType = getRuntimeType(); - return runtimeType == RuntimeType.kRoboRIO || runtimeType == RuntimeType.kRoboRIO2; + return runtimeType == RuntimeType.kSystemCore; } /** diff --git a/wpiutil/src/main/native/cpp/jni/WPIUtilJNI.cpp b/wpiutil/src/main/native/cpp/jni/WPIUtilJNI.cpp index 55764642a4..3fc818fb82 100644 --- a/wpiutil/src/main/native/cpp/jni/WPIUtilJNI.cpp +++ b/wpiutil/src/main/native/cpp/jni/WPIUtilJNI.cpp @@ -128,8 +128,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_util_WPIUtilJNI_enableMockTime (JNIEnv*, jclass) { -#ifdef __FRC_ROBORIO__ - wpi::print(stderr, "WPIUtil: Mocking time is not available on the Rio\n"); +#ifdef __FRC_SYSTEMCORE__ + wpi::print(stderr, "WPIUtil: Mocking time is not available on systemcore\n"); #else mockTimeEnabled = true; wpi::SetNowImpl([] { return mockNow; }); diff --git a/wpiutil/src/main/native/cpp/sendable/SendableRegistry.cpp b/wpiutil/src/main/native/cpp/sendable/SendableRegistry.cpp index 74ec0e9e5a..ebb7fb0e8c 100644 --- a/wpiutil/src/main/native/cpp/sendable/SendableRegistry.cpp +++ b/wpiutil/src/main/native/cpp/sendable/SendableRegistry.cpp @@ -71,7 +71,7 @@ static SendableRegistryInst& GetInstance() { return *GetInstanceHolder(); } -#ifndef __FRC_ROBORIO__ +#ifndef __FRC_SYSTEMCORE__ namespace wpi::impl { void ResetSendableRegistry() { std::make_unique().swap(GetInstanceHolder()); diff --git a/wpiutil/src/main/native/include/wpi/priority_mutex.h b/wpiutil/src/main/native/include/wpi/priority_mutex.h index 73389ae191..1166b9e7bb 100644 --- a/wpiutil/src/main/native/include/wpi/priority_mutex.h +++ b/wpiutil/src/main/native/include/wpi/priority_mutex.h @@ -13,6 +13,8 @@ namespace wpi { +// TODO replace this with systemcore once our compiler has the defines +// for RT #if defined(__FRC_ROBORIO__) && !defined(WPI_USE_PRIORITY_MUTEX) #define WPI_USE_PRIORITY_MUTEX #endif