Skip to content

Commit 0f88db0

Browse files
authored
Merge pull request #709 from Autodesk/wpilib-2021
Update Emulator for WPILib 2021.2.2 Support
2 parents 80d0b20 + 5401c4f commit 0f88db0

File tree

5 files changed

+52
-21
lines changed

5 files changed

+52
-21
lines changed

emulation/hel/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ OPTION(BUILD_DOC "Enable building of documentation" OFF)
3131

3232
SET(DEFAULT_BUILD_TYPE "Release")
3333
SET(DEFAULT_GRPC_VERSION "v1.21.4")
34-
SET(DEFAULT_WPILIB_VERSION "v2020.3.2")
35-
#SET(DEFAULT_NILIB_VERSION "v2019-12")
34+
SET(DEFAULT_WPILIB_VERSION "v2021.2.2")
3635
SET(DEFAULT_NILIB_VERSION "main")
3736

3837
IF(NOT CMAKE_CONFIGURATION_TYPES)

emulation/hel/src/init.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include <cstdio>
66
#include <fstream>
77

8+
#include <FRC_NetworkCommunication/LoadOut.h>
9+
810
#define LIBHEL_VERSION "1.1.0" // Major, minor, patch
911
#define VIRTUAL_MACHINE_INFO_PATH "/home/lvuser/.vminfo"
1012
#define SERVER_CONFIG_PATH "/home/lvuser/.grpc_config"
@@ -52,3 +54,9 @@ namespace nFPGA {
5254
unsigned int g_currentTargetClass; //Ni FPGA declares this as extern, so define it here
5355
}
5456
}
57+
58+
namespace nLoadOut {
59+
tTargetClass EXPORT_FUNC getTargetClass() {
60+
return (tTargetClass) nFPGA::nRoboRIO_FPGANamespace::g_currentTargetClass;
61+
}
62+
}

emulation/hel/src/interrupt_manager.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ namespace nFPGA{
2424
}).detach();
2525
}
2626

27-
uint32_t tInterruptManager::watch(int32_t /*timeoutInMs*/, bool /*ignorePrevious*/, tRioStatusCode* /*status*/){
28-
hel::warnUnsupportedFeature("Function call tInterruptManager::watch");
29-
return 0;
27+
uint32_t tInterruptManager::watch(int32_t timeoutInMs, bool ignorePrevious, tRioStatusCode* /*status*/){
28+
// hel::warnUnsupportedFeature("Function call tInterruptManager::watch");
29+
if(timeoutInMs == 10000 && ignorePrevious == false)
30+
return !0;
31+
return 0;
3032
}
3133

3234
void tInterruptManager::enable(tRioStatusCode* /*status*/){

emulation/java_vm/Dockerfile

+26-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
FROM ubuntu:18.04 AS builder
44

5-
ENV WPILIB_VERSION v2020.3.2
6-
ENV SYNTHESIS_BRANCH emulator-restore
5+
ENV WPILIB_VERSION v2021.2.2
6+
ENV SYNTHESIS_BRANCH wpilib-2021
77
ENV TEMPPATH /temp
88
ENV PATH $TEMPPATH/bin:$PATH
99

@@ -69,7 +69,27 @@ RUN ${ENTER_HEL}/../java_vm/wpi_cross && \
6969
patch -p0 < ../AddressableLED.patch && \
7070
patch -p0 < ../FRCDriverStation.patch && \
7171
./gradlew halBaseLinuxx86-64ReleaseSharedLibrary halJNILinuxx86-64ReleaseSharedLibrary :wpilibj:assemble && \
72-
(./gradlew wpilibj:build || true) # This gradle build step will fail, but that's okay
72+
(./gradlew wpilibj:build || true)
73+
RUN ${ENTER_HEL}/../java_vm/wpi_cross/allwpilib && \
74+
cp wpilibc/src/main/native/include/frc wpilibOldCommands/src/main/native/include -r -f && \
75+
cp wpilibc/src/main/native/include/frc2 wpilibOldCommands/src/main/native/include -r -f && \
76+
cp wpiutil/src/main/native/include/wpi wpilibOldCommands/src/main/native/include -r -f && \
77+
cp ntcore/src/main/native/include/* wpilibOldCommands/src/main/native/include -r -f && \
78+
cp hal/src/main/native/include/* wpilibOldCommands/src/main/native/include -r -f && \
79+
cp wpimath/src/main/native/include/* wpilibOldCommands/src/main/native/include -r -f && \
80+
cp hal/build/generated/headers/* wpilibOldCommands/src/main/native/include -r -f && \
81+
./gradlew wpilibOldCommandsBaseLinuxx86-64DebugSharedLibrary
82+
RUN ${ENTER_HEL}/../java_vm/wpi_cross/allwpilib && \
83+
cp wpilibc/src/main/native/include/frc wpilibNewCommands/src/main/native/include -r -f && \
84+
cp wpilibc/src/main/native/include/frc2 wpilibNewCommands/src/main/native/include -r -f && \
85+
cp wpiutil/src/main/native/include/wpi wpilibNewCommands/src/main/native/include -r -f && \
86+
cp ntcore/src/main/native/include/* wpilibNewCommands/src/main/native/include -r -f && \
87+
cp hal/src/main/native/include/* wpilibNewCommands/src/main/native/include -r -f && \
88+
cp wpimath/src/main/native/include/* wpilibNewCommands/src/main/native/include -r -f && \
89+
cp wpimath/src/main/native/eigeninclude/Eigen wpilibNewCommands/src/main/native/include -r -f && \
90+
cp hal/build/generated/headers/* wpilibNewCommands/src/main/native/include -r -f && \
91+
./gradlew wpilibNewCommandsBaseLinuxx86-64DebugSharedLibrary
92+
7393

7494
# Move needed files into one location
7595
RUN mkdir $TEMPPATH/to_copy && \
@@ -90,9 +110,9 @@ RUN echo 'root:root' | chpasswd
90110

91111
RUN apt-get -y update
92112

93-
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends tzdata
113+
RUN DEBIAN_FRONTEND="noninteractive" apt install -y --no-install-recommends tzdata
94114

95-
RUN apt-get -y install --no-install-recommends \
115+
RUN apt -y install --no-install-recommends \
96116
linux-image-generic:amd64 \
97117
systemd-sysv \
98118
dbus \
@@ -135,6 +155,7 @@ RUN mv -n ./libhel.so \
135155
./libcscorejni.so \
136156
./libcscored.so \
137157
./libopencv*.so* \
158+
./libwpilib*Commands*.so* \
138159
./libntcorejni.so \
139160
./libntcored.so \
140161
/lib/
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
--- ./hal/src/main/native/sim/FRCDriverStation.cpp 2020-12-30 02:01:20.371892128 -0500
2-
+++ ./hal/src/main/native/sim/FRCDriverStation2.cpp 2020-12-30 02:02:19.458557374 -0500
3-
@@ -292,6 +292,10 @@
1+
--- ./hal/src/main/native/sim/FRCDriverStation.cpp 2021-03-27 16:47:26.558444755 -0700
2+
+++ ./hal/src/main/native/sim/FRCDriverStation2.cpp 2021-03-27 16:47:13.921777667 -0700
3+
@@ -288,6 +288,11 @@
44
}
55
}
66

7-
+#pragma GCC diagnostic push
8-
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
9-
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
10-
+
7+
+#pragma GCC diagnostic push
8+
+#if defined(__GNUC__) && (__GNUC__ > 8)
9+
+ #pragma GCC diagnostic ignored "-Wstringop-truncation"
10+
+ #pragma GCC diagnostic ignored "-Wstringop-overflow"
11+
+#endif
1112
char* HAL_GetJoystickName(int32_t joystickNum) {
1213
HAL_JoystickDescriptor joystickDesc;
1314
if (HAL_GetJoystickDescriptor(joystickNum, &joystickDesc) < 0) {
14-
@@ -307,6 +311,8 @@
15+
@@ -303,6 +308,8 @@
1516
}
1617
}
1718

1819
+#pragma GCC diagnostic pop
1920
+
20-
void HAL_FreeJoystickName(char* name) { std::free(name); }
21-
22-
int32_t HAL_GetJoystickAxisType(int32_t joystickNum, int32_t axis) {
21+
void HAL_FreeJoystickName(char* name) {
22+
std::free(name);
23+
}

0 commit comments

Comments
 (0)