FIRST Robot Simulator - SimControlObject
 @(#) $Header: /usr/local/scalawags_cvs/Scalawags/Simulator2006/SimControl.wc,v 1.1 2006/03/13 23:15:57 abrown Exp $ 


What Is Simulated

SimControl doesn't simulate anything but instead provides a control and viewing structure for the overall simulation.


Where Used

SimControl provides critical infrastructure used by TheSimulationPanel .


GUI View

The buttons "Auto", "Manual", and "Disable" replicate the functionality on the competition switch.

In a real system the ratio of fast cycles versus slow cycles is determined by the speed of the processor versus the speed of the code in the FRC. Since this information is inaccessible to the simulation, a slider is provided to dial in a reasonable guess. By using an oscilloscope it should be possible to actually measure this on your robot. In practice I find that 10 is a reasonable guess. But since larger numbers cause the simulation to run slower and since most FRC code is not dependent on this, I usually simulate with a smaller number.

SimSpeed controls the run rate of the simulation.

The buttons "RUN", "STOP", "STEP" act much like a cassette tape player. The "EXIT" button quits the simulation.


Programmers View

There are 6 proc[edures] in SimControl.tcl. The first few lines of each proc lists the parameters required. However, most of these proc's are referenced only in SimControl itself and don't need to be adjusted.

At this time Simcontrol is a singleton. There is no sensible way to create more than one.

  proc new { {SimcontrolName} {NameOnCanv} {clock} \
			      {cycleslow} {cyclefast} {fastratio} \
			      {minutesvar} {secondsvar} {file} } \
  {
  

The parameters "SimControlName" and "NameOnCanv" are constants. The parameters "cycleslow", "cyclefast", "fastratio", "minutesvar", and "secondsvar" are the names of variables that you provide to SimControl. The parameter "file" is the logfile ID.

  proc set { {SimControlName} } \
  {
  

::Simcontrol::set does not need to be explicitly called by the user. That is handled by the bindings in side of ::SimControl::new and by the call at the end of updatePos in RoboSystem.tcl. This call updates the time and cycles display. It also schedules another updatePos call if we are in "RUN" state.



Last modified 11 Dec 2006
http://brown.armoredpenguin.com/~abrown/contact.html
http://brown.armoredpenguin.com/~abrown/first/first2006/Scalawags/Simulator2006/SimControl.html