Attaching the IntelliJ IDEA debugger to the robot to debug Java and/or Kotlin works fine, and has for many years. I have done it numerous times. I merely need to get the process documented. (Unfortunately an elderly parent entering home hospice has dominated my time the past 6 weeks. So I’ve not had a chance to get to documenting this. And as mentioned above, I know I need to do better at documenting my plugin. Just never enough time in the day.)
Here are the rough instructions…
If you create a robot project in IntelliJ IDEA, or go to Tools > FRC > Create Run/Debug Configurations > Create Build, Deploy and Debugging Run/Debug Configurations in a robot project created externally, you will have run/debug configurations for debugging the robot:
Basically you:
- Run one of the “Build & Deploy Robot for debugging” Run/Debug Configurations (the one just runs the
clean
task before the build & deploy)
- As the above finishes, you will attach the debugger via the next step. This is the part I need to refresh my memory on by doing this on a roboRIO. I can’t recall if the deploy pauses with a “waiting for debugger to attach” message, or if it continues with a “ready for debugger attachment” message.
- Then run, via the debug button, one of the “Debug Robot via X” Run/Debug Configurations depending on how you are attached to the robot. (“IP” is for either Ethernet tether or WiFi)
As others have mentioned, you can code Java and/or Kotlin with IntelliJ IDEA. You could even code Kotlin with VS Code. There is a Kotlin extension for VS Code. I just don’t know how good (or bad) an experience it is. Kotlin coding in IntelliJ IDEA will be a much better experience. And I would argue coding Java in IntelliJ IDEA will be a better experience. But I’ve been using IntelliJ IDEA since 2003 (so 21 years now) and am thus pretty devoted to IntelliJ IDEA. (I started my IntelliJ IDEA plugin when I started mentoring because I didn’t want to use NetBean (at the time), and later Eclipse, and finally VS Code to write robot code. I’ve been using IntelliJ IDEA the entire time.)
I also love Kotlin. I worked solely in Java since it’s release in 1995. And know its ecosystem extremely well. I tried Groovy and Scala when they came out, and didn’t care for them. Then I tried Kotlin when it came out and fell in love with it instantly. I’ve began using it on the side for personal projects since it was released in beta in mid 2010. Then immediately began using it professionally and for our robots when Kotlin 1.0 was released in Feb 2016. (My company now does 100% of our coding in Kotlin.) Initially in our robots in 2016 I used it for some utility classes. in 2017 our robot was about 40-50% Kotlin, and 50-60% Java. For 2018 and beyond, we’ve been 100% (or at least 95% plus) Kotlin. Kotlin has phenomenal interoperability with Java. So you could start by writing just some code in Kotlin, such as Unit Tests and Utilities. The next year maybe write 1 or 2 subsystems in Kotlin, or maybe the commands. Or just go for it and start using Kotlin fully.
I personally think Kotlin is a much easier language to teach for a variety of reasons. Since switching to it, I can get students with no programming experience writing and understanding code much quicker than when we used Java.
I also agree with @Oblarg and @bdaroz comments… you can still get help from CSAs on “what you need to do”, then you just write it in Kotlin. Heck, the CSA can even show you in Java, and then you can convert it. (If you are not aware, you can convert any Java Class to Kotlin in IntelliJ IDEA via Ctrl+Alt+Shift+K
, and if you copy Java code, say from an online code example snippet, and go to paste it into a Kotlin code, IntelliJ IDEA will convert the Java code to Kotlin.
Agree 1 Million percent. Writing command based robots in Kotlin is so elegant. For example, creating a gamepad and adding commands:
CommandXboxController(codriverPort).apply {
povUp().onTrue(ClimberStartDecentCommand())
povDown().onTrue(ClimberStartClimbCommand())
povLeft().onTrue(ClimberStopCommand())
a().onTrue(StartIntakeCommand())
// etc
}
Anyways, I’d encourage you to go for it with Kotlin. More and more teams are moving to it. And usage of my IntelliJ IDEA plugin grows each year. I’m currently at a little over 1,200 unique users based on JetBrains Marketplace analytics. So you will be in good company.