|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: detecting your own alliance(C++)
Before the match, you have what's called a "constructor" period in the SimpleRobot.cpp template which MIGHT be able to be used to run code in disabled, but my sources haven't tried it yet. If you use the BuiltinDefaultCode.cpp template (iterative template), there's a class for disabled mode. Basically, constructor is the equivalent of Initialize() or IO_Initialization() of the PIC version of WPILib, except I think it runs more than once. Using the disabled mode period, you can run code whenever the robot is disabled, the controller is just introverted; you can read inputs and run code, but you cannot run motors or set outputs until you're enabled.
That being said, that period is the perfect time to figure out where you are and what you're doing with the camera right after the cRIO boots up. With the complexity of the control system this year, there is no reason for your processor to have downtime. You can always be reading a sensor or analyzing visual data to find out where your opponents are and where your alliance members are. That way you know where those robots are already, and can track them when they dart off at the beginning of autonomous and plot a projected course for their trailers to meet very nicely with your moon rocks flying through the air But seriously, do use the camera. |
|
#2
|
||||
|
||||
|
Re: detecting your own alliance(C++)
If only just to take rad pictures.
|
|
#3
|
||||
|
||||
|
Re: detecting your own alliance(C++)
Quote:
If you examine WPILib, the START_ROBOT_CLASS macro passes startRobotTask() a function that creates an object of your RobotBase derived class. Once it starts the robot task, it creates your object. This is only done once (or at least, only when FRC_UserProgram_StartupLibraryInit() is called). Strictly speaking, FRC_UserProgram_StartupLibraryInit (also defined in the START_ROBOT_CLASS macro) is more like Initialize() or IO_Initialization()... but of course it gets called before your task is created and its probably not a particularly great idea to use it. ![]() |
|
#4
|
|||
|
|||
|
Inside the WPI library, look in the driverstation.cpp file.
Inside there, you'll find that there is a function to tell you what alliance you are on (also, there is one that will tell you what station you're plugged into, 1,2, or 3) Quote:
![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Make your own CNC | whytheheckme | Technical Discussion | 8 | 07-25-2007 02:13 AM |
| Your Own Team Siggies | Cujo | General Forum | 8 | 02-26-2005 04:01 PM |
| any of your regional "buddies" with your in your alliance? | Alex Cormier | Championship Event | 12 | 04-08-2004 04:20 AM |
| How do you tell whether your sensor is detecting a crate or the diamond plate? | Greg Ross | Technical Discussion | 4 | 01-13-2003 07:02 PM |
| Making your own gearbox? | ChaosMonkey | Motors | 15 | 05-25-2002 11:07 AM |