Simulator

Description

The NorthIDE Simulator allows the user to preview how the system will respond to their code in a virtual environment. Simulating a script creates an animated preview of all the commands from the north package sent during the script’s execution. The playback speed and time estimates generated in the Simulator closely represent the behavior of the physical hardware resulting in realistic simulations of the robot's behavior.

Controls

See Simulator Controls for a list of playback and graphic controls.

Targeting the Simulator

There are several ways to direct the commands of a controller object to the Simulator rather than the physical hardware:

When instantiating an object, set the addr argument to the value “sim”:

When executing a script, pass the command-line argument -c9_sim:

When executing a script, use the Simulate button (ctrl+F6) on the IDE rather than the Run Current Script button (F5).

Sim Inputs

The Sim Inputs table allows the user to return values outside of the scope of the simulator (i.e., sensor-measured values). Users can specify either a list of values, a range of random values, or generate values from a Python list comprehension as a data source for each sensor command. These values act as inputs to the Simulator logic, allowing it to handle calls to sensor methods. Sim Inputs can be useful for testing and debugging the flow of a user’s script.

To open the Sim Inputs table, choose View > Sim Inputs. The table will open below the editor, in the same tab group as the Shell.

The left column of the Sim Inputs table contains a nested list of commands. The right column contains a preview of the value list associated with each command. For instance, the entry for the get_input command contains 32 sub-entries with each corresponding to an individual input channel on the C9 Controller. The return values for each sensor channel are configured individually.

Configure Sim Inputs

To set the value list for a given sensor channel, double click on the desired entry in the righthand column of the Sim Inputs table. This action will open the Configure Sim Inputs dialog from which users can access the List, Random, and Expression tools.

Lists

Allows users to manually enter a list of values in the desired order they are to be returned by the sensor channel. For example, the third entry in the get_barcode list will be returned the third time c9.get_barcode() is called. Lists will repeat after the final value is returned. For instance, in a five element list, the sixth call to c9.get_barcode() will return the first entry. Lists need to be formatted with proper Python syntax:


Example list:

Random

Returns an integer value between the min and max integer values (inclusive) provided by the user. The random.randint(min, max) function is called by the controller object for every value requested. The random module does not use a seed value.

Expression

Creates a list of values programmatically. Like the manual List method, this tool uses Python list comprehension syntax. The entire math and random namespaces are available.

IDE Guides