This question is not specific to the Skyrise game, it does apply for this year but should apply for games going forward. Is it legal for a team to call a user defined function from the controller while in driver control mode. Specifically what we are thinking is to call part of our autonomous program when our robot is in a certain position. Part of our autonomous can stack Skyrise sections when in a certain spot on the field. We would like to call the program to stack another Skyrise while in driver control. this way our driver could position the robot prior to lifting the Skyrise and then allow the robot to do the precise steps to stack the Skyrise section.
Using a user defined function while in driver control
For sure, it is done by some teams, and I would highly recommend it.
It makes it much easier for drivers, as a preprogrammed function will usually work much more consistently and faster than anything a driver needs to do. For example, in Toss Up, we had a function to cap the big balls on the stash. Aligning by hitting the stash and pressing the button took around 2-3 seconds, but doing it manually took almost 10 seconds.
I encourage you to do this. Saves on code to download into the Cortex.
Areas previously used:
- PID control of lift heights tied to a button press
- “auto score” or “auto clamp” once you have aligned something and a button on the robot hits the object (like a skyrise base or skyrise piece)
- autonomous selector to set lights and LCD. Way easier to test this by calling it within driver control. Does not hurt much if the actual autonomous is not run.
- P or PID control of keeping a specific/current heading angle while driving (turn on or off with a button)
you may need to manage the initialization of global variables used to control these things once you enter in driver control. restarting tasks can be done via keeping them going or start them again. Your choice.
It is always a good idea to have a button to kill the operation in case something would happen. This could be done through a timer in your original code, or a abort button press in your user control.
It all depends on your driver. Ask what your experienced driver needs, rather than just simply writing what you think would be helpful. I spent much effort writing fixed skyrise pickup and align routine, but my driver can do it faster than PID program. So.