View Full Version : RobotBuilder Extensions
phurley67
14-11-2016, 15:53
Reading the documentation I noticed RobotBuilder support extensions. I was able to create a component, with a custom base class.
Now I would like to create a custom command base. Pretty sure at the very least I need different keys in my Java Export.yaml file, and quite likely would want/need custom export files.
Before I start reading the source code, I was hoping someone else had already tried this and might be able to share an example.
Thanks
Joe Ross
15-11-2016, 23:55
What do you mean by custom command base?
I've only made components.
phurley67
16-11-2016, 07:01
Based on what I have seen reading the source YAML. I have been able to create a "TimedCommand". The many of our commands should complete quickly or timeout -- I would like to capture that idea in robot builder and have a timeout parameter. The generated code would include the isFinished command using the timeout parameter.
I have been able to create the timed command in our command palette, and add the timeout parameter, but have not yet been able to customize the code generator for my the timed command.
phurley67
20-11-2016, 01:32
Okay found my problem (my silly mistake of course) -- I had a typo in the Java Export.yaml and the section name did not match my Command name.
I was able to generate my command, and add parameters, but the ClassName in the YAML is ignored. If I go into the the RobotBuilder source code and make the following changes:
+#macro( klass $cmd )#if( "#type($cmd)" == "" )Command#else#type($cmd)#end#end
import edu.wpi.first.wpilibj.command.Command;
import ${package}.Robot;
/**
*
*/
-public class #class($command.name) extends Command {
+public class #class($command.name) extends #klass($command) {
It seems to work (sorry if my velocity templating is goofy, I just sort of hacked at it till I got it to work). What I really would like to do is provide my own velocity templates for my own components -- any chance of making this a possibility? (or is it and I totally missed it :-)
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.