Giter Club home page Giter Club logo

dodo's People

Contributors

evelinag avatar radka-j avatar rkm avatar tallamjr avatar thobson88 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dodo's Issues

Update separation functions

If provided aircraft ID not in simulation, separation functions should return missing values in row/col for this aircraft:

  • make this clear in specification
  • implement in PyDodo

Already in rdodo.

Travis build failing

See recent pull requests (e.g., #79 which only updates docstrings).

Get:

TypeError: attrib() got an unexpected keyword argument 'convert'

This seems to be a pytest error and might have to do with pytest version (as described here)

Failing CI due to breaking change in pytest

In recent builds from #79 and #78 a failure has occurred on Travis which prints:

Traceback (most recent call last):
  File "/home/travis/miniconda/envs/p36/bin/pytest", line 10, in <module>
    sys.exit(main())
  File "/home/travis/miniconda/envs/p36/lib/python3.6/site-packages/_pytest/config/__init__.py", line 61, in main
    config = _prepareconfig(args, plugins)
  File "/home/travis/miniconda/envs/p36/lib/python3.6/site-packages/_pytest/config/__init__.py", line 182, in _prepareconfig
    config = get_config()
  File "/home/travis/miniconda/envs/p36/lib/python3.6/site-packages/_pytest/config/__init__.py", line 156, in get_config
    pluginmanager.import_plugin(spec)
  File "/home/travis/miniconda/envs/p36/lib/python3.6/site-packages/_pytest/config/__init__.py", line 530, in import_plugin
    __import__(importspec)
  File "/home/travis/miniconda/envs/p36/lib/python3.6/site-packages/_pytest/tmpdir.py", line 25, in <module>
    class TempPathFactory(object):
  File "/home/travis/miniconda/envs/p36/lib/python3.6/site-packages/_pytest/tmpdir.py", line 35, in TempPathFactory
    lambda p: Path(os.path.abspath(six.text_type(p)))
TypeError: attrib() got an unexpected keyword argument 'convert'

It appears that pytest seems to have the package attrs as a dependency.

REF: https://stackoverflow.com/questions/58189683/typeerror-attrib-got-an-unexpected-keyword-argument-convert

Update specification

The current implementations of all_positions and aircraft_positions return more columns than currently described in the specification document.

Check description of all functions.

`change_speed` request not working

Running the whole stack using the simurgh dockers. I found in the example scenario I was unable to change the vehicle speed with change_speed, the target vehicle would continue with the same speed, the command did not fail as no exception occurred. Likewise using the twitcher UI trying to change the speed also would not work.

I instanced a new vehicle using the dodo command, and again I found I was unable either via dodo or twitcher to change the vehicles speed.

sector_exit value return

The sector_exit command doesn't return any value...I would like to know if there is any issue with that?

test_manage_simulation.py::test_load_bluesky - Failure

When examining the issues relating to https://github.com/alan-turing-institute/dodo/pull/64 , I compared the method for
integration tests with what is being done in simurgh's travis script
This lead to the discovery of where it appeared to be issues with
load_scenario() function in bluebird

When running the integration tests locally using docker the following test fails:

...
tests/integration/test_manage_simulation.py::test_simulation_control PASSED
tests/integration/test_manage_simulation.py::test_load_bluesky FAILED
tests/integration/test_manage_simulation.py::test_load_fail PASSED
...

With the accompanying error of:

if http_error_msg:
>           raise HTTPError(http_error_msg, response=self)
E           requests.exceptions.HTTPError: 500 Server Error: INTERNAL SERVER ERROR for url: http://localhost:5001/api/v1/ic

It appears the test expects the file extension to be lowercase but is in fact
upper case as found in bluesky/scenario/8.SCN. A change to
tests/test_simulation_control.py should resolve this.

Please see this https://github.com/alan-turing-institute/nats/issues/98 where it outlines the fact that although this appears to be a general issue, it does not seem to arise when one does not use the docker builds

Update dodo to match bluebird release 1.1.0

  • Update get_position and all_positions functions to match changes in POS endpoint

    • endpoint includes info on sim_t - add as attribute to df
  • Update load_scenario function

    • endpoint includes optional multiplier parameter
  • Add new endpoints:

    • Direct to Waypoint (DIRECT)
    • List Route (LISTROUTE)
  • Update Specification

tests/integration/test_flight_level.py::test_flight_level FAILED

tests/integration/test_flight_level.py::test_flight_level FAILED

The above test currently fails. The following is the output from the CI builds:

______________________________ test_flight_level _______________________________
    @pytest.mark.skipif(not bb_resp, reason="Can't connect to bluebird")
    def test_flight_level():
        cmd = reset_simulation()
        assert cmd == True
    
        resp = load_scenario("scenario/8.SCN")
        assert resp == True
    
>       assert current_flight_level("SCN1001") == 6096
tests/integration/test_flight_level.py:18: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pydodo/get_flight_level.py:96: in current_flight_level
    return get_flight_level(aircraft_id)['fl_current']
pydodo/get_flight_level.py:15: in get_flight_level
    resp.raise_for_status()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <Response [405]>
    def raise_for_status(self):
        """Raises stored :class:`HTTPError`, if one occurred."""
    
        http_error_msg = ''
        if isinstance(self.reason, bytes):
            # We attempt to decode utf-8 first because some servers
            # choose to localize their reason strings. If the string
            # isn't utf-8, we fall back to iso-8859-1 for all other
            # encodings. (See PR #3538)
            try:
                reason = self.reason.decode('utf-8')
            except UnicodeDecodeError:
                reason = self.reason.decode('iso-8859-1')
        else:
            reason = self.reason
    
        if 400 <= self.status_code < 500:
            http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url)
    
        elif 500 <= self.status_code < 600:
            http_error_msg = u'%s Server Error: %s for url: %s' % (self.status_code, reason, self.url)
    
        if http_error_msg:
>           raise HTTPError(http_error_msg, response=self)
E           requests.exceptions.HTTPError: 405 Client Error: METHOD NOT ALLOWED for url: http://localhost:5001/api/v1/alt?acid=SCN1001

Update found_bluebird function

Requests to the unqualified bluebird url (by default http://0.0.0.0:5001/) get a 404 response in Bluebird 1.3.0, so an update is needed to the found_bluebird function.

mismatch of speeds reported between twitcher and pydodo

Running the example file in simurgh, after some time and some change speed commands to the aircraft (which has it's own issue #114)

The ground speed in knots don't match between pydodo and twitcher:

image

image

the dodo spec says the speeds are in knts. The issue is there for both example vehicles.

update config_param() function

User might need to specify host bluebird is running on (if other than localhost) and what simulator communicating with (default is bluesky).

Add config parameters in rdodo

Replace hard-coded strings (such as Bluebird endpoints ic, cre, etc.) with meaningful key-value configuration parameters. (See the config package.)

config.yml hard coded address

The host address is hard coded to 51.145.47.193
Agent are likely to use their 'localhost' address.
Either update the README to instruct the user to alter the address, or set the default host to 'localhost'.
i.e.
python3 run.py default_input_agents_read_scn.ini
will fail with:
HTTPConnectionPool(host='51.145.47.193', port=5002): Max retries exceeded with url: /api/v1/reset (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f61cee12358>: Failed to establish a new connection: [Errno 110] Connection timed out',))

Fix pydodo tests

  • simulation_step() doesn't work if no scenario has been loaded
    --> remove create_aircraft with load_scenario in all tests.

`change_altitude` does nothing for a vehicle with zero horizonal speed

Sorry I'm not sure if it belongs here or in Bluebird.

I created using create_aircraft a vehicle with a type "Phan4" from https://github.com/project-bluebird/bluesky/blob/master/data/performance/OpenAP/rotor/aircraft.json

The change_altitude command only seems to work in the simulation when the vehicle has some horizontal motion and the altitude remains fixed when the craft has a ground_speed of 0. How do a get a rotor craft behave more like a rotor craft and less like a fixed wing craft?

Travis build sometimes fails

The issue are PyDodo integration tests. On some builds they all return 500 internal server error. This seems to suggest BlueSky might not be running and it is unclear why.

Is it possible asynchronous functions (the first integration tests to run) make BlueSky crash?

tests/integration/test_manage_simulation.py::test_simulation_control FAILED

tests/integration/test_manage_simulation.py::test_simulation_control FAILED

The above test currently fails. The following is the output from the CI builds:

___________________________ test_simulation_control ____________________________
    @pytest.mark.skipif(not bb_resp, reason="Can't connect to bluebird")
    def test_simulation_control():
        """
        Test simulation endpoints
        - Pause Simulation
        - Resume Simulation
        - Reset Simulation
        - Simulation time
        - Simulator mode
        - Simulation step
        """
        aircraft_id = "TST1001"
        type = "B744"
        latitude = 0
        longitude = 0
        heading = 0
        altitude = None
        flight_level = 250
        speed = 200
    
        resp = reset_simulation()
        assert resp == True
    
        resp = create_aircraft(
            aircraft_id, type, latitude, longitude, heading, speed, altitude, flight_level
        )
        assert resp == True
    
        pos0 = aircraft_position(aircraft_id)
    
        resp = pause_simulation()
        assert resp == True
    
        pos1 = aircraft_position(aircraft_id)
        # check that position has changed since last position call
        assert pos1.loc[aircraft_id]["latitude"] > pos0.loc[aircraft_id]["latitude"]
    
        pos2 = aircraft_position(aircraft_id)
        # check that position has not changed since simulation was paused
        assert pos1.loc[aircraft_id]["latitude"] == pos2.loc[aircraft_id]["latitude"]
    
        resp = resume_simulation()
        assert resp == True
    
        pos3 = aircraft_position(aircraft_id)
        # check that position has changed since simulation was resumed
        assert pos3.loc[aircraft_id]["latitude"] > pos2.loc[aircraft_id]["latitude"]
    
        resp = set_simulation_rate_multiplier(1.5)
        assert resp == True
    
>       cmd = set_simulator_mode("agent")
tests/integration/test_manage_simulation.py:78: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pydodo/simulation_control.py:164: in set_simulator_mode
    return post_request(config_param("endpoint_simulator_mode"), body)
pydodo/utils.py:13: in post_request
    resp.raise_for_status()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <Response [404]>
    def raise_for_status(self):
        """Raises stored :class:`HTTPError`, if one occurred."""
    
        http_error_msg = ''
        if isinstance(self.reason, bytes):
            # We attempt to decode utf-8 first because some servers
            # choose to localize their reason strings. If the string
            # isn't utf-8, we fall back to iso-8859-1 for all other
            # encodings. (See PR #3538)
            try:
                reason = self.reason.decode('utf-8')
            except UnicodeDecodeError:
                reason = self.reason.decode('iso-8859-1')
        else:
            reason = self.reason
    
        if 400 <= self.status_code < 500:
            http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url)
    
        elif 500 <= self.status_code < 600:
            http_error_msg = u'%s Server Error: %s for url: %s' % (self.status_code, reason, self.url)
    
        if http_error_msg:
>           raise HTTPError(http_error_msg, response=self)
E           requests.exceptions.HTTPError: 404 Client Error: NOT FOUND for url: http://localhost:5001/api/v1/simmode

discuss how best to implement step() in dodo

In BlueBird, to use the step() function have to first:

  • set SIMMODE to 'agent'
  • set DTMULT to what want the step size to be

Only after that is it possible to call step().

Should dodo offer a single step function that executes all of these steps (or something along those line)?

Auto generation of PyDodo documentation using Sphinx

By using Sphinx an auto generated set of static html files can be created such that one can showcase in detail the API of Pydodo as well as include links to relevant source code.

The would be contained inside a docs/ folder and served from master branch to be viewable via Github pages

requests.exceptions.HTTPError: 405 Client Error: METHOD NOT ALLOWED

Error raised when attempting to call functions in pydodo/get_flight_level.py.

After creating the following aircraft with:

>>> dodo.create_aircraft('BA1', 'A320', 10., 10., 10., 2000, 200)
True
>>> dodo.all_positions()
     type  altitude  ground_speed  latitude  longitude  vertical_speed
BA1  A320    196.85          1023  10.11094   10.01987               0

Then running a check on the flight level for example return this error:

>>> dodo.get_flight_level.current_flight_level('BA1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/anaconda3/envs/nats/lib/python3.6/site-packages/pydodo/get_flight_level.py", line 96, in current_flight_level
    return get_flight_level(aircraft_id)['fl_current']
  File "/usr/local/anaconda3/envs/nats/lib/python3.6/site-packages/pydodo/get_flight_level.py", line 15, in get_flight_level
    resp.raise_for_status()
  File "/usr/local/anaconda3/envs/nats/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 405 Client Error: METHOD NOT ALLOWED for url: http://localhost:5001/api/v1/alt?acid=BA1

The same output occurs for both cleared_flight_level( .. ) and requested_flight_level( .. ) also.

Bluesky version:

v1.2.2 - docker image

Bluebird version:

v1.2.1 - docker image

Decide how to handle unsuccessful API call attempts

How should dodo functions that wrap BlueBird API calls report error messages in case of failure?

Such reporting will be necessary for agents to decide how to react. For instance, the create_aircraft function returns a boolean value, with FALSE indicating that the attempt failed. However, there are various possible reasons for failure and the agent's next move may depend on the reason (e.g. it makes sense to retry in case of network error but not if the call failed because an aircraft with the given ID already exists). At the very least the agent will want to log the error message.

Should we instead throw an exception and include the error message returned by BlueBird in the HTTP response?

listroute() df should indicate which order waypoints appear in on route

The listroute() function returns a data frame with waypoint names as row indexes. In PyDodo, these are currently sorted in alphabetical order (rather than the order in which they are meant to be passed on the route). Fix order to reflect route order.

Investigate whether this is also an issue in rdodo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.