mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Replace /home/lvuser with /home/systemcore (#8002)
This commit is contained in:
@@ -9,5 +9,5 @@ repositories {
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
implementation "edu.wpi.first:native-utils:2025.9.1"
|
||||
implementation "edu.wpi.first:native-utils:2025.12.1"
|
||||
}
|
||||
|
||||
@@ -184,9 +184,9 @@ std::vector<std::string> 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);
|
||||
|
||||
@@ -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(); }} {}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#ifdef __FRC_ROBORIO__
|
||||
#ifdef __FRC_SYSTEMCORE__
|
||||
#include <signal.h>
|
||||
#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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -20,11 +20,6 @@
|
||||
#include <wpi/fs.h>
|
||||
#include <wpi/print.h>
|
||||
|
||||
#ifdef __FRC_ROBORIO__
|
||||
#include <FRC_NetworkCommunication/FRCComm.h>
|
||||
#include <FRC_NetworkCommunication/LoadOut.h>
|
||||
#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 <typename... Args>
|
||||
@@ -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"};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ static MotorSafetyManager& GetManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
#ifndef __FRC_ROBORIO__
|
||||
#ifndef __FRC_SYSTEMCORE__
|
||||
namespace frc::impl {
|
||||
void ResetMotorSafety() {
|
||||
auto& manager = GetManager();
|
||||
|
||||
@@ -41,7 +41,7 @@ static Instance& GetInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
#ifndef __FRC_ROBORIO__
|
||||
#ifndef __FRC_SYSTEMCORE__
|
||||
namespace frc::impl {
|
||||
void ResetPreferencesInstance() {
|
||||
GetInstance() = Instance();
|
||||
|
||||
@@ -41,7 +41,7 @@ static Instance& GetInstance() {
|
||||
return *GetInstanceHolder();
|
||||
}
|
||||
|
||||
#ifndef __FRC_ROBORIO__
|
||||
#ifndef __FRC_SYSTEMCORE__
|
||||
namespace frc::impl {
|
||||
void ResetSmartDashboardInstance() {
|
||||
std::make_unique<Instance>().swap(GetInstanceHolder());
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "frc/RobotBase.h"
|
||||
|
||||
#ifdef __FRC_ROBORIO__
|
||||
#ifdef __FRC_SYSTEMCORE__
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
@@ -34,6 +34,8 @@ static_assert(frc::RuntimeType::kRoboRIO2 ==
|
||||
static_cast<frc::RuntimeType>(HAL_Runtime_RoboRIO2));
|
||||
static_assert(frc::RuntimeType::kSimulation ==
|
||||
static_cast<frc::RuntimeType>(HAL_Runtime_Simulation));
|
||||
static_assert(frc::RuntimeType::kSystemCore ==
|
||||
static_cast<frc::RuntimeType>(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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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<Robot>(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;
|
||||
|
||||
@@ -14,6 +14,7 @@ enum RuntimeType {
|
||||
/// roboRIO 2.0.
|
||||
kRoboRIO2,
|
||||
/// Simulation runtime.
|
||||
kSimulation
|
||||
kSimulation,
|
||||
kSystemCore
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <hal/HALBase.h>
|
||||
|
||||
#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;
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
* <p>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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
* <p>This class is primarily used for obtaining resources in src/main/deploy, and the RoboRIO path
|
||||
* /home/lvuser in a simulation-compatible way.
|
||||
* <p>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
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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; });
|
||||
|
||||
@@ -71,7 +71,7 @@ static SendableRegistryInst& GetInstance() {
|
||||
return *GetInstanceHolder();
|
||||
}
|
||||
|
||||
#ifndef __FRC_ROBORIO__
|
||||
#ifndef __FRC_SYSTEMCORE__
|
||||
namespace wpi::impl {
|
||||
void ResetSendableRegistry() {
|
||||
std::make_unique<SendableRegistryInst>().swap(GetInstanceHolder());
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user