Skip to content

SSL-Roots/robocup_scenario_test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RoboCup Scenario Test Python Library

Python application codecov

Python library for RoboCup SSL scenario test.

The library name rcst stands for "RoboCup Scenario Test".

Requirements

Installation

# Install Google Protobuf Compiler
sudo apt install protobuf-compiler

# Install rcst
pip install -v git+https://github.com/SSL-Roots/robocup_scenario_test

Usage

This library provides a plugin for pytest.

So, you can test your scenario like this:

import math
import time


def test_our_kickoff(rcst_comm):
    rcst_comm.send_empty_world()
    rcst_comm.send_ball(0, 0)
    rcst_comm.send_blue_robot(1, -0.5, 0.0, math.radians(0))
    time.sleep(3)  # Wait for the robots to be placed.

    rcst_comm.observer.reset()
    rcst_comm.change_referee_command('STOP', 3.0)
    rcst_comm.change_referee_command('PREPARE_KICKOFF_BLUE', 3.0)
    rcst_comm.change_referee_command('NORMAL_START', 5.0)

    assert rcst_comm.observer.goal().ball_has_been_in_positive_goal() is True

More examples are in tests.

Logging

This library supports the ssl-log-recorder of ssl-go-tools.

You can record logs on the GitHub Actions like this:

- name: Download logger
  run: |
    curl -L https://github.com/RoboCup-SSL/ssl-go-tools/releases/download/v1.5.2/ssl-log-recorder_v1.5.2_linux_amd64 -o ssl-log-recorder
    chmod +x ssl-log-recorder

- name: Run scenario tests
  run: pytest tests/test_scenario_*.py --vision_port=10020 --logging --log_recorder=./ssl-log-recorder

When a test fails, the library saves the log file as TEST_NAME.log.gz in the current directory.

Please see GitHub workflow examples in .github/workflows.

Linting

This project uses flake8 for linting.

Settings for flake8 are in setup.cfg.

cd robocup_scenario_test
flake8 .

License

Apache License 2.0

About

RoboCup Scenario Test Python Library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published