Hello, we are having problems with command based programming. In our code, we are calling the shooting command from robot.java using a lambda, however it never reaches the initialize function within the command.
It prints the first string, and passes the requirements, but never prints initialized or calls the shooter functions from the turret subsystem. Any suggestions?
You shouldnât need a lambda for what youâre trying to do. The lambda expression as written essentially runs a command that creates an instance of âShootingCommandâ and then exits. If your goal is to directly run âShootingCommandâ you would want to write:
If the reason you are doing this is because you only want oi.l1() to be evaluated when the command actually runs, you could consider passing it in as âoi::l1â instead which will pass the method into the constructor instead of the value that method takes. This is called a method reference. You can then call that method during initialize:
Thanks for the suggestion, and it works great! But now other things arenât working~
Now the command unexpectedly ends itself once it reaches the shooting part;
Where is intake_subsystem in your command being initialized/passed to the Command. I only see you passing turret_subsystem to your command from your RobotContainer.
Thanks for the suggestion gixxy, but github just reallllllllly hates me for some reason, not allowing me to push or pull from remotes due to a authentication bug.
I⌠have a lot of comments. Unfortunately, they all boil down to âplease read the docsâ.
I shouldâve noticed this much earlier. Sorry about that.
First and foremost, these should be in RobotContainer. In fact, you really shouldnât have to touch Robot.java much at all with the ânewâ command-based framework.
To go beyond that, Iâll need to know what your current problem is.
Alrighty, so the shooting command doesnât seem to stop, either due to the timer giving weird values or the buttonpress not returning that the button has stopped being pressed.
Again, I do recommend reading through the command-based docs and considering starting a new project then copying your logic into that format. If nothing else, itâll be MUCH easier for other teams or CSAs to help you with any issues you might experience at your event(s).