com.yobotics.simulationconstructionset
Class SimulationConstructionSet

java.lang.Object
  extended by com.yobotics.simulationconstructionset.SimulationConstructionSet
All Implemented Interfaces:
AddCameraKeyCommandExecutor, AddKeyPointCommandExecutor, CreateNewGraphWindowCommandExecutor, CreateNewViewportWindowCommandExecutor, CropBufferCommandExecutor, DataBufferCommandsExecutor, ExportSnapshotCommandExecutor, GotoInPointCommandExecutor, GotoOutPointCommandExecutor, NextCameraKeyCommandExecutor, PackBufferCommandExecutor, PlayCommandExecutor, PreviousCameraKeyCommandExecutor, RemoveCameraKeyCommandExecutor, RunCommandsExecutor, SetInPointCommandExecutor, SetOutPointCommandExecutor, SimulateCommandExecutor, StepBackwardCommandExecutor, StepForwardCommandExecutor, StopCommandExecutor, ToggleCameraKeyModeCommandExecutor, ToggleKeyPointModeCommandExecutor, WriteDataCommandExecutor, GUIEnablerAndDisabler, TimeHolder, YoVariableHolder, java.lang.Runnable

public class SimulationConstructionSet
extends java.lang.Object
implements java.lang.Runnable, YoVariableHolder, RunCommandsExecutor, AddKeyPointCommandExecutor, AddCameraKeyCommandExecutor, CreateNewGraphWindowCommandExecutor, CreateNewViewportWindowCommandExecutor, CropBufferCommandExecutor, ExportSnapshotCommandExecutor, GotoInPointCommandExecutor, GotoOutPointCommandExecutor, NextCameraKeyCommandExecutor, PackBufferCommandExecutor, PreviousCameraKeyCommandExecutor, RemoveCameraKeyCommandExecutor, SetInPointCommandExecutor, SetOutPointCommandExecutor, StepBackwardCommandExecutor, StepForwardCommandExecutor, ToggleCameraKeyModeCommandExecutor, ToggleKeyPointModeCommandExecutor, GUIEnablerAndDisabler, WriteDataCommandExecutor, TimeHolder, DataBufferCommandsExecutor

Title: SimulationConstructionSet

Description: Class for constructing a simulation and for setting many of the configuration options for the simulation. Many of the methods provided by this class provide easy access to features that may be modified directly elsewhere. As a result the documentation provided in this class is of a general nature; for more detailed information see the tutorial or the class in question.

Cameras and Viewports

The simulation construction set provides a camera interface that is both robust and versatile. Cameras can easily be configured to track or follow your robot from any conceivable angle. The following provides a brief introduction to this functionality. For more detailed information see Camera and ViewportConfiguration.

Cameras

Each camera has two main parameters: fix and position. A camera's fix is the point in space at which the camera is looking, while the position is the location of the camera itself. These parameters can be configured at any time for the camera currently selected by the user. This camera is often referred to as the currently active camera and is identified by the red outline which surrounds it.

Cameras may also be configured to track or follow the robot. These two modes are referred to as track and dolly respectively. In track mode the camera remains stationary keeping the robot in view by moving its fix. When in dolly mode the camera's position is modified to keep up with the robot. If both modes are enabled the camera will keep up with the robot while maintaining a constant view. These features function by monitoring a YoVariable for each axis using the change in its value to modify the fix and or position of the camera. The variables used by dolly and track modes are independant and may be changed at any time. Each mode may also be configured with an offset to augment the fix or position with respect to the target. In track mode this offset defaults to zero, keeping the camera's view directly on the target. Dolly mode has a default offset of (2.0,12.0,0.0) without which the camera would be ontop of the robot.

A camera may also be mounted to the robot itself, providing a "robot cam" view. To accomplish this, a camera mount must be created and added to a joint on the robot. Once the mount exists it may be specified by name in a camera configuration. There is no way to mount a camera to the robot without a configuration.

While the ability to manipulate the active camera is useful, the true power of this system is the ability to store predefined camera configurations for easy access. Once configured, a camera may be accessed in the GUI via the Viewport drop down menu or added to a ViewportConfiguration. The following are several examples of camera configurations.

CameraConfiguration camera1 = new CameraConfiguration("camera 1");
camera1.setCameraFix(0.0, 0.0, 0.6);
camera1.setCameraPosition(-9.0, 3.0, 0.8);
camera1.setCameraTracking(true, true, true, false);
camera1.setCameraDolly(false, true, true, false);
sim.setupCamera(camera1);

CameraConfiguration camera2 = new CameraConfiguration("camera 2");
camera2.setCameraFix(0.0, 0.0, 0.6);
camera2.setCameraPosition(-9.0, 3.0, 0.15);
camera2.setCameraTracking(true, true, true, false);
camera2.setCameraDolly(true, true, true, false);
camera2.setCameraDollyOffsets(-3.6, 4.0, 0.0);
camera2.setCameraTrackingOffsets(0.0, 0.0, 0.0);
sim.setupCamera(camera2);

CameraConfiguration camera3 = new CameraConfiguration("robot cam");
camera3.setCameraMount("robot cam mount");
sim.setupCamera(camera3);

In the examples above camera 1 is tracking only, camera 2 is tracking and dollying, and camera 3 is mounted to the robot. "sim" is an instance of SimulationConstructionSet

ViewportConfigurations

Once several CameraConfigurations have been created and added to the simulation, a ViewportConfiguration may be assembled. ViewportConfigurations allow a set of cameras to be displayed in a single window with each camera assigned to a specific position and size. Once created, ViewportConfigurations may be selected via the Viewport drop down menu. It is also possible to create a ViewportWindow based on a ViewportConfiguration.

Display Groups

A single simulation can easily involve a large number of variables which the user is interested in displaying. This section provides a general overview of the methods currently implemented to facilitate this.

VarGroups

VarGroups provide a convienent means by which to group and reference YoVariables. A group may be created by providing a list of YoVariable names, regular expressions, or both. By default, a group named "all" containing every simulation variable is created. Once created, a VarGroup may be selected for display from the Configuration drop down menu. VarGroups are also used during the creation of Configurations and while exporting data.

sim.setupVarGroup("kinematics", new String[]{"t"}, new String[]{"q_.*", "qd_.*"});

In the example above, a VarGroup named kinematics is created which contains the YoVariable named "t" along with all YoVariables who's names begin with "q_." or "qd_.".

sim.setupVarGroup("torques", null, new String[]{"t", "tau_.*"});

This example creates a VarGroup named "torques" containing the variable "t" as well as all YoVariables who's names begin with "tau_.". For more information on regular expressions see java.util.regex.Pattern.

GraphGroups

Much like VarGroups, graph groups provide a means to store and reference a set of graphs. GraphGroups are identified by name and contain a list of graphs, each of which may display a maximum of four variables. At creation, separate GraphConfigurations can be provided for each graph which allow the configuration of graph min and max values. Once a GraphGroup has been added to the simulation it may be selected from the configuration drop down menu. Separate GraphWindows similar to ViewportWindows may be creating using a specific GraphGroup, which is often helpful when screen space is an issue. GraphGroups can be used in conjunction with VarGroups when Configurations are created.

sim.setupGraphGroup("states", new String[][]{{"left_state", "right_state"}, {"t"}, {"q_x", "q_z"}});

The example above creates a GraphGroup named "states" containing the following three graphs:

  1. "left_state" and "right_state"
  2. "t"
  3. "q_x" and "q_z"
When multiple variables are present in a single graph, each variable has a different color.

sim.setupGraphGroup("joint angles", new String[][]{{"left_state", "right_state"}, {"q_lh"}, {"q_lk"}, {"q_la"}, {"q_rh"}, {"q_rk"}, {"q_ra"}});
. sim.setupGraphGroup("joint velocities", new String[][]{{"qd_lh"}, {"qd_lk"}, {"qd_la"}, {"qd_rh"}, {"qd_rk"}, {"qd_ra"}});

Examples two and three create a graph per specified variable.

sim.setupGraphGroup("joint torques", new String[][]{{"tau_lh"}, {"tau_lk"}, {"tau_la"}, {"tau_rh"}, {"tau_rk"}, {"tau_ra"}}, 2);

In example four, each variable has a separate graph, however, these graphs are displayed in two columns. Graphs are placed left to right, top to bottom beginning at the top left corner. A single graph panel can display a maximum of 24 graphs over 4 columns.

EntryBoxGroups

EntryBoxGroups provide an easy means to select between different sets of variables for entry. Once created an EntryBoxGroup may be selected from the Configuration drop down menu and or added to a Configuration directly. Entry boxes appear at the bottom of the main GUI frame and allow the user to modify variable values during simulation. EntryBoxGroups are referenced by their names given at creation. YoVariables may be specified by name or by regular expression when added.

sim.setupEntryBoxGroup("control vars1", new String[]{"t_gain","t_damp","hip_d","hip_hold","hip_gain","hip_damp", "swing_gain_knee","swing_damp_knee", "q_x", "q_y", "q_z"});
sim.setupEntryBoxGroup("control vars1", new String[]{"t_gain","t_damp","hip_d","hip_hold","hip_gain","hip_damp", "swing_gain_knee","swing_damp_knee"}, new String[]{"q_*"});

In the first example, the 11 variables are specified by name. The second example specifies some variables by name as well as including an array of regular expressions to be used in finding additional variables.

Copyright: Copyright (c) 2005

Company: Yobotics, Inc.

Version:
1.0
Author:
Jerry Pratt

Field Summary
static int DEFAULT_INITIAL_BUFFER_SIZE
          The default size of the data buffer in record steps.
static java.lang.String rootRegistryName
           
 
Constructor Summary
SimulationConstructionSet()
          Creates a SimulationConstructionSet with no Robot.
SimulationConstructionSet(boolean showGUI, int initialBufferSize)
          Creates a SimulationConstructionSet with no Robot.
SimulationConstructionSet(Robot robot)
          Creates a SimulationConstructionSet with the specified Robot.
SimulationConstructionSet(Robot[] robots)
           
SimulationConstructionSet(Robot[] robots, boolean showGUI)
           
SimulationConstructionSet(Robot[] robotArray, boolean showGUI, int initialBufferSize)
           
SimulationConstructionSet(Robot[] robotArray, Graphics3DAdapter graphicsAdapter, int initialBufferSize)
           
SimulationConstructionSet(Robot[] robot, int initialBufferSize)
           
SimulationConstructionSet(Robot[] robots, javax.swing.JApplet jApplet)
          Creates a SimulationConstructionSet with the specified Robot.
SimulationConstructionSet(Robot[] robotArray, SupportedGraphics3DAdapter supportedGraphicsAdapter, int initialBufferSize)
           
SimulationConstructionSet(Robot robot, boolean showGUI)
          Creates a SimulationConstructionSet with the specified Robot and GUI flag.
SimulationConstructionSet(Robot robot, boolean showGUI, int initialBufferSize)
          Creates a SimulationConstructionSet with the specified Robot and DataBuffer size.
SimulationConstructionSet(Robot robot, Graphics3DAdapter graphicsAdapter, int initialBufferSize)
           
SimulationConstructionSet(Robot rob, int initialBufferSize)
          Creates a SimulationConstructionSet with the specified Robot and DataBuffer size.
SimulationConstructionSet(Robot robot, javax.swing.JApplet jApplet)
           
SimulationConstructionSet(Simulation simulation, boolean showGUI)
           
SimulationConstructionSet(Simulation simulation, Graphics3DAdapter graphicsAdapter)
           
 
Method Summary
 void addButton(javax.swing.JButton button)
          This function adds the specified button to the SCS GUI.
 void addCameraKey()
          Makes the current data point a CameraKeyPoint.
 void addCheckBox(javax.swing.JCheckBox checkBox)
          This function adds the specified button to the SCS GUI.
 GraphicsDynamicGraphicsObject addDynamicGraphicObject(DynamicGraphicObject dynamicGraphicObject)
           
 GraphicsDynamicGraphicsObject addDynamicGraphicObject(DynamicGraphicObject dynamicGraphicObject, boolean updateFromSimulationThread)
           
 void addDynamicGraphicObjectListRegistries(DynamicGraphicObjectsListRegistry dynamicGraphicObjectsListRegistry)
           
 void addExtraJpanel(java.awt.Component extraPanel, java.lang.String name)
           
 void addJLable(javax.swing.JLabel label)
           
 void addKeyPoint()
          Makes the current data point a KeyPoint.
 void addMenuBar(javax.swing.JMenuBar menuBar)
          This function adds the specified button to the SCS GUI.
 void addRadioButton(javax.swing.JRadioButton button)
          This function adds the specified button to the SCS GUI.
 void addScript(Script script)
          Add the specified script to this simulation.
 void addSimulateDoneListener(SimulationDoneListener listener)
          Add a simulate done listener to the simulation.
 void addStaticLink(Link staticLink)
          Adds a static Link to the display environment.
 void addStaticLinkGraphics(java.util.ArrayList<Graphics3DObject> staticLinkGraphics)
           
 Graphics3DNode addStaticLinkGraphics(Graphics3DObject staticLinkGraphics)
           
 Graphics3DNode addStaticLinkGraphics(Graphics3DObject staticLinkGraphics, Graphics3DNodeType nodeType)
          Adds a static LinkGraphics to the display environment.
 void addVarList(VarList newVarList)
          Adds all of the YoVariables contained in the specified VarList to the simulation.
 void addVarLists(java.util.ArrayList<VarList> newVarLists)
          Adds all of the YoVariables contained in the provided ArrayList of VarLists to the simulation.
 void addVarLists(VarList[] newVarLists)
          Adds all of the YoVariables contained in the provided list of VarLists to the simulation.
 void addYoVariableRegistry(YoVariableRegistry registry)
           
 RobotSocketConnection allowTCPConnectionToHost(java.lang.String HOST)
           
 RobotSocketConnection allowTCPConnectionToHost(java.lang.String HOST, java.util.ArrayList<NewDataListener> newDataListeners)
          Creates a SCSRobotGUICommandListener which communicates to a robot at the specified ethernet HOST address.
 RobotSocketConnection allowTCPConnectionToHost(java.lang.String HOST, NewDataListener newDataListener)
           
 void applyDataProcessingFunction(DataProcessingFunction dataProcessingFunction)
          Applies a function to the recorded data starting from the in point to the out point.
 void attachExitActionListener(ExitActionListener listener)
          Add another ExitActionListener to the set which is triggered by closing the simulation environment GUI.
 void attachPlaybackListener(PlaybackListener playbackListener)
          Attaches the specified PlaybackListener to the simulation.
 void attachSelectedListener(SelectedListener selectedListener)
          Adds the specified SelectedListener.
 void attachSimulationRewoundListener(SimulationRewoundListener simulationRewoundListener)
          Adds the specified SimulationRewoundListener.
 void bringToFront()
           
 void changeBufferSize(int bufferSize)
          Either increase or decrease the data buffer's size in units of ticks.
 void closeAndDispose()
           
 void createMovie(java.io.File movieFile)
           
 java.io.File createMovie(java.lang.String movieFilename)
           
 void createNewGraphWindow()
           
 void createNewGraphWindow(java.lang.String graphGroupName)
          Creates a new window containing the specified graph group.
 void createNewGraphWindow(java.lang.String graphGroupName, int screenID, boolean maximizeWindow)
          Creates a new window containing the specified graph group.
 ViewportWindow createNewViewportWindow()
           
 ViewportWindow createNewViewportWindow(java.lang.String viewportName)
          Creates a new window containing the specified viewport configuration.
 ViewportWindow createNewViewportWindow(java.lang.String viewportName, int screenID, boolean maximizeWindow)
          Creates a new window containing the specified viewport configuration.
 void cropBuffer()
          Crops the data buffer to the current in and out points.
 void disableGUIComponents()
          If the GUI exists, stop whatever it is doing and disable user actions.
 void doControl()
          Calls the doControl() method of the robots contained in the underlying Simulator.
 void doDynamicsAndIntegrate()
          Does the dynamics and integrates the state equations for all the robots contained in the underlying Simulator.
 void enableGUIComponents()
          If the GUI exists, enable user actions.
 void exportRobotDefinition(Robot robot, java.io.File chosenFile)
           
 void exportSnapshot(java.io.File snapshotFile)
          Exports a snapshot from the currently active view.
 void exportSnapshot(java.io.File snapshotFile, CaptureDevice captureDevice)
           
 void exportSnapshot(java.io.File snapshotFile, ViewportWindow viewportSelector)
          Exports a snapshot from the passed viewportSelector.
 java.awt.image.BufferedImage exportSnapshotAsBufferedImage()
           
 java.awt.image.BufferedImage exportSnapshotAsBufferedImage(CaptureDevice captureDevice)
           
static SimulationConstructionSet generateSimulationFromDataFile(java.io.File chosenFile)
           
 java.util.ArrayList<YoVariable> getAllVariables()
          Returns all the YoVariables in this YoVariableHolder
 YoVariable[] getAllVariablesArray()
          Returns all the YoVariables in this YoVariableHolder
 DataBuffer getDataBuffer()
          Accessor method for the data buffer used by this simulation.
 double getDT()
          Get the simulation step size in seconds.
 DynamicGraphicMenuManager getDynamicGraphicMenuManager()
           
 Graphics3DAdapter getGraphics3dAdapter()
           
 int getIndex()
          Get the current simulation index (tick).
 int getInPoint()
           
 javax.swing.JFrame getJFrame()
          Retrieve the frame of this SimulationConstructionSet.
 int getOutPoint()
           
 double getPlaybackFrameRate()
          Retrive the playback frame rate in seconds per frame.
 double getPlaybackRealTimeRate()
          Retrieve the current real time rate which is the percentage of real time the simulator is displaying.
 double getRecordFreq()
          Gets the Record Frequency for the simulation.
 Robot[] getRobots()
          Retrieves the Robots used in this simulation.
 YoVariableRegistry getRootRegistry()
           
 java.lang.String getRunningName()
           
 double getSimulateDuration()
           
 StandardSimulationGUI getStandardSimulationGUI()
           
 long getTicksPerPlayCycle()
           
 double getTime()
           
 YoVariable getVariable(java.lang.String varname)
          Deprecated. 
 YoVariable getVariable(java.lang.String nameSpace, java.lang.String varname)
          Gets a YoVariable with the given nameSpace and name if it is in this YoVariableHolder, otherwise returns null.
 java.util.ArrayList<YoVariable> getVariables(NameSpace nameSpace)
          Returns all the YoVariables with the given nameSpace that are in this YoVariableHolder, empty if there are none.
 java.util.ArrayList<YoVariable> getVariables(java.lang.String varname)
          Returns all the YoVariables with the given name that are in this YoVariableHolder, empty if there are none.
 java.util.ArrayList<YoVariable> getVariables(java.lang.String nameSpace, java.lang.String varname)
          Returns all the YoVariables with the given nameSpace and name that are in this YoVariableHolder, empty if there are none.
 java.util.ArrayList<YoVariable> getVariablesThatContain(java.lang.String searchString)
          Retrieves an ArrayList containing the YoVariables with names that contain searchString.
 java.util.ArrayList<YoVariable> getVariablesThatContain(java.lang.String searchString, boolean caseSensitive)
          Retrieves an ArrayList containing the YoVariables whos names contain the search string.
 java.util.ArrayList<YoVariable> getVariablesThatStartWith(java.lang.String searchString)
          Retrieves an ArrayList containing the YoVariables with names that start with the searchString.
 java.util.ArrayList<YoVariable> getVars(java.lang.String[] varNames, java.lang.String[] regularExpressions)
          Given an array of YoVariable names and an array of regular expressions this function returns an ArrayList of the YoVariables whos name's fit the regular expression.
static java.lang.String getVersion()
           
 void gotoInPoint()
          Move the current data point to inPoint.
 void gotoInPointNow()
          Causes execution to continue from the inPoint.
 void gotoOutPoint()
          Moves the current data point to the outPoint.
 void gotoOutPointNow()
           
 boolean hasUniqueVariable(java.lang.String varname)
          Checks if this YoVariableHolder holds exactly one YoVariable with the given name.
 boolean hasUniqueVariable(java.lang.String nameSpace, java.lang.String varname)
          Checks if this YoVariableHolder holds exactly one YoVariable with the given nameSpace and name.
 void hideAllDynamicGraphicObjects()
           
 void hideViewport()
          Hides the main viewport integrated into the SCS GUI.
 boolean isGraphsUpdatedDuringPlayback()
          Check to see if graph updates are enabled during playback.
 boolean isIndexBetweenInAndOutPoint(int indexToCheck)
           
 boolean isKeyPointModeToggled()
          Indicates whether or not KeyPoints are in use.
 boolean isSimulating()
           
 boolean isSimulationThreadUpAndRunning()
           
 java.lang.Boolean isViewportHidden()
           
static void main(java.lang.String[] args)
           
 void maximizeMainWindow()
          Maximizes the primary SCS window in both the x and y directions.
 void nextCameraKey()
          Removes the CameraKeyPoint at the current data point.
 void notifyExitActionListeners()
           
 void packBuffer()
          Packs the data buffer based on the current inPoint.
 void play()
          This method causes the GUI to enter play mode assuming it is not already in run (simulate) mode.
 void previousCameraKey()
          Removes the CameraKeyPoint at the current data point.
 void readData(java.io.File chosenFile)
          Import simulation data from the specified file.
 void readData(java.lang.String filename)
          Import simulation data from the file at the specified path.
 void readData(java.net.URL url)
          Import simulation data from the file at the specified URL.
 void readState(java.io.File chosenFile)
          Read in the variable states specified in the provided file.
 void readState(java.lang.String filename)
          Read in the variable states specified by the file at the provided path.
 void recomputeTiming()
          This method recomputes the internal timing related parameters.
 void registerCollisionGroup(CollisionGroup group)
          Registers the specified collision group with the simulation.
 void registerCollisionGroups(java.util.ArrayList<CollisionGroup> groups)
          Registers each ccollision group contained in the provided ArrayList with the simulation.
 void registerToggleKeyPointModeCommandListener(ToggleKeyPointModeCommandListener listener)
           
 void removeCameraKey()
          Removes the CameraKeyPoint at the current data point.
 void removeGraphics3dNode(Graphics3DNode nodeToRemove)
           
 void removeSimulateDoneListener(SimulationDoneListener listener)
          Removes the specified SimulateDoneListener.
 void run()
          Function to run both the simulation and playback of the data.
 java.util.Vector<java.io.File> saveSimulationAsSequenceOfImages(java.lang.String path, java.lang.String NameNoExtension, CaptureDevice captureDevice)
           
 void selectCamera(java.lang.String cameraName)
          Makes the specified camera active in the active view.
 void selectConfiguration(java.lang.String name)
          Makes the specified configuration active.
 void selectViewport(java.lang.String viewportName)
          Activate the specified viewport configuration in the primary viewport panel.
 void setBackgroundColor(java.awt.Color color)
          Set the specified background color
 void setBackgroundColor(javax.vecmath.Color3f color)
          Set the specified background color
 void setBackgroundImage(java.net.URL fileURL)
          Set the specified background image
 void setBackgroundImage(java.net.URL fileURL, Graphics3DBackgroundScaleMode backgroundScaleMode)
          Set the specified background image
 void setCameraDolly(boolean dolly, boolean dollyX, boolean dollyY, boolean dollyZ)
          This function modifies the camera dolly state for the selected viewport.
 void setCameraDollyOffsets(double dx, double dy, double dz)
          Configures the offset at which the active camera follows the target.
 void setCameraDollyVars(java.lang.String xName, java.lang.String yName, java.lang.String zName)
          Sets the camera dolly variables for the active viewport.
 void setCameraFix(double fixX, double fixY, double fixZ)
          Modify the active camera's fix.
 void setCameraPosition(double posX, double posY, double posZ)
          Modifies the position at which the currently active camera is located.
 void setCameraTracking(boolean track, boolean trackX, boolean trackY, boolean trackZ)
          This function modifies the camera tracking state for the selected viewport.
 void setCameraTrackingOffsets(double dx, double dy, double dz)
          Configures the offsets for tracking on the active camera.
 void setCameraTrackingVars(java.lang.String xName, java.lang.String yName, java.lang.String zName)
          Sets the camera tracking variables for the active viewport.
 void setClipDistances(double near, double far)
          Configure the clip distances for the currently active view.
 void setDT(double simulateDT, int recordFrequency)
          Sets the simulation step size and the frequency to record data.
 void setDynamicGraphicMenuManager(DynamicGraphicMenuManager dynamicGraphicMenuManager)
           
 void setDynamicGraphicObjectsListVisible(java.lang.String name, boolean visible)
           
 void setExportDataDirectory(java.lang.String directory)
          Specifies the directory to which data will be exported.
 void setFastSimulate(boolean fastSimulate)
          When enabled fastSimulate causes the graphs to update less frequently improving simulation performance.
 void setFieldOfView(double fieldOfView)
          Specifies the horizontal field of view in radians for the currently active view.
 void setFrameAlwaysOnTop(boolean alwaysOnTop)
          Specify if the frame should be "always on top" preventing it from being hidden behind other windows.
 void setFrameLocation(int x, int y)
          Move the upper left corner of the frame to the specified x & y coordinates.
 void setFrameMaximized()
          Maximize the frame in both the horizontal and vertical directions.
 void setFrameSize(java.awt.Dimension dimension)
          Set the frame's size to the specified dimension.
 void setGraphsUpdatedDuringPlayback(boolean updateGraphs)
          Enables or disables graph updates during playback.
 void setGroundAppearance(AppearanceDefinition app)
          Apply the specified appearance to the ground.
 void setGroundVisible(boolean isVisible)
          Sets the ground visibility.
 void setImportDataDirectory(java.lang.String directory)
          Specifies the directory from which data will be imported.
 void setIndex(int index)
           
 void setIndexButDoNotNotifySimulationRewoundListeners(int index)
           
 void setInPoint()
          Makes the current data point the in point.
 void setMaxBufferSize(int maxBufferSize)
          Sets the maximum size, in ticks, to which the buffer will expand.
 void setOutPoint()
          Makes the current data point the out point.
 void setPlaybackDesiredFrameRate(double frameRate)
          Sets the desired playback frame rate in seconds per frame.
 void setPlaybackRealTimeRate(double realTimeRate)
          Sets the realTimeRate.
 void setRecordDT(double recordDT)
          The time in seconds between each recorded data point.
 void setRobot(Robot robot)
          Set the robot to be used by this simulation.
 void setRunName(java.lang.String name)
           
 void setSimulateDoneCriterion(SimulationDoneCriterion criterion)
          Sets the criterion for simulation completion.
 void setSimulateDuration(double simulateDurationInSeconds)
           
 boolean setTick(int tick)
           
 void setTime(double time)
           
 void setupCamera(CameraConfiguration cameraConfiguration)
          Adds the specified camera configuration to the simulation.
 void setupConfiguration(java.lang.String config, java.lang.String varGroupName, java.lang.String graphGroupName, java.lang.String entryBoxGroupName)
          Creates a configuration which associates a varGroup, graphGroup and entryBoxGroup so that they may be easily activated simultaniously.
 void setupEntryBox(java.lang.String varname)
          Adds an entry box for the specified variable.
 void setupEntryBox(java.lang.String[] varnames)
          Adds a set of entry boxes, one for each variable name provided, assuming the GUI is present.
 void setupEntryBoxGroup(java.lang.String name, java.lang.String[] vars)
          Creates a grouping of entry boxes using the provided YoVariable names.
 void setupEntryBoxGroup(java.lang.String name, java.lang.String[] vars, java.lang.String[] regularExpressions)
          Creates a grouping of entry boxes using the provided YoVariable names and any YoVariables that match the specified regular expressions.
 void setupExtraPanel(ExtraPanelConfiguration panelConfiguration)
           
 void setupGraph(java.lang.String varname)
          Adds a graph for the specified variable, assuming the GUI and the variable exist.
 void setupGraph(java.lang.String[] varnames)
          Adds a single graph displaying each variable named in the array, assuming the GUI and variable exist.
 void setupGraphConfigurations(GraphConfiguration[] configurations)
          Store the specified array of GraphConfigurations.
 void setupGraphGroup(java.lang.String name, java.lang.String[][] vars)
          Creates a new group of graphs with the given name containing the given variables.
 void setupGraphGroup(java.lang.String name, java.lang.String[][][] vars)
          Creates a new group of graphs with the given name containing the given variables using the specified configuration.
 void setupGraphGroup(java.lang.String name, java.lang.String[][][] vars, int numColumns)
          Creates a new group of graphs with the given name containing the given variables using the specified configuration and number of columns.
 void setupGraphGroup(java.lang.String name, java.lang.String[][] vars, int numColumns)
          Creates a new group of graphs with the given name containing the given variables spread over the specified number of columns.
 void setupVarGroup(java.lang.String name, java.lang.String[] vars)
          Creates a new group with the given name contaning the variables specified in the array.
 void setupVarGroup(java.lang.String name, java.lang.String[] vars, java.lang.String[] regularExpressions)
          Creates a new VarGroup with the specified name, containing the specified variables and regular expressions.
 void setupViewport(ViewportConfiguration viewportConfiguration)
          Adds the specified ViewportConfiguration to the simulation.
 void setWrapBuffer(boolean wrap)
          Specify whether or not the buffer should wrap once the end is reached.
 void showViewport()
          Shows the main viewport integrated into the SCS GUI.
 void simulate()
          Begin simulation mode, unless playback mode is currently enabled.
 void simulate(double simulationTime)
          Simulates for the specified time duration in seconds.
 void simulate(int numTicks)
          Simulates the specified number of steps.
 void simulateOneRecordStep()
          This triggers the simulation of a single record step which is usually several simulation steps.
 void simulateOneRecordStepNow()
          Immediately simulates a record step, records the data point, and updates the graphs.
 void simulateOneTimeStep()
          Triggers a single simulation step.
 void startOnAThread()
           
 void startStreamingVideoData(CameraConfiguration cameraConfiguration, int width, int height, VideoDataServer videoDataServer, TimestampProvider timestampProvider, int framesPerSecond)
           
 void stepBackward()
          Step backward one tick.
 void stepBackward(int steps)
          Step backward the specified number of ticks.
 void stepBackwardNow()
          Immediately step backward one tick.
 void stepForward()
          Step forward one tick.
 void stepForward(int steps)
          Step forward the specified number of ticks.
 void stepForwardNow(int steps)
          Immediately step forward the specified number of ticks.
 void stop()
          This function halts playback and simulation along with any playbackListeners that are enabled.
 void stopSimulationThread()
          Causes the simulation thread to break if it exists.
 boolean tick()
          Triggers a tick to the next display cycle.
 boolean tick(int ticks)
           
 void tickAndUpdate()
          Increments the data buffer index and updates all of the entries min & max values.
 void tickAndUpdateLeisurely(int leisureRate)
          Increments the data buffer index and updates all of the min and max values for each entry.
 boolean tickButDoNotNotifySimulationRewoundListeners(int ticks)
           
 void toggleCameraKeyMode()
          Toggle between enabling and disabling the use of CameraKeyPoints.
 void toggleKeyPointMode()
          Toggle between enabling and disabling the use of KeyPoints.
 boolean unTick()
           
 boolean updateAndTick()
          This method updates the min and max values for each entry in the data buffer.
 void updateState()
          Updates the state of the robots contained in the underlying Simulator.
 void writeData(java.util.ArrayList<YoVariable> vars, boolean binary, boolean compress, java.io.File chosenFile)
          Stores the data for the specified list of YoVariables.
 void writeData(java.io.File chosenFile)
          Writes the data recorded by the simulation to the specified file.
 void writeData(java.lang.String filename)
          Writes the data recorded by the simulation to a file with the provided path.
 void writeData(java.lang.String varGroupName, boolean binary, boolean compress, java.io.File chosenFile)
          Stores the data for the specified varGroup.
 void writeData(java.lang.String varGroup, boolean binary, boolean compress, java.lang.String filename)
          Stores the data for the specified varGroup.
 void writeSpreadsheetFormattedData(java.lang.String varGroupName, java.io.File chosenFile)
          Stores simulation data from the specified varGroup in the given File.
 void writeSpreadsheetFormattedState(java.lang.String varGroupName, java.io.File chosenFile)
          Stores the current state of all variables contained in the specified varGroup to the file given by the specified path.
 void writeState(java.io.File chosenFile)
          Stores the current state of all variables to the chosen file.
 void writeState(java.lang.String filename)
          Stores the current state of all variables to the file given by the specified path.
 void writeState(java.lang.String varGroupName, boolean binary, boolean compress, java.io.File chosenFile)
          Stores the current state of all variables contained in the specified varGroup to the file given by the specified path.
 void writeState(java.lang.String varGroup, boolean binary, boolean compress, java.lang.String filename)
          Stores the current state of all variables contained in the specified varGroup to the file given by the specified path.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_INITIAL_BUFFER_SIZE

public static final int DEFAULT_INITIAL_BUFFER_SIZE
The default size of the data buffer in record steps.

See Also:
Constant Field Values

rootRegistryName

public static final java.lang.String rootRegistryName
See Also:
Constant Field Values
Constructor Detail

SimulationConstructionSet

public SimulationConstructionSet(Robot robot)
Creates a SimulationConstructionSet with the specified Robot. The GUI will be displayed and the initial DataBuffer size will be set to the default size.

Parameters:
rob - Robot to simulate.

SimulationConstructionSet

public SimulationConstructionSet(Robot[] robots)

SimulationConstructionSet

public SimulationConstructionSet(Robot rob,
                                 int initialBufferSize)
Creates a SimulationConstructionSet with the specified Robot and DataBuffer size. The GUI will be displayed.

Parameters:
rob - Robot to simulate.
initialBufferSize - Initial size of the DataBuffer.

SimulationConstructionSet

public SimulationConstructionSet(Robot[] robot,
                                 int initialBufferSize)

SimulationConstructionSet

public SimulationConstructionSet(Robot robot,
                                 boolean showGUI)
Creates a SimulationConstructionSet with the specified Robot and GUI flag. If showGUI is true, the GUI will be displayed. If it is false, the GUI will not be displayed. The initial DataBuffer size will be set to the default size.

Parameters:
rob - Robot to simulate.
showGUI - boolean specifying whether or not to display the GUI.

SimulationConstructionSet

public SimulationConstructionSet(Robot[] robots,
                                 boolean showGUI)

SimulationConstructionSet

public SimulationConstructionSet(boolean showGUI,
                                 int initialBufferSize)
Creates a SimulationConstructionSet with no Robot.

Parameters:
showGUI - boolean specifying whether or not to display the GUI.
initialBufferSize - Initial size of the DataBuffer.

SimulationConstructionSet

public SimulationConstructionSet()
Creates a SimulationConstructionSet with no Robot.


SimulationConstructionSet

public SimulationConstructionSet(Robot robot,
                                 boolean showGUI,
                                 int initialBufferSize)
Creates a SimulationConstructionSet with the specified Robot and DataBuffer size. If showGUI is true, the GUI will be displayed. If it is false, the GUI will not be displayed. It is possible to run simulations without displaying the GUI, which can be useful when attempting to run several simulations as a batch.

Parameters:
rob - Robot to simulate.
showGUI - boolean specifying whether or not to display the GUI.
initialBufferSize - Initial size of the DataBuffer.

SimulationConstructionSet

public SimulationConstructionSet(Robot[] robotArray,
                                 boolean showGUI,
                                 int initialBufferSize)

SimulationConstructionSet

public SimulationConstructionSet(Robot robot,
                                 Graphics3DAdapter graphicsAdapter,
                                 int initialBufferSize)

SimulationConstructionSet

public SimulationConstructionSet(Robot[] robotArray,
                                 Graphics3DAdapter graphicsAdapter,
                                 int initialBufferSize)

SimulationConstructionSet

public SimulationConstructionSet(Robot[] robotArray,
                                 SupportedGraphics3DAdapter supportedGraphicsAdapter,
                                 int initialBufferSize)

SimulationConstructionSet

public SimulationConstructionSet(Simulation simulation,
                                 boolean showGUI)

SimulationConstructionSet

public SimulationConstructionSet(Simulation simulation,
                                 Graphics3DAdapter graphicsAdapter)

SimulationConstructionSet

public SimulationConstructionSet(Robot robot,
                                 javax.swing.JApplet jApplet)

SimulationConstructionSet

public SimulationConstructionSet(Robot[] robots,
                                 javax.swing.JApplet jApplet)
Creates a SimulationConstructionSet with the specified Robot. The GUI will be displayed using the specified JApplet and the initial DataBuffer size will be set to the default size.

Parameters:
rob - Robot to simulate.
jApplet - JApplet to display the GUI in.
Method Detail

generateSimulationFromDataFile

public static SimulationConstructionSet generateSimulationFromDataFile(java.io.File chosenFile)

getDT

public double getDT()
Get the simulation step size in seconds.

Returns:
Simulation step size.

getIndex

public int getIndex()
Get the current simulation index (tick).

Specified by:
getIndex in interface DataBufferCommandsExecutor
Returns:
Simulation index

isIndexBetweenInAndOutPoint

public boolean isIndexBetweenInAndOutPoint(int indexToCheck)
Specified by:
isIndexBetweenInAndOutPoint in interface DataBufferCommandsExecutor

setDT

public void setDT(double simulateDT,
                  int recordFrequency)
Sets the simulation step size and the frequency to record data.

Parameters:
simulateDT - Simulation step size in seconds.
recordFrequency - Rate to record data in simulation step per records

getRobots

public Robot[] getRobots()
Retrieves the Robots used in this simulation.

Returns:
Robots contained in this simulation

getStandardSimulationGUI

public StandardSimulationGUI getStandardSimulationGUI()

addScript

public void addScript(Script script)
Add the specified script to this simulation.

Parameters:
script - Script to be added
See Also:
Script

setFrameSize

public void setFrameSize(java.awt.Dimension dimension)
Set the frame's size to the specified dimension.

Parameters:
dimension - Dimension to which the frame is resized.

setFrameLocation

public void setFrameLocation(int x,
                             int y)
Move the upper left corner of the frame to the specified x & y coordinates.

Parameters:
x - Coordinate on the x axis
y - Coordinate on the y axis

setFrameMaximized

public void setFrameMaximized()
Maximize the frame in both the horizontal and vertical directions.


getJFrame

public javax.swing.JFrame getJFrame()
Retrieve the frame of this SimulationConstructionSet.

Returns:
The JFrame containing the GUI

setFrameAlwaysOnTop

public void setFrameAlwaysOnTop(boolean alwaysOnTop)
Specify if the frame should be "always on top" preventing it from being hidden behind other windows. This is false by default.

Parameters:
alwaysOnTop - boolean specifying if the frame is always on top.

getRootRegistry

public YoVariableRegistry getRootRegistry()

addYoVariableRegistry

public void addYoVariableRegistry(YoVariableRegistry registry)

getAllVariables

public java.util.ArrayList<YoVariable> getAllVariables()
Description copied from interface: YoVariableHolder
Returns all the YoVariables in this YoVariableHolder

Specified by:
getAllVariables in interface YoVariableHolder
Returns:
ArrayList

getAllVariablesArray

public YoVariable[] getAllVariablesArray()
Description copied from interface: YoVariableHolder
Returns all the YoVariables in this YoVariableHolder

Specified by:
getAllVariablesArray in interface YoVariableHolder
Returns:
YoVariable[]

getVariable

@Deprecated
public YoVariable getVariable(java.lang.String varname)
Deprecated. 

Description copied from interface: YoVariableHolder
Gets a YoVariable with the given name if it is in this YoVariableHolder, otherwise returns null. If name contains a ".", then the YoVariable's nameSpace ending must match that of name. If there is more than one YoVariable that matches, then throws a RuntimeException.

Specified by:
getVariable in interface YoVariableHolder
Parameters:
varname - String Name of YoVariable to get. If contains a ".", then YoVariable's nameSpace ending must match that of name.
Returns:
YoVariable matching the given name.

getVariable

public YoVariable getVariable(java.lang.String nameSpace,
                              java.lang.String varname)
Description copied from interface: YoVariableHolder
Gets a YoVariable with the given nameSpace and name if it is in this YoVariableHolder, otherwise returns null. If name contains a ".", then throws a RuntimeException. If there is more than one YoVariable that matches, then throws a RuntimeException.

Specified by:
getVariable in interface YoVariableHolder
Parameters:
nameSpace - String nameSpaceEnding ending of YoVariable to get. The YoVariable's nameSpace ending must match that of nameSpace.
varname - String Name of YoVariable to get. If contains a ".", then throws a RuntimeException.
Returns:
YoVariable matching the given nameSpace and name.

getVariables

public java.util.ArrayList<YoVariable> getVariables(java.lang.String nameSpace,
                                                    java.lang.String varname)
Description copied from interface: YoVariableHolder
Returns all the YoVariables with the given nameSpace and name that are in this YoVariableHolder, empty if there are none. If name contains a ".", then throws a RuntimeException.

Specified by:
getVariables in interface YoVariableHolder
Parameters:
nameSpace - String NameSpace ending of YoVariables to get. The YoVariable's nameSpace ending must match that of nameSpace.
varname - String Name of YoVariable to get. If contains a ".", then throws a RuntimeException.
Returns:
ArrayList matching the given nameSpace and name.

getVariables

public java.util.ArrayList<YoVariable> getVariables(java.lang.String varname)
Description copied from interface: YoVariableHolder
Returns all the YoVariables with the given name that are in this YoVariableHolder, empty if there are none. If name contains a ".", then the YoVariable's nameSpace ending must match that of name.

Specified by:
getVariables in interface YoVariableHolder
Parameters:
varname - String Name of YoVariable to get. If name contains a ".", then the YoVariable's nameSpace ending must match that of name.
Returns:
ArrayList matching the given name.

getVariables

public java.util.ArrayList<YoVariable> getVariables(NameSpace nameSpace)
Description copied from interface: YoVariableHolder
Returns all the YoVariables with the given nameSpace that are in this YoVariableHolder, empty if there are none.

Specified by:
getVariables in interface YoVariableHolder
Parameters:
nameSpace - NameSpace to match.
Returns:
ArrayList matching YoVariables.

hasUniqueVariable

public boolean hasUniqueVariable(java.lang.String varname)
Description copied from interface: YoVariableHolder
Checks if this YoVariableHolder holds exactly one YoVariable with the given name. If so, returns true, otherwise returns false. If name contains a ".", then the YoVariable's nameSpace ending must match that of name. If there is more than one YoVariable that matches, returns false.

Specified by:
hasUniqueVariable in interface YoVariableHolder
Parameters:
varname - String Name of YoVariable to check for. If contains a ".", then YoVariable's nameSpace ending must match that of name.
Returns:
boolean Whether or not this YoVariableHolder holds exactly one Variable of the given name.

hasUniqueVariable

public boolean hasUniqueVariable(java.lang.String nameSpace,
                                 java.lang.String varname)
Description copied from interface: YoVariableHolder
Checks if this YoVariableHolder holds exactly one YoVariable with the given nameSpace and name. If so, returns true, otherwise returns false. If name contains a ".", then throws a RuntimeException. If there is more than one YoVariable that matches, returns false.

Specified by:
hasUniqueVariable in interface YoVariableHolder
Parameters:
nameSpace - String NameSpace ending of YoVariable to check for. The YoVariable's nameSpace ending must match that of nameSpace.
varname - String Name of YoVariable to check for. If contains a ".", then throws a RuntimeException.
Returns:
boolean Whether or not this YoVariableHolder holds exactly one Variable that matches the given nameSpace and name.

getVariablesThatContain

public java.util.ArrayList<YoVariable> getVariablesThatContain(java.lang.String searchString,
                                                               boolean caseSensitive)
Retrieves an ArrayList containing the YoVariables whos names contain the search string. If none exist, it returns null.

Parameters:
searchString - String for which YoVariable names are checked.
caseSensitive - Indicates if the search is to be case sensitive.
Returns:
ArrayList of the YoVariables whos names contained searchString.

getVariablesThatContain

public java.util.ArrayList<YoVariable> getVariablesThatContain(java.lang.String searchString)
Retrieves an ArrayList containing the YoVariables with names that contain searchString. If none exist, it returns null. This method assumes the string is case insensitive.

Parameters:
searchString - String for which YoVariable names are checked.
Returns:
ArrayList of the YoVariables whos names contained searchString.

getVariablesThatStartWith

public java.util.ArrayList<YoVariable> getVariablesThatStartWith(java.lang.String searchString)
Retrieves an ArrayList containing the YoVariables with names that start with the searchString. If none exist, it returns null.

Parameters:
searchString - String for which YoVariable names are checked.
Returns:
ArrayList of the YoVariables whos names begin with searchString.

getVars

public java.util.ArrayList<YoVariable> getVars(java.lang.String[] varNames,
                                               java.lang.String[] regularExpressions)
Given an array of YoVariable names and an array of regular expressions this function returns an ArrayList of the YoVariables whos name's fit the regular expression. If a given variable fits multiple expressions it will be added multiple times.

Parameters:
varNames - String array of the name of YoVariables to be checked.
regularExpressions - String array of regular expressions to use.
Returns:
ArrayList of the YoVariables which have names that match the provided regular expressions.

setRecordDT

public void setRecordDT(double recordDT)
The time in seconds between each recorded data point. This value is ultimately stored as the ratio of simulation steps per record. If the specified value is not evenly divisible by the simulation time step rounding will occur. Once the value has been updated timing is recomputed.

Parameters:
recordDT - The new period, in seconds, between recorded data points.

getRecordFreq

public double getRecordFreq()
Gets the Record Frequency for the simulation.

Returns:
Record Frequencuy.

setPlaybackRealTimeRate

public void setPlaybackRealTimeRate(double realTimeRate)
Sets the realTimeRate. This value is a percentage with 1.0 yielding 100% of standard time. Greater values increase rate of time whereas smaller values decrease it.

Specified by:
setPlaybackRealTimeRate in interface RunCommandsExecutor
Parameters:
realTimeRate - The desired playback rate in percentage of real time where 100% is specified as 1.0.

setPlaybackDesiredFrameRate

public void setPlaybackDesiredFrameRate(double frameRate)
Sets the desired playback frame rate in seconds per frame. For example 0.1 would yield 10 frames/second. The maximum frame rate is 500 or 0.002 seconds per frame while the minimum is 0.5 or 2.0 seconds per frame. Once the value has been updated timing is recomputed.

Parameters:
frameRate - The new frame rate in seconds per frame.

getPlaybackRealTimeRate

public double getPlaybackRealTimeRate()
Retrieve the current real time rate which is the percentage of real time the simulator is displaying. 100% is represented as 1.0

Specified by:
getPlaybackRealTimeRate in interface RunCommandsExecutor
Returns:
The current playback rate as a percentage of real time.

getPlaybackFrameRate

public double getPlaybackFrameRate()
Retrive the playback frame rate in seconds per frame.

Returns:
The playback frame rate.

recomputeTiming

public void recomputeTiming()
This method recomputes the internal timing related parameters. Any time values that effect timing are changed this method is called to update all effected parameters.


getTicksPerPlayCycle

public long getTicksPerPlayCycle()

addStaticLink

public void addStaticLink(Link staticLink)
Adds a static Link to the display environment. If the GUI does not exist the add fails and null is returned.

Static links are purely cosmetic.

Parameters:
staticLink - The Link to be added staticly to the environment.

addStaticLinkGraphics

public Graphics3DNode addStaticLinkGraphics(Graphics3DObject staticLinkGraphics)

addStaticLinkGraphics

public Graphics3DNode addStaticLinkGraphics(Graphics3DObject staticLinkGraphics,
                                            Graphics3DNodeType nodeType)
Adds a static LinkGraphics to the display environment. If the GUI does not exist the add fails and null is returned.

Static LinkGraphics are purely cosmetic.

Parameters:
staticLinkGraphics - The LinkGraphics to be added statically to the environment.

removeGraphics3dNode

public void removeGraphics3dNode(Graphics3DNode nodeToRemove)

addStaticLinkGraphics

public void addStaticLinkGraphics(java.util.ArrayList<Graphics3DObject> staticLinkGraphics)

addDynamicGraphicObject

public GraphicsDynamicGraphicsObject addDynamicGraphicObject(DynamicGraphicObject dynamicGraphicObject)

addDynamicGraphicObject

public GraphicsDynamicGraphicsObject addDynamicGraphicObject(DynamicGraphicObject dynamicGraphicObject,
                                                             boolean updateFromSimulationThread)

setCameraTracking

public void setCameraTracking(boolean track,
                              boolean trackX,
                              boolean trackY,
                              boolean trackZ)
This function modifies the camera tracking state for the selected viewport. Tracking can be enabled or disabled in a general sense as well as in a specific axis. For example, assuming track were enabled, if trackx were disabled the camera would not follow a target with a changing x co-ordinate.

A camera set to track will not move instead it will rotate to keep the target in view.

Parameters:
track - Enable or disable tracking for this camera.
trackX - Enable or disable tracking in the x direction.
trackY - Enable or disable tracking in the y direction.
trackZ - Enable or disable tracking in the z direction.
See Also:
Camera.setTracking

setCameraDolly

public void setCameraDolly(boolean dolly,
                           boolean dollyX,
                           boolean dollyY,
                           boolean dollyZ)
This function modifies the camera dolly state for the selected viewport. Dolly can be enabled or disabled in a general sense and in terms of specific axis. For example, if dolly were enabled overall but disabled in the x direction the camera would not follow if its target moved on the x axis.

A camera with dolly enabled will move to keep its target in view from the same orientation.

Parameters:
dolly - Enable or disable dolly for this camera.
dollyX - Enable or disable dolly in the x direction.
dollyY - Enable or disable dolly in the y direction.
dollyZ - Enable or disable dolly in the z direction.
See Also:
Camera.setDolly

setCameraTrackingVars

public void setCameraTrackingVars(java.lang.String xName,
                                  java.lang.String yName,
                                  java.lang.String zName)
Sets the camera tracking variables for the active viewport. These variables control what the camera tracks when tracking is enabled. By default the camera is set to track the Robot's x, y and z position if it exists.

Parameters:
xName - Name of the YoVariable to be referenced for x direction tracking.
yName - Name of the YoVariable to be referenced for y direction tracking.
zName - Name of the YoVariable to be referenced for z direction tracking.
See Also:
Camera.setTrackingVars

setCameraDollyVars

public void setCameraDollyVars(java.lang.String xName,
                               java.lang.String yName,
                               java.lang.String zName)
Sets the camera dolly variables for the active viewport. These variables control what the camera follows when dolly is enabled. By default the camera is set to follow the Robot's x, y and z position if it exists.

Parameters:
xName - Name of the YoVariable to be referenced for x direction following.
yName - Name of the YoVariable to be referenced for y direction following.
zName - Name of the YoVariable to be referenced for z direction following.
See Also:
Camera.setDollyVars

setCameraTrackingOffsets

public void setCameraTrackingOffsets(double dx,
                                     double dy,
                                     double dz)
Configures the offsets for tracking on the active camera. These offsets are added to the tracking variables which specify the targets location to calculate the camera's focal point. By default the offsets are zero.

In tracking mode the camera is fixed but remains focused on the target.

Parameters:
dx - Offset in the x direction from the target.
dy - Offset in the y direction from the target.
dz - Offset in the z direction from the target.
See Also:
Camera.setTrackingOffsets, setCameraTrackingVars

setCameraDollyOffsets

public void setCameraDollyOffsets(double dx,
                                  double dy,
                                  double dz)
Configures the offset at which the active camera follows the target. These offsets are added to the dolly variables which specify the location of the target. By default there is an offset of 2.0 in the x direction and 12.0 in the y.

In dolly mode the camera has a fixed orientation and moves to keep a constant view of the target.

Parameters:
dx - Offset in the x direction from the target.
dy - Offset in the y direction from the target.
dz - Offset in the z direction from the target.
See Also:
Camera.setDollyOffsets, setCameraDollyVars

setCameraFix

public void setCameraFix(double fixX,
                         double fixY,
                         double fixZ)
Modify the active camera's fix. If track is enabled for this camera the new values will be overwritten, dolly has no effect.

The camera fix is point in space at which the camera is looking.

Parameters:
fixX - X coordinate of the fix point.
fixY - Y coordinate of the fix point.
fixZ - Z coordinate of the fix point.
See Also:
Camera.setFixPosition

setCameraPosition

public void setCameraPosition(double posX,
                              double posY,
                              double posZ)
Modifies the position at which the currently active camera is located. If dolly is enabled for this camera the new values will be overwritten, track has no effect.

Parameters:
posX - X coordinate of the camera.
posY - Y coordinate of the camera.
posZ - Z coordinate of the camera.

attachExitActionListener

public void attachExitActionListener(ExitActionListener listener)
Add another ExitActionListener to the set which is triggered by closing the simulation environment GUI.

Parameters:
listener - The ExitActionListener to be added.

notifyExitActionListeners

public void notifyExitActionListeners()

startOnAThread

public void startOnAThread()

closeAndDispose

public void closeAndDispose()

addButton

public void addButton(javax.swing.JButton button)
This function adds the specified button to the SCS GUI. The button is added to a panel in the upper right corner to the left of the existing simulate, play, pause buttons.

Parameters:
button - JButton to be added.

addJLable

public void addJLable(javax.swing.JLabel label)

addRadioButton

public void addRadioButton(javax.swing.JRadioButton button)
This function adds the specified button to the SCS GUI. The button is added to a panel in the upper right corner to the right of the existing simulate, play, pause buttons.

Parameters:
button - JRadioButton to be added.

addCheckBox

public void addCheckBox(javax.swing.JCheckBox checkBox)
This function adds the specified button to the SCS GUI. The button is added to a panel in the upper right corner to the right of the existing simulate, play, pause buttons.

Parameters:
checkBox - JCheckBox to be added.

addMenuBar

public void addMenuBar(javax.swing.JMenuBar menuBar)
This function adds the specified button to the SCS GUI. The button is added to a panel in the upper right corner to the right of the existing simulate, play, pause buttons.

Parameters:
menuBar - JMenuBar to be added.

tickAndUpdate

public void tickAndUpdate()
Increments the data buffer index and updates all of the entries min & max values. If a GUI exists, its graphs are updated.


tickAndUpdateLeisurely

public void tickAndUpdateLeisurely(int leisureRate)
Increments the data buffer index and updates all of the min and max values for each entry. If a GUI exists, its graphs are updated after this method has been called the number of times specified by lesiureRate. The value of leisureRate is not stored internally and may be changed at every call. If the method has been called more than leisureRate times the graphs are updated and the count is reset.

Parameters:
leisureRate - iNumber of calls before the graphs should be updated.

updateAndTick

public boolean updateAndTick()
This method updates the min and max values for each entry in the data buffer. It then attempts to increment the index however, it will roll around the in and out points. Once the final index is reached the entries are re-updated. If a GUI exists the graphs will be updated.

Returns:
Did the index roll around the in and out points?

tick

public boolean tick()
Triggers a tick to the next display cycle. The data buffer is incremented to the data point for the next display frame. The function returns true if this triggers a rollover between the in and out points. Once this completes the robot is updated based on those values without updating the display. (This probably deals with playback only, simulation is separate)

Returns:
Did the data buffer roll between the in and out points?

unTick

public boolean unTick()

tickButDoNotNotifySimulationRewoundListeners

public boolean tickButDoNotNotifySimulationRewoundListeners(int ticks)
Specified by:
tickButDoNotNotifySimulationRewoundListeners in interface DataBufferCommandsExecutor

tick

public boolean tick(int ticks)
Specified by:
tick in interface DataBufferCommandsExecutor

setTick

public boolean setTick(int tick)

setupEntryBox

public void setupEntryBox(java.lang.String varname)
Adds an entry box for the specified variable. This only occurs if a GUI is present and the specified variable exists.

Parameters:
varname - The name of the desired variable.

setupEntryBox

public void setupEntryBox(java.lang.String[] varnames)
Adds a set of entry boxes, one for each variable name provided, assuming the GUI is present.

Parameters:
varnames - Array containing the names of variables for which to add entry boxes.

setupGraph

public void setupGraph(java.lang.String varname)
Adds a graph for the specified variable, assuming the GUI and the variable exist.

Parameters:
varname - Name of the variable for which to add a graph.

setupGraph

public void setupGraph(java.lang.String[] varnames)
Adds a single graph displaying each variable named in the array, assuming the GUI and variable exist.

Parameters:
varnames - Array of variable names for which to create graphs.

setupVarGroup

public void setupVarGroup(java.lang.String name,
                          java.lang.String[] vars)
Creates a new group with the given name contaning the variables specified in the array. VarGroups are displayed in the left most column, they list the names and values of the variables they contain. Once a var group has been created it may be selected from the configuration drop down menu. It may also be added to a configuration along with a graphGroup and entryBoxGroup.

Parameters:
name - Name of the group.
vars - Names of the variables to include.

setupVarGroup

public void setupVarGroup(java.lang.String name,
                          java.lang.String[] vars,
                          java.lang.String[] regularExpressions)
Creates a new VarGroup with the specified name, containing the specified variables and regular expressions. The regular expressions can be used to retrive additonal variables which match their patterns. Once a var group has been created it may be selected from the configuration drop down menu. It may also be added to a configuration along with a graphGroup and entryBoxGroup.

Parameters:
name - Name of the group
vars - Array containing the names of variables to add.
regularExpressions - Array of regular expressions to include.

setupGraphGroup

public void setupGraphGroup(java.lang.String name,
                            java.lang.String[][] vars)

Creates a new group of graphs with the given name containing the given variables. Once a graph group has been created it can be selected from the configuration drop down menu. It may also be added to a configuration along with a varGroup and entryBoxGroup.

For example:
setupGraphGroup("states", new String[][]{{"left_state", "right_state"}, {"t"}, {"q_x", "q_z"}});
This code creates the following three graphs:
1) left_state, right_state
2) t
3) q_x, q_z

Parameters:
name - Name of the group.
vars - Array containing the names of variables for which graphs are to be created. Each row is treated as a separate graph and may contain multiple variables.

setupGraphGroup

public void setupGraphGroup(java.lang.String name,
                            java.lang.String[][][] vars)

Creates a new group of graphs with the given name containing the given variables using the specified configuration. Once a graph group has been created it can be selected from the configuration drop down menu. It may also be added to a configuration along with a varGroup and entryBoxGroup.

For example:
setupGraphGroup("states", new String[][]{{{"left_state", "right_state"}, {"config_1}}, {{"t"}, {"config_2"}}, {{"q_x", "q_z"}, {"config_3"}}});
This code creates the following three graphs:
1) left_state, right_state both using config_1
2) t using config_2
3) q_x, q_z both using config_3

Parameters:
name - The name of the graph group.
vars - String array containing the YoVariable names to be added to each graph in the group as well as the configurations to use.

setupGraphGroup

public void setupGraphGroup(java.lang.String name,
                            java.lang.String[][] vars,
                            int numColumns)

Creates a new group of graphs with the given name containing the given variables spread over the specified number of columns. Once a graph group has been created it can be selected from the configuration drop down menu. It may also be added to a configuration along with a varGroup and entryBoxGroup.


For example:
setupGraphGroup("states", new String[][]{{"left_state", "right_state"}, {"t"}, {"q_x", "q_z"}}, 2);
This code creates the following three graphs divided over 2 columns:
1) left_state, right_state
2) t
3) q_x, q_z

Parameters:
name - Name of the group.
vars - String array containing the YoVariable names to be added to each graph in the group.
numColumns - Number of columns over which to spread the graphs.

setupGraphGroup

public void setupGraphGroup(java.lang.String name,
                            java.lang.String[][][] vars,
                            int numColumns)
Creates a new group of graphs with the given name containing the given variables using the specified configuration and number of columns. Once a graph group has been created it can be selected from the configuration drop down menu. It may also be added to a configuration along with a varGroup and entryBoxGroup.

For example: setupGraphGroup("states", new String[][]{{{"left_state", "right_state"}, {"config_1}}, {{"t"}, {"config_2"}}, {{"q_x", "q_z"}, {"config_3"}}}); This code creates the following three graphs separated into two columns: 1) left_state, right_state both using config_1 2) t using config_2 3) q_x, q_z both using config_3

Parameters:
name - Name of the group.
vars - String array containing the YoVariable names to be added to each graph in the group as well as the configurations to use.
numColumns - Number of columns over which to spread the graphs.

setupEntryBoxGroup

public void setupEntryBoxGroup(java.lang.String name,
                               java.lang.String[] vars)
Creates a grouping of entry boxes using the provided YoVariable names. Entry boxes appear below the graphs at the bottom of the Simulation Construction Set GUI. Once a group is created it can be selected from the configuration drop down menu. It may also be added to a configuration along with a varGroup and graphGroup.

Parameters:
name - Name of the group.
vars - Array containing the names of the YoVariables to include.

setupEntryBoxGroup

public void setupEntryBoxGroup(java.lang.String name,
                               java.lang.String[] vars,
                               java.lang.String[] regularExpressions)
Creates a grouping of entry boxes using the provided YoVariable names and any YoVariables that match the specified regular expressions. Entry boxes appear below the graphs at the bottom of the Simulation Construction Set GUI. Once a group is created it can be selected from the configuration drop down menu. It may also be added to a configuration along with a varGroup and graphGroup.

Parameters:
name - Name of the group.
vars - Array containing the names of the YoVariables to include.
regularExpressions - Array containing regular expressions to use in searching for additonal YoVariables.

setupConfiguration

public void setupConfiguration(java.lang.String config,
                               java.lang.String varGroupName,
                               java.lang.String graphGroupName,
                               java.lang.String entryBoxGroupName)
Creates a configuration which associates a varGroup, graphGroup and entryBoxGroup so that they may be easily activated simultaniously. Configurations are selected in the configuration drop down menu.

Parameters:
config - Name of the new configuration.
varGroupName - Name of the varGroup to associate with this configuration.
graphGroupName - Name of the graphGroup to associate with this configuration.
entryBoxGroupName - Name of the entryBoxGroup to associate with this configuration.

selectConfiguration

public void selectConfiguration(java.lang.String name)
Makes the specified configuration active.

Parameters:
name - Name of the configuration to activate.

setupCamera

public void setupCamera(CameraConfiguration cameraConfiguration)

Adds the specified camera configuration to the simulation. Once added the camera configuration may be selected in the viewport menu. It may also be added to a predefined viewport.

The following code creates a camera configuration named "camera 1" in track mode with a camera position of (-9,3,0.8) and an initial fix of (0,0,0.6)

CameraConfiguration camera1 = new CameraConfiguration("camera 1");
camera1.setCameraFix(0.0, 0.0, 0.6);
camera1.setCameraPosition(-9.0, 3.0, 0.8);
camera1.setCameraTracking(true, true, true, false);
camera1.setCameraDolly(false, true, true, false);
sim.setupCamera(camera1);

Parameters:
cameraConfiguration - CameraConfiguration
See Also:
CameraConfiguration

setupExtraPanel

public void setupExtraPanel(ExtraPanelConfiguration panelConfiguration)

selectCamera

public void selectCamera(java.lang.String cameraName)
Makes the specified camera active in the active view. This view can be identified by its red border.

Parameters:
cameraName - Name of the camera to select.

setupViewport

public void setupViewport(ViewportConfiguration viewportConfiguration)
Adds the specified ViewportConfiguration to the simulation. Once added, the configuration may be selected in the viewport window.

Parameters:
viewportConfiguration - ViewportConfiguration
See Also:
ViewportConfiguration

selectViewport

public void selectViewport(java.lang.String viewportName)
Activate the specified viewport configuration in the primary viewport panel.

Parameters:
viewportName - Name of the viewport to activate.

setupGraphConfigurations

public void setupGraphConfigurations(GraphConfiguration[] configurations)
Store the specified array of GraphConfigurations.

Parameters:
configurations - Array of GraphConfigurations to store.

setRobot

public void setRobot(Robot robot)
Set the robot to be used by this simulation.

Parameters:
rob - Robot to be used by the simulation.

setClipDistances

public void setClipDistances(double near,
                             double far)
Configure the clip distances for the currently active view. These distances specify the draw region for objects. If an object is closer than the near distance or furth than the far distance it will not be drawn. The default values for these are 0.25 and 30 respectively.

Parameters:
near - Nearest point at which objects are drawn.
far - Furthest point at which objects are drawn.

setFieldOfView

public void setFieldOfView(double fieldOfView)
Specifies the horizontal field of view in radians for the currently active view. Objects outside of the field of view are not drawn.

Parameters:
fieldOfView - Field of view in radians.

disableGUIComponents

public void disableGUIComponents()
If the GUI exists, stop whatever it is doing and disable user actions.

Specified by:
disableGUIComponents in interface GUIEnablerAndDisabler

enableGUIComponents

public void enableGUIComponents()
If the GUI exists, enable user actions.

Specified by:
enableGUIComponents in interface GUIEnablerAndDisabler

setBackgroundColor

public void setBackgroundColor(java.awt.Color color)
Set the specified background color

Parameters:
color - Color
See Also:
Color

setBackgroundColor

public void setBackgroundColor(javax.vecmath.Color3f color)
Set the specified background color

Parameters:
color - Color3f
See Also:
Color3f

setBackgroundImage

public void setBackgroundImage(java.net.URL fileURL,
                               Graphics3DBackgroundScaleMode backgroundScaleMode)
Set the specified background image

Parameters:
fileURL - URL
imageScaleMode - int

setBackgroundImage

public void setBackgroundImage(java.net.URL fileURL)
Set the specified background image

Parameters:
fileURL - URL
See Also:
URL

setGroundAppearance

public void setGroundAppearance(AppearanceDefinition app)
Apply the specified appearance to the ground. Custom appearances may be used here although several are provided in the YoAppearance class.

Parameters:
app - Appearance
See Also:
YoAppearance

setGroundVisible

public void setGroundVisible(boolean isVisible)
Sets the ground visibility.

Parameters:
isVisible - Specifies the visibility of the ground.

run

public void run()
Function to run both the simulation and playback of the data. The robot and GUI are updated before simulation cycles begin.

Specified by:
run in interface java.lang.Runnable

stopSimulationThread

public void stopSimulationThread()
Causes the simulation thread to break if it exists.


setGraphsUpdatedDuringPlayback

public void setGraphsUpdatedDuringPlayback(boolean updateGraphs)
Enables or disables graph updates during playback. Disabling updates may grant some improved performance but the current data point will nolonger be highlighted on the graphs. This is true by default.

Parameters:
updateGraphs - Specify whether or not graphs should update during playback.

isGraphsUpdatedDuringPlayback

public boolean isGraphsUpdatedDuringPlayback()
Check to see if graph updates are enabled during playback.

Returns:
Are graph updates enabled during playback?
See Also:
setGraphsUpdatedDuringPlayback

saveSimulationAsSequenceOfImages

public java.util.Vector<java.io.File> saveSimulationAsSequenceOfImages(java.lang.String path,
                                                                       java.lang.String NameNoExtension,
                                                                       CaptureDevice captureDevice)

stop

public void stop()
This function halts playback and simulation along with any playbackListeners that are enabled. It also gives the GUI a chance to update. Currently the only implementation of a playback listener is the StateMachinesJPanel class.

Specified by:
stop in interface StopCommandExecutor

isSimulationThreadUpAndRunning

public boolean isSimulationThreadUpAndRunning()

isSimulating

public boolean isSimulating()
Specified by:
isSimulating in interface SimulateCommandExecutor
Returns:
true if the simulation is simulating

play

public void play()
This method causes the GUI to enter play mode assuming it is not already in run (simulate) mode.

Specified by:
play in interface PlayCommandExecutor

setFastSimulate

public void setFastSimulate(boolean fastSimulate)
When enabled fastSimulate causes the graphs to update less frequently improving simulation performance.

Parameters:
fastSimulate - Enables or disables fastSimulate.

simulateOneTimeStep

public void simulateOneTimeStep()
                         throws UnreasonableAccelerationException
Triggers a single simulation step. This runs one simulation cycle and if appropriate records the data and updates graphs.

Throws:
UnreasonableAccelerationException - This exception indicates an unreasonable acceleration occured. Try reducing gains, ground stiffness and damping, or DT.

simulateOneRecordStep

public void simulateOneRecordStep()
                           throws UnreasonableAccelerationException
This triggers the simulation of a single record step which is usually several simulation steps. This step will result in the storage of a data point.

Throws:
UnreasonableAccelerationException - This exception indicates an unreasonable acceleration occured. Try reducing gains, ground stiffness and damping, or DT.
See Also:
setRecordDT

simulateOneRecordStepNow

public void simulateOneRecordStepNow()
                              throws UnreasonableAccelerationException
Immediately simulates a record step, records the data point, and updates the graphs.

Throws:
UnreasonableAccelerationException - This exception indicates an unreasonable acceleration occured. Try reducing gains, ground stiffness and damping, or DT.

simulate

public void simulate(int numTicks)
Simulates the specified number of steps. If the number is less than a record cycle a data point will not be created.

Parameters:
numTicks - Number of ticks or steps to simulate.

simulate

public void simulate(double simulationTime)
Simulates for the specified time duration in seconds. The time specified must be at least one integration step (tick) in length.

Parameters:
simulationTime - Simulation time in seconds.

simulate

public void simulate()
Begin simulation mode, unless playback mode is currently enabled.

Specified by:
simulate in interface SimulateCommandExecutor

setSimulateDuration

public void setSimulateDuration(double simulateDurationInSeconds)

getSimulateDuration

public double getSimulateDuration()

updateState

public void updateState()
Updates the state of the robots contained in the underlying Simulator. Step 1/3 of Simulator.simulate(). Should only be used for testing purposes.


doControl

public void doControl()
Calls the doControl() method of the robots contained in the underlying Simulator. Step 2/3 of Simulator.simulate(). Should only be used for testing purposes.


doDynamicsAndIntegrate

public void doDynamicsAndIntegrate()
                            throws UnreasonableAccelerationException
Does the dynamics and integrates the state equations for all the robots contained in the underlying Simulator. Step 3/3 of Simulator.simulate(). Should only be used for testing purposes.

Throws:
UnreasonableAccelerationException

addSimulateDoneListener

public void addSimulateDoneListener(SimulationDoneListener listener)
Add a simulate done listener to the simulation. All SimulateDoneListeners will be triggered when the simulation completes.

Parameters:
listener - SimulationDoneListener
See Also:
SimulationDoneListener

setSimulateDoneCriterion

public void setSimulateDoneCriterion(SimulationDoneCriterion criterion)
Sets the criterion for simulation completion. When the criterion is met the simulation will complete and SimulateDoneListeners will be triggered.

Parameters:
criterion - Criterion for simulation completion.
See Also:
SimulationDoneCriterion

removeSimulateDoneListener

public void removeSimulateDoneListener(SimulationDoneListener listener)
Removes the specified SimulateDoneListener. Once removed the listener will nolonger be triggered when the simulation completes.

Parameters:
listener - Listener to be removed.

gotoInPoint

public void gotoInPoint()
Move the current data point to inPoint. This has no effect while the simulation is running but will effect playback.

Specified by:
gotoInPoint in interface GotoInPointCommandExecutor

gotoInPointNow

public void gotoInPointNow()
Causes execution to continue from the inPoint. This will happen in all modes and can cause exceptions in simulation mode if the transistion is too severe.


gotoOutPoint

public void gotoOutPoint()
Moves the current data point to the outPoint. This has no effect while simulating but will effect playback.

Specified by:
gotoOutPoint in interface GotoOutPointCommandExecutor

gotoOutPointNow

public void gotoOutPointNow()

setInPoint

public void setInPoint()
Makes the current data point the in point. This works in all modes.

Specified by:
setInPoint in interface SetInPointCommandExecutor

addKeyPoint

public void addKeyPoint()
Makes the current data point a KeyPoint. If the point is already a KeyPoint it ceases to be one. KeyPoints are essentially bookmarks. When they are enabled single steps will move between KeyPoints instead of traveling through the data in a continuous fashion.

Specified by:
addKeyPoint in interface AddKeyPointCommandExecutor

addCameraKey

public void addCameraKey()
Makes the current data point a CameraKeyPoint. If the point is already a CameraKeyPoint then it is replaced with the new CameraKeyPoint. CameraKeyPoints are recorded positions for the camera to move to at a given time.

Specified by:
addCameraKey in interface AddCameraKeyCommandExecutor

removeCameraKey

public void removeCameraKey()
Removes the CameraKeyPoint at the current data point.

Specified by:
removeCameraKey in interface RemoveCameraKeyCommandExecutor

nextCameraKey

public void nextCameraKey()
Removes the CameraKeyPoint at the current data point.

Specified by:
nextCameraKey in interface NextCameraKeyCommandExecutor

previousCameraKey

public void previousCameraKey()
Removes the CameraKeyPoint at the current data point.

Specified by:
previousCameraKey in interface PreviousCameraKeyCommandExecutor

setOutPoint

public void setOutPoint()
Makes the current data point the out point. This has no effect in simulation mode as the current point is always the out point.

Specified by:
setOutPoint in interface SetOutPointCommandExecutor

stepBackward

public void stepBackward()
Step backward one tick. If KeyPoints are enabled step back to the first KeyPoint smaller than the current point. This method has no effect while the simulation is running.

Specified by:
stepBackward in interface StepBackwardCommandExecutor

stepBackward

public void stepBackward(int steps)
Step backward the specified number of ticks. If KeyPoints are enabled step back to the first KeyPoint smaller than the current point. This method has no effect while the simulation is running.

Parameters:
steps - The number of steps, or ticks, to move backward through the data.

stepBackwardNow

public void stepBackwardNow()
Immediately step backward one tick. This method effects simulation mode, However a single backward tick will probably not cause an issue.


stepForward

public void stepForward()
Step forward one tick. If KeyPoints are enabled, step forward to the first KeyPoint larger than the current point. This method has no effect while the simulation is running.

Specified by:
stepForward in interface StepForwardCommandExecutor

stepForward

public void stepForward(int steps)
Step forward the specified number of ticks. If KeyPoints are enabled, step forward to the first KeyPoint larger than the current point. This method has no effect while the simulation is running.

Parameters:
steps - int

stepForwardNow

public void stepForwardNow(int steps)
Immediately step forward the specified number of ticks. This method effects simulation mode and as such can cause unpredictable behavior if stepped during simulation.

Parameters:
steps - int

cropBuffer

public void cropBuffer()
Crops the data buffer to the current in and out points. All data outside of this range is discarded and the graphs are redrawn to fit the existing set. Once the data is cropped the current index is moved to the new start point. This method operates during all modes, if triggered during simulation the transition between the current point and the new start point may result in anomalous behavior.

Specified by:
cropBuffer in interface CropBufferCommandExecutor

packBuffer

public void packBuffer()
Packs the data buffer based on the current inPoint. Essentially this shifts the data such that the inPoint is at index zero. This method can operate during simulation which under some conditions may cause abnormal behavior.

Specified by:
packBuffer in interface PackBufferCommandExecutor

setWrapBuffer

public void setWrapBuffer(boolean wrap)
Specify whether or not the buffer should wrap once the end is reached. By default the buffer expands until it reaches the predefined max size. If enabled the buffer will not expand.

Parameters:
wrap - Should the buffer wrap to the beginning instead of expanding?

changeBufferSize

public void changeBufferSize(int bufferSize)
Either increase or decrease the data buffer's size in units of ticks. The new buffer will begin with the current inPoint and end at one of two points. If the buffer size is increased all of the original data persists otherwise the data is cropped between the inPoint and the new buffer size. The data is packed if the buffer increases in size. In either case the inPoint is shifted to the beginning and the graphs are zoomed to full view.

Parameters:
bufferSize - New buffer size in ticks, the buffer size must be a positive integer.

setMaxBufferSize

public void setMaxBufferSize(int maxBufferSize)
Sets the maximum size, in ticks, to which the buffer will expand. While nonsense values are not explicitly checked for, they will not cause the buffer to shrink or behave abnormally.

Parameters:
maxBufferSize - New max buffer size.

setExportDataDirectory

public void setExportDataDirectory(java.lang.String directory)
Specifies the directory to which data will be exported. By default, this directory is the one in which this simulation's robot is defined.

Parameters:
directory - Path name of the desired directory.

setImportDataDirectory

public void setImportDataDirectory(java.lang.String directory)
Specifies the directory from which data will be imported. By default this directory is the location of the robot class used in this simulation.

Parameters:
directory - String

exportSnapshot

public void exportSnapshot(java.io.File snapshotFile)
Exports a snapshot from the currently active view. This image is saved to the specified file as a jpeg.

Specified by:
exportSnapshot in interface ExportSnapshotCommandExecutor
Parameters:
snapshotFile - File to which the image is saved.

exportSnapshot

public void exportSnapshot(java.io.File snapshotFile,
                           ViewportWindow viewportSelector)
Exports a snapshot from the passed viewportSelector. This image is saved to the specified file as a jpeg.

Parameters:
snapshotFile - File to which the image is saved.
viewportSelector - the viewport to take the snapshot from

exportSnapshot

public void exportSnapshot(java.io.File snapshotFile,
                           CaptureDevice captureDevice)

exportSnapshotAsBufferedImage

public java.awt.image.BufferedImage exportSnapshotAsBufferedImage()

exportSnapshotAsBufferedImage

public java.awt.image.BufferedImage exportSnapshotAsBufferedImage(CaptureDevice captureDevice)

writeData

public void writeData(java.io.File chosenFile)
Writes the data recorded by the simulation to the specified file. This data is stored in a compressed binary format. To import the file with SCS it must have the extension data.gz

Parameters:
chosenFile - File to which the data is saved.

writeData

public void writeData(java.lang.String filename)
Writes the data recorded by the simulation to a file with the provided path. This data is stored in a compressed binary format. To import the file with SCS it must have the extension data.gz

Parameters:
filename - String

writeData

public void writeData(java.lang.String varGroup,
                      boolean binary,
                      boolean compress,
                      java.lang.String filename)
Stores the data for the specified varGroup. This data can be stored as either binary or text and may be compressed or uncompressed. To import the file with SCS it must have the proper extension based on its format. There are two possibilities:
Compressed: data.gz
Uncompressed: data
As an example stuffVars.data.gz would be an acceptable name for a compressed file.
VarGroup "all" contains all simulation variables.

Parameters:
varGroup - Name of the desired varGroup.
binary - Specify the file format, binary or ASCII.
compress - Specify the presence of compression.
filename - Path to the desired file, depends on compress.

writeSpreadsheetFormattedData

public void writeSpreadsheetFormattedData(java.lang.String varGroupName,
                                          java.io.File chosenFile)
Stores simulation data from the specified varGroup in the given File. This data is stored in ASCII CSV (comma separated value) format. To be imported by SCS the file must have the extension .data.csv As this data is uncompressed text it will be far larger than some of the other data storage options.
VarGroup "all" contains all simulation variables.

Parameters:
varGroupName - Name of the varGroup to be stored
chosenFile - File in which to store the data.

writeData

public void writeData(java.lang.String varGroupName,
                      boolean binary,
                      boolean compress,
                      java.io.File chosenFile)
Stores the data for the specified varGroup. This data can be stored as either binary or text and may be compressed or uncompressed. To import the file with SCS it must have the proper extension based on its format. There are two possibilities:
Compressed: data.gz
Uncompressed: data
As an example stuffVars.data.gz would be an acceptable name for a compressed file.
VarGroup "all" contains all simulation variables.

Parameters:
varGroup - Name of the desired varGroup.
binary - Specify the file format, binary or ASCII.
compress - Specify the presence of compression.
chosenFile - File to which data will be saved

writeData

public void writeData(java.util.ArrayList<YoVariable> vars,
                      boolean binary,
                      boolean compress,
                      java.io.File chosenFile)
Stores the data for the specified list of YoVariables. This data can be stored as either binary or text and may be compressed or uncompressed. To import the file with SCS it must have the proper extension based on its format. There are two possibilities:
Compressed: data.gz
Uncompressed: data
As an example stuffVars.data.gz would be an acceptable name for a compressed file.

Specified by:
writeData in interface WriteDataCommandExecutor
Parameters:
vars - Variables to write to file
binary - Specify the file format, binary or ASCII.
compress - Specify the presence of compression.
chosenFile - File to which data will be saved

createMovie

public java.io.File createMovie(java.lang.String movieFilename)

createMovie

public void createMovie(java.io.File movieFile)

getDataBuffer

public DataBuffer getDataBuffer()
Accessor method for the data buffer used by this simulation. This buffer holds all of the record data for each YoVariable used in this simulation.

Returns:
The internal dataBuffer.

writeState

public void writeState(java.io.File chosenFile)
Stores the current state of all variables to the chosen file. This file is uncompressed ASCII, the expected extension is .state

Parameters:
chosenFile - File in which to store the current state.

writeState

public void writeState(java.lang.String filename)
Stores the current state of all variables to the file given by the specified path. This file is uncompressed ASCII, the expected extension is .state

Parameters:
filename - Path to which the file should be stored.

writeState

public void writeState(java.lang.String varGroup,
                       boolean binary,
                       boolean compress,
                       java.lang.String filename)
Stores the current state of all variables contained in the specified varGroup to the file given by the specified path. These variable states can be stored as ASCII text or binary data and may be compressed. Depending on the presence of compression the proper file extension is either .state or .state.gz
VarGroup "all" contains all simulation variables.

Parameters:
varGroup - Name of the variable group to store.
binary - Specify binary data format as opposed to ASCII text.
compress - Indicates whether or not the data is to be compressed.
filename - The path to the desired file.

writeState

public void writeState(java.lang.String varGroupName,
                       boolean binary,
                       boolean compress,
                       java.io.File chosenFile)
Stores the current state of all variables contained in the specified varGroup to the file given by the specified path. These variable states can be stored as ASCII text or binary data and may be compressed. Depending on the presence of compression the proper file extension is either .state or .state.gz
VarGroup "all" contains all simulation variables.

Parameters:
varGroup - Name of the variable group to store.
binary - Specify binary data format as opposed to ASCII text.
compress - Indicates whether or not the data is to be compressed.
chosenFile - File in which the states are to be stored.

writeSpreadsheetFormattedState

public void writeSpreadsheetFormattedState(java.lang.String varGroupName,
                                           java.io.File chosenFile)
Stores the current state of all variables contained in the specified varGroup to the file given by the specified path. These variable states can be stored in .csv format. The proper file extension is .csv
VarGroup "all" contains all simulation variables.

Parameters:
varGroupName - Name of the variable group to store.
chosenFile - File in which the states are to be stored.

readData

public void readData(java.lang.String filename)
Import simulation data from the file at the specified path. The file must be a data export from simulation instruction set. There are three possible extensions; .data, .data.gz, and .data.csv When this function is executed it will replace the current simulation data, if this occurs while the simulation is running numerical instability may ensue.

Parameters:
filename - Path name of the file to be imported

readData

public void readData(java.net.URL url)
Import simulation data from the file at the specified URL. The file must be a data export from simulation instruction set. There are three possible extensions; .data, .data.gz, and .data.csv When this function is executed it will replace the current simulation data, if this occurs while the simulation is running numerical instability may ensue.

Parameters:
url - URL at which the source file is located.

readData

public void readData(java.io.File chosenFile)
Import simulation data from the specified file. The file must be a data export from simulation instruction set. There are three possible extensions; .data, .data.gz, and .data.csv When this function is executed it will replace the current simulation data, if this occurs while the simulation is running numerical instability may ensue.

Parameters:
chosenFile - File to load.

readState

public void readState(java.lang.String filename)
Read in the variable states specified by the file at the provided path. If this method is called during simulation the current variable states will be replaced, this usually results in unpredictable behavior.

Parameters:
filename - Path to desired file.

readState

public void readState(java.io.File chosenFile)
Read in the variable states specified in the provided file. If this method is called during simulation the current variable states will be replaced, usually resulting in unpredictable behavior. This occurs as the simulation is based off both the current and previous data values.

Parameters:
chosenFile - File from which to read the new variable states.

maximizeMainWindow

public void maximizeMainWindow()
Maximizes the primary SCS window in both the x and y directions. When this instruction is executed the window should become full screen.


createNewGraphWindow

public void createNewGraphWindow()
Specified by:
createNewGraphWindow in interface CreateNewGraphWindowCommandExecutor

createNewGraphWindow

public void createNewGraphWindow(java.lang.String graphGroupName)
Creates a new window containing the specified graph group.

Specified by:
createNewGraphWindow in interface CreateNewGraphWindowCommandExecutor
Parameters:
graphGroupName - Name of the desired graph group.

createNewGraphWindow

public void createNewGraphWindow(java.lang.String graphGroupName,
                                 int screenID,
                                 boolean maximizeWindow)
Creates a new window containing the specified graph group. By default the window will be created at the minimum preferred size based on its contents, however, maximization may be specified. The screen ID of the window determines the configuration used. 0 is the default screen ID. For more information on this see the GraphicsConfiguration class in the Java API.

Specified by:
createNewGraphWindow in interface CreateNewGraphWindowCommandExecutor
Parameters:
graphGroupName - Name of the desired graph group.
screenID - The desired screen ID
maximizeWindow - Specify whether or not the window should be maximized.

createNewViewportWindow

public ViewportWindow createNewViewportWindow()
Specified by:
createNewViewportWindow in interface CreateNewViewportWindowCommandExecutor

createNewViewportWindow

public ViewportWindow createNewViewportWindow(java.lang.String viewportName)
Creates a new window containing the specified viewport configuration.

Specified by:
createNewViewportWindow in interface CreateNewViewportWindowCommandExecutor
Parameters:
viewportName - Name of the desired viewport configuration.
Returns:
The new ViewportWindow.
See Also:
ViewportConfiguration

createNewViewportWindow

public ViewportWindow createNewViewportWindow(java.lang.String viewportName,
                                              int screenID,
                                              boolean maximizeWindow)
Creates a new window containing the specified viewport configuration. By default the window will be created at the minimum preferred size based on its contents, however, maximization may be specified. The screen ID of the window determines the configuration used. 0 is the default screen ID. For more information on this see the GraphicsConfiguration class in the Java API.

Specified by:
createNewViewportWindow in interface CreateNewViewportWindowCommandExecutor
Parameters:
viewportName - Name of the desired viewport configuration.
screenID - The desired screen ID
maximizeWindow - Specify whether or not the window should be maximized.
Returns:
ViewportWindow The new ViewportWindow
See Also:
ViewportConfiguration

allowTCPConnectionToHost

public RobotSocketConnection allowTCPConnectionToHost(java.lang.String HOST)

allowTCPConnectionToHost

public RobotSocketConnection allowTCPConnectionToHost(java.lang.String HOST,
                                                      NewDataListener newDataListener)

allowTCPConnectionToHost

public RobotSocketConnection allowTCPConnectionToHost(java.lang.String HOST,
                                                      java.util.ArrayList<NewDataListener> newDataListeners)
Creates a SCSRobotGUICommandListener which communicates to a robot at the specified ethernet HOST address. Only the variables specified in the YoVariableRegistries, set through the GUI are sent and/or logged on the robot side. This method adds the relevant GUI modifications for robot communication. Once communication is established the new RobotSocketConnection monitors and manages robot communication.

Parameters:
HOST - IP address of robot.
Returns:
The new SCSRobotGUICommandListener.
See Also:
SCSRobotGUICommandListener

addVarList

public void addVarList(VarList newVarList)
Adds all of the YoVariables contained in the specified VarList to the simulation. If any of the variables are already present an exception will occur.

Parameters:
newVarList - VarList to be merged with the existing data.

addVarLists

public void addVarLists(VarList[] newVarLists)
Adds all of the YoVariables contained in the provided list of VarLists to the simulation. If any of the variables are already present an exception will occur and that particular VarList will fail. Each varlist will have its own tab in the var panel.

Parameters:
newVarLists - List of VarLists to be added.

addVarLists

public void addVarLists(java.util.ArrayList<VarList> newVarLists)
Adds all of the YoVariables contained in the provided ArrayList of VarLists to the simulation. If any of the variables are already present an exception will occur and that particular VarList will fail. Each varlist will have its own tab in the var panel.

Parameters:
newVarLists - ArrayList

registerCollisionGroup

public void registerCollisionGroup(CollisionGroup group)
Registers the specified collision group with the simulation. Once registered the group will be able to interact with other groups.

Parameters:
group - CollisionGroup
See Also:
CollisionGroup

registerCollisionGroups

public void registerCollisionGroups(java.util.ArrayList<CollisionGroup> groups)
Registers each ccollision group contained in the provided ArrayList with the simulation. Once registered the groups will be able to interact with other groups.

Parameters:
groups - ArrayList
See Also:
CollisionGroup

hideViewport

public void hideViewport()
Hides the main viewport integrated into the SCS GUI. This method has no effect on ViewportWindows.


isViewportHidden

public java.lang.Boolean isViewportHidden()

showViewport

public void showViewport()
Shows the main viewport integrated into the SCS GUI. This method has no effect on ViewportWindows.


attachPlaybackListener

public void attachPlaybackListener(PlaybackListener playbackListener)
Attaches the specified PlaybackListener to the simulation. This listener will only operate while the simulation is running or playing. Whenever the simulation exits either state the listener will stop. For an example of a playbackListener see StateMachinesJPanel

Parameters:
playbackListener - Listener to add.
See Also:
StateMachinesJPanel

applyDataProcessingFunction

public void applyDataProcessingFunction(DataProcessingFunction dataProcessingFunction)
Applies a function to the recorded data starting from the in point to the out point.

Parameters:
dataProcessingFunction - DataProcessingFunction to be applied to the data.
See Also:
DataProcessingFunction

attachSelectedListener

public void attachSelectedListener(SelectedListener selectedListener)
Adds the specified SelectedListener. This listener will be able to react to any mouse event on any camera and is provided with the MouseEvent, point clicked, camera position, and camera fix point. Points are provided as Point3D objects. For more information see the SelectedListener class.

Parameters:
SelectedListener - SelectedListener
See Also:
SelectedListener

attachSimulationRewoundListener

public void attachSimulationRewoundListener(SimulationRewoundListener simulationRewoundListener)
Adds the specified SimulationRewoundListener. This listener will be able to react when the simulation is rewound.

Parameters:
simulationRewoundListener - SimulationRewoundListener

isKeyPointModeToggled

public boolean isKeyPointModeToggled()
Indicates whether or not KeyPoints are in use. Key points are bookmarks in the data, when KeyPoints are in use steps during playback will only move between KeyPoints.

Specified by:
isKeyPointModeToggled in interface ToggleKeyPointModeCommandExecutor
Returns:
Are key points in use?

toggleKeyPointMode

public void toggleKeyPointMode()
Toggle between enabling and disabling the use of KeyPoints. Key points are bookmarks in the data, when KeyPoints are in use steps during playback will only move between KeyPoints.

Specified by:
toggleKeyPointMode in interface ToggleKeyPointModeCommandExecutor

registerToggleKeyPointModeCommandListener

public void registerToggleKeyPointModeCommandListener(ToggleKeyPointModeCommandListener listener)
Specified by:
registerToggleKeyPointModeCommandListener in interface ToggleKeyPointModeCommandExecutor

toggleCameraKeyMode

public void toggleCameraKeyMode()
Toggle between enabling and disabling the use of CameraKeyPoints.

Specified by:
toggleCameraKeyMode in interface ToggleCameraKeyModeCommandExecutor

addExtraJpanel

public void addExtraJpanel(java.awt.Component extraPanel,
                           java.lang.String name)

exportRobotDefinition

public void exportRobotDefinition(Robot robot,
                                  java.io.File chosenFile)

main

public static void main(java.lang.String[] args)

getRunningName

public java.lang.String getRunningName()

setRunName

public void setRunName(java.lang.String name)

getTime

public double getTime()
Specified by:
getTime in interface TimeHolder

setTime

public void setTime(double time)

getVersion

public static java.lang.String getVersion()

getInPoint

public int getInPoint()
Specified by:
getInPoint in interface DataBufferCommandsExecutor

setIndex

public void setIndex(int index)
Specified by:
setIndex in interface DataBufferCommandsExecutor

setIndexButDoNotNotifySimulationRewoundListeners

public void setIndexButDoNotNotifySimulationRewoundListeners(int index)
Specified by:
setIndexButDoNotNotifySimulationRewoundListeners in interface DataBufferCommandsExecutor

getOutPoint

public int getOutPoint()
Specified by:
getOutPoint in interface DataBufferCommandsExecutor

addDynamicGraphicObjectListRegistries

public void addDynamicGraphicObjectListRegistries(DynamicGraphicObjectsListRegistry dynamicGraphicObjectsListRegistry)

hideAllDynamicGraphicObjects

public void hideAllDynamicGraphicObjects()

setDynamicGraphicObjectsListVisible

public void setDynamicGraphicObjectsListVisible(java.lang.String name,
                                                boolean visible)

bringToFront

public void bringToFront()

getDynamicGraphicMenuManager

public DynamicGraphicMenuManager getDynamicGraphicMenuManager()

setDynamicGraphicMenuManager

public void setDynamicGraphicMenuManager(DynamicGraphicMenuManager dynamicGraphicMenuManager)

getGraphics3dAdapter

public Graphics3DAdapter getGraphics3dAdapter()

startStreamingVideoData

public void startStreamingVideoData(CameraConfiguration cameraConfiguration,
                                    int width,
                                    int height,
                                    VideoDataServer videoDataServer,
                                    TimestampProvider timestampProvider,
                                    int framesPerSecond)