There're a robots on game field. Robot should move on specific trajectory and picks some objects. The trajectory and points of picking-objects is defined by users. Users are not programmers and pretty simple language is created for them. To control robot, user should specify list of actions that should be applied to robot in Excel file.
Commands to control robot specified in table below:
Command | Parameter | Value | Description |
---|---|---|---|
MOVE | Forward/Backward | Integer >= 0 | Move robot in direction by length units |
ROTATE | Clockwise/Counterclockwise | Integer, 0..360 | Rotate robot in direction by angle |
SET_STATE | Velocity | Integer >= 0 | Set robot velocity |
SET_STATE | Battery | Integer 0.. 100, step=5 | Set robot battery level |
TAKE | No parameters | No value | Picks object if it is located in cell with robot |
COMMENT | No parameters | Any text | Print comment text |
User defined scenarios should follow rules:
- Should contain only one sheet with name "Scenario";
- First row shall contain column names: "Command", "Parameter", "Value";
- For every row, Command value should NOT be empty;
- For "MOVE" command Parameter could be "Forward" or "Backward", and Value should be Integer greater or equal to zero;
- For "ROTATE" command Parameter could be "Clockwise" or "Counterclockwise", and Value is Integer in range 0 .. 360 (including);
- For "SET_STATE" command Parameter could be "Velocity" or "Battery";
- For "SET_STATE" command with Parameter = "Velocity", Value should be Integer greater or equal to zero;
- For "SET_STATE" command with Parameter = "Battery", Value should be Integer in range 0 ..100 (including), with step 5;
- For "TAKE" command Parameter and Value should be empty;
- For "COMMENT" command Parameter should be empty, and Value could be any string.
Two modules should be updated with this project specific implementation:
\customization\custom_utils.py
- Function
is_script(root, full_file_name)
implements decision is found file a report using path to the file. Robot scenario should be an Excel file (file with extension 'xls' 'xlsx') and starts with 'RobotScenario_' prefix. - Function
get_configuration_parameters(config)
adds name of scenario sheet, required headers on scenario sheet and possible commands from config.ini file to kwargs parameter that could be used in rules. - Function
get_script(script_path)
returns Excel workbook object for analysis (openpyxl library is used). And several utility functions that helps to check rules: - Function
get_rows_list
gets list of rows for specified sheet in workbook. - Function
get_scenario_header
gets header row (first line) for specified sheet in workbook. - Function
get_scenario_data
gets list of rows without header for specified sheet in workbook. - Function
is_int
checks if string is an integer value.
\customization\rules_definition.py
- Implementation of required rules as functions:
- Description added by decorator;
- Name of function reflects rule.
To run this project openpyxl
library should be installed:
pip install openpyxl==2.4.8
- Replace directory
pyASSA\customization
with directorypyASSA\example_robot_project\customization
. - Replace
pyASSA\configuration\config.ini
file withpyASSA\example_robot_project\config.ini
file. - Run
pyASSA\assa.py
module. - Find report in
pyASSA\reports
directory.