mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Rename myRobot to developerRobot and move docs to subproject (#6283)
This commit is contained in:
@@ -64,7 +64,7 @@ option(WITH_CSCORE "Build cscore (needs OpenCV)" ON)
|
||||
option(WITH_NTCORE "Build ntcore" ON)
|
||||
option(WITH_WPIMATH "Build wpimath" ON)
|
||||
option(WITH_WPIUNITS "Build wpiunits" ON)
|
||||
option(WITH_WPILIB "Build hal, wpilibc/j, and myRobot (needs OpenCV)" ON)
|
||||
option(WITH_WPILIB "Build hal, wpilibc/j, and developerRobot (needs OpenCV)" ON)
|
||||
option(WITH_EXAMPLES "Build examples" OFF)
|
||||
option(WITH_TESTS "Build unit tests (requires internet connection)" ON)
|
||||
option(WITH_GUI "Build GUI items" ON)
|
||||
@@ -405,7 +405,7 @@ if(WITH_WPILIB)
|
||||
if(WITH_EXAMPLES)
|
||||
add_subdirectory(wpilibcExamples)
|
||||
endif()
|
||||
add_subdirectory(myRobot)
|
||||
add_subdirectory(developerRobot)
|
||||
endif()
|
||||
|
||||
if(WITH_SIMULATION_MODULES AND NOT WITH_EXTERNAL_HAL)
|
||||
|
||||
@@ -89,15 +89,4 @@ wpi.versions.wpimathVersion = 'YEAR.424242.+'
|
||||
|
||||
# roboRIO Development
|
||||
|
||||
This repo contains a myRobot project built in way to do full project development without needing to do a full publish into GradleRIO. These also only require building the minimum amount of binaries for the roboRIO, so the builds are much faster as well.
|
||||
|
||||
The setup only works if the roboRIO is USB connected. If an alternate IP address is preferred, the `address` block in myRobot\build.gradle can be changed to point to another address.
|
||||
|
||||
The following 3 tasks can be used for deployment:
|
||||
* `:myRobot:deployShared` deploys the C++ project using shared dependencies. Prefer this one for most C++ development.
|
||||
* `:myRobot:deployStatic` deploys the C++ project with all dependencies statically linked.
|
||||
* `:myRobot:deployJava` deploys the Java project and all required dependencies. Also installs the JRE if not currently installed.
|
||||
|
||||
Deploying any of these to the roboRIO will disable the current startup project until it is redeployed.
|
||||
|
||||
From here, ssh into the roboRIO using the `lvuser` account and run `frcRunRobot.sh` (It's in path).
|
||||
See the [developerRobot](developerRobot/README.md) subproject.
|
||||
|
||||
8
developerRobot/CMakeLists.txt
Normal file
8
developerRobot/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
project(developerRobot)
|
||||
|
||||
include(CompileWarnings)
|
||||
|
||||
file(GLOB developerRobotCpp_src src/main/native/cpp/*.cpp)
|
||||
|
||||
add_executable(developerRobotCpp ${developerRobotCpp_src})
|
||||
target_link_libraries(developerRobotCpp wpilibc)
|
||||
43
developerRobot/README.md
Normal file
43
developerRobot/README.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# Developer Robot
|
||||
|
||||
This is a robot project built directly against this repo's sources. It builds the minimum required for deploying to a roboRIO, so it's faster than publishing the whole library to Maven first.
|
||||
|
||||
This command builds everything.
|
||||
```bash
|
||||
./gradlew developerRobot:build
|
||||
```
|
||||
|
||||
## Simulation
|
||||
|
||||
This command runs the C++ subproject on desktop.
|
||||
```bash
|
||||
./gradlew developerRobot:runCpp
|
||||
```
|
||||
|
||||
## Deploy to a roboRIO
|
||||
|
||||
This project can only deploy over USB. If an alternate IP address is preferred, the `address` block in developerRobot\build.gradle can be changed to point to another address.
|
||||
|
||||
This command deploys the C++ project using shared dependencies. Prefer this one for most C++ development.
|
||||
```bash
|
||||
./gradlew developerRobot:deployShared
|
||||
```
|
||||
|
||||
This command deploys the C++ project with all dependencies statically linked.
|
||||
```bash
|
||||
./gradlew developerRobot:deployStatic
|
||||
```
|
||||
|
||||
This command deploys the Java project and all required dependencies. It also installs the JRE if it's not currently installed.
|
||||
```bash
|
||||
./gradlew developerRobot:deployJava
|
||||
```
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
Console log prints will appear in the terminal.
|
||||
|
||||
Deploying any of these to the roboRIO will disable the current startup project until it is redeployed.
|
||||
@@ -22,8 +22,8 @@ application {
|
||||
}
|
||||
|
||||
ext {
|
||||
sharedCvConfigs = [myRobotCpp: []]
|
||||
staticCvConfigs = [myRobotCppStatic: []]
|
||||
sharedCvConfigs = [developerRobotCpp: []]
|
||||
staticCvConfigs = [developerRobotCppStatic: []]
|
||||
useJava = true
|
||||
useCpp = true
|
||||
skipDev = true
|
||||
@@ -94,30 +94,30 @@ deploy {
|
||||
}
|
||||
}
|
||||
|
||||
myRobotCpp(NativeExecutableArtifact) {
|
||||
developerRobotCpp(NativeExecutableArtifact) {
|
||||
libraryDirectory = '/usr/local/frc/third-party/lib'
|
||||
def excludes = getLibraryFilter().getExcludes()
|
||||
excludes.add('**/*.so.debug')
|
||||
excludes.add('**/*.so.*.debug')
|
||||
postdeploy << { ctx ->
|
||||
ctx.execute("echo '/home/lvuser/myRobotCpp' > /home/lvuser/robotCommand")
|
||||
ctx.execute("echo '/home/lvuser/developerRobotCpp' > /home/lvuser/robotCommand")
|
||||
ctx.execute("chmod +x /home/lvuser/robotCommand; chown lvuser /home/lvuser/robotCommand")
|
||||
ctx.execute("setcap cap_sys_nice+eip \"/home/lvuser/myRobotCpp\"")
|
||||
ctx.execute('chmod +x myRobotCpp')
|
||||
ctx.execute("setcap cap_sys_nice+eip \"/home/lvuser/developerRobotCpp\"")
|
||||
ctx.execute('chmod +x developerRobotCpp')
|
||||
}
|
||||
}
|
||||
|
||||
myRobotCppStatic(NativeExecutableArtifact) {
|
||||
developerRobotCppStatic(NativeExecutableArtifact) {
|
||||
libraryDirectory = '/usr/local/frc/third-party/lib'
|
||||
postdeploy << { ctx ->
|
||||
ctx.execute("echo '/home/lvuser/myRobotCppStatic' > /home/lvuser/robotCommand")
|
||||
ctx.execute("echo '/home/lvuser/developerRobotCppStatic' > /home/lvuser/robotCommand")
|
||||
ctx.execute("chmod +x /home/lvuser/robotCommand; chown lvuser /home/lvuser/robotCommand")
|
||||
ctx.execute("setcap cap_sys_nice+eip \"/home/lvuser/myRobotCppStatic\"")
|
||||
ctx.execute('chmod +x myRobotCppStatic')
|
||||
ctx.execute("setcap cap_sys_nice+eip \"/home/lvuser/developerRobotCppStatic\"")
|
||||
ctx.execute('chmod +x developerRobotCppStatic')
|
||||
}
|
||||
}
|
||||
|
||||
myRobotCppJava(NativeExecutableArtifact) {
|
||||
developerRobotCppJava(NativeExecutableArtifact) {
|
||||
libraryDirectory = '/usr/local/frc/third-party/lib'
|
||||
def excludes = getLibraryFilter().getExcludes()
|
||||
excludes.add('**/*.so.debug')
|
||||
@@ -127,10 +127,10 @@ deploy {
|
||||
jre(WPIJREArtifact) {
|
||||
}
|
||||
|
||||
myRobotJava(JavaArtifact) {
|
||||
developerRobotJava(JavaArtifact) {
|
||||
jarTask = shadowJar
|
||||
postdeploy << { ctx ->
|
||||
ctx.execute("echo '/usr/local/frc/JRE/bin/java -XX:+UseSerialGC -Djava.library.path=/usr/local/frc/third-party/lib -Djava.lang.invoke.stringConcat=BC_SB -jar /home/lvuser/myRobot-all.jar' > /home/lvuser/robotCommand")
|
||||
ctx.execute("echo '/usr/local/frc/JRE/bin/java -XX:+UseSerialGC -Djava.library.path=/usr/local/frc/third-party/lib -Djava.lang.invoke.stringConcat=BC_SB -jar /home/lvuser/developerRobot-all.jar' > /home/lvuser/robotCommand")
|
||||
ctx.execute("chmod +x /home/lvuser/robotCommand; chown lvuser /home/lvuser/robotCommand")
|
||||
}
|
||||
}
|
||||
@@ -142,29 +142,29 @@ deploy {
|
||||
tasks.register('deployJava') {
|
||||
try {
|
||||
dependsOn tasks.named('deployjreroborio')
|
||||
dependsOn tasks.named('deploymyRobotJavaroborio')
|
||||
dependsOn tasks.named('deploymyRobotCppJavaroborio') // Deploying shared C++ is how to get the Java shared libraries.
|
||||
dependsOn tasks.named('deploydeveloperRobotJavaroborio')
|
||||
dependsOn tasks.named('deploydeveloperRobotCppJavaroborio') // Deploying shared C++ is how to get the Java shared libraries.
|
||||
} catch (ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('deployShared') {
|
||||
try {
|
||||
dependsOn tasks.named('deploymyRobotCpproborio')
|
||||
dependsOn tasks.named('deploydeveloperRobotCpproborio')
|
||||
} catch (ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('deployStatic') {
|
||||
try {
|
||||
dependsOn tasks.named('deploymyRobotCppStaticroborio')
|
||||
dependsOn tasks.named('deploydeveloperRobotCppStaticroborio')
|
||||
} catch (ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
model {
|
||||
components {
|
||||
myRobotCpp(NativeExecutableSpec) {
|
||||
developerRobotCpp(NativeExecutableSpec) {
|
||||
targetBuildTypes 'debug'
|
||||
sources {
|
||||
cpp {
|
||||
@@ -181,8 +181,8 @@ model {
|
||||
binaries.all { binary ->
|
||||
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
|
||||
if (binary.buildType.name == 'debug') {
|
||||
deploy.targets.roborio.artifacts.myRobotCpp.binary = binary
|
||||
deploy.targets.roborio.artifacts.myRobotCppJava.binary = binary
|
||||
deploy.targets.roborio.artifacts.developerRobotCpp.binary = binary
|
||||
deploy.targets.roborio.artifacts.developerRobotCppJava.binary = binary
|
||||
}
|
||||
}
|
||||
lib project: ':apriltag', library: 'apriltag', linkage: 'shared'
|
||||
@@ -213,7 +213,7 @@ model {
|
||||
}
|
||||
}
|
||||
}
|
||||
myRobotCppStatic(NativeExecutableSpec) {
|
||||
developerRobotCppStatic(NativeExecutableSpec) {
|
||||
targetBuildTypes 'debug'
|
||||
nativeUtils.excludeBinariesFromStrip(it)
|
||||
sources {
|
||||
@@ -231,7 +231,7 @@ model {
|
||||
binaries.all { binary ->
|
||||
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
|
||||
if (binary.buildType.name == 'debug') {
|
||||
deploy.targets.roborio.artifacts.myRobotCppStatic.binary = binary
|
||||
deploy.targets.roborio.artifacts.developerRobotCppStatic.binary = binary
|
||||
}
|
||||
}
|
||||
lib project: ':apriltag', library: 'apriltag', linkage: 'static'
|
||||
@@ -254,12 +254,12 @@ model {
|
||||
def c = $.components
|
||||
project.tasks.create('runCpp', Exec) {
|
||||
group = 'WPILib'
|
||||
description = "Run the myRobotCpp executable"
|
||||
description = "Run the developerRobotCpp executable"
|
||||
def found = false
|
||||
def systemArch = getCurrentArch()
|
||||
def runTask = it
|
||||
c.each {
|
||||
if (it in NativeExecutableSpec && it.name == "myRobotCpp") {
|
||||
if (it in NativeExecutableSpec && it.name == "developerRobotCpp") {
|
||||
it.binaries.each {
|
||||
if (!found) {
|
||||
def arch = it.targetPlatform.name
|
||||
@@ -308,14 +308,14 @@ model {
|
||||
}
|
||||
installAthena(Task) {
|
||||
$.binaries.each {
|
||||
if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio && it.component.name == 'myRobotCpp') {
|
||||
if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio && it.component.name == 'developerRobotCpp') {
|
||||
dependsOn it.tasks.install
|
||||
}
|
||||
}
|
||||
}
|
||||
installAthenaStatic(Task) {
|
||||
$.binaries.each {
|
||||
if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio && it.component.name == 'myRobotCppStatic') {
|
||||
if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio && it.component.name == 'developerRobotCppStatic') {
|
||||
dependsOn it.tasks.install
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,6 @@ public final class Main {
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(MyRobot::new);
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ package frc.robot;
|
||||
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
public class MyRobot extends TimedRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
/**
|
||||
* This function is run when the robot is first started up and should be used for any
|
||||
* initialization code.
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <frc/TimedRobot.h>
|
||||
|
||||
class MyRobot : public frc::TimedRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
/**
|
||||
* This function is run when the robot is first started up and should be
|
||||
* used for any initialization code.
|
||||
@@ -43,5 +43,5 @@ class MyRobot : public frc::TimedRobot {
|
||||
};
|
||||
|
||||
int main() {
|
||||
return frc::StartRobot<MyRobot>();
|
||||
return frc::StartRobot<Robot>();
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
project(myRobot)
|
||||
|
||||
include(CompileWarnings)
|
||||
|
||||
file(GLOB myRobotCpp_src src/main/native/cpp/*.cpp)
|
||||
|
||||
add_executable(myRobotCpp ${myRobotCpp_src})
|
||||
target_link_libraries(myRobotCpp wpilibc)
|
||||
@@ -52,7 +52,7 @@ include 'cameraserver:multiCameraServer'
|
||||
include 'wpilibNewCommands'
|
||||
include 'romiVendordep'
|
||||
include 'xrpVendordep'
|
||||
include 'myRobot'
|
||||
include 'developerRobot'
|
||||
include 'docs'
|
||||
include 'msvcruntime'
|
||||
include 'ntcoreffi'
|
||||
|
||||
Reference in New Issue
Block a user