|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Error while deploying Command-Based Code
Hi everybody,
So this year we are extremely inexperienced in the programming department, as our lead programmer has graduated and our only other programmer really wasn't at the level he needed to be. I have done a lot of learning over the past few weeks but currently I've ran into an error with my code that I can't seem to figure out. I can provide code if anyone needs it, but basically I have a pneumatic subsystem along with a raise command and a lower(retract) command. (We did have one command that did both but switched to one for each in an attempt to get rid of some of the errors we faced). Very simple code all intended to open and close a piston. When I deploy code and enable the bot, the compressor starts up and it acts like it's working and then I get a no code error and everything shuts down. The main error I can't seem to get past is: "nhandled exception: edu.wpi.first.wpilibj.command.IllegalUseOfCommandE xception: Can not add new requirement to command after being started or being added to a command group" While we have other commands, most of them are doing nothing so I am almost certain it is something with the raise/lower commands. We don't have a command group so I'm assuming it has something to do with us trying to add a new requirement after a command is started. However, any "requires()" that I have in the commands is under init. No idea why this error is coming up or how to solve/troubleshoot it. Any help would be greatly appreciated. |
|
#2
|
|||
|
|||
|
Re: Error while deploying Command-Based Code
After further troubleshooting, the exact lines of code causing the error are our command.start lines under teleopInit in the robot class. I have seen other FRC code using this in the same place, not sure what is causing ours to not work.
|
|
#3
|
|||
|
|||
|
Re: Error while deploying Command-Based Code
It would be useful if you could post the source code for your command.
The requires() statements should only be invoked in the Command's constructor. Is it possible you have placed them in the Command's initialize() method? This might be the reason you are getting the error. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|