python-iq-sim


Namepython-iq-sim JSON
Version 0.0.4 PyPI version JSON
download
home_page
SummaryPython Library for starting and managing simulations in the Intelligent Quads Cloud
upload_time2023-08-04 21:01:18
maintainer
docs_urlNone
authorEric Johnson
requires_python
license
keywords python sim cloud mavlink ardupilot px4
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Python-IQ-Sim

This repo is a python library for controlling starting stopping and managing simulations running in the Intelligent Quads Cloud.

## Installation

```bash
pip install python-iq-sim
```

## Generate Docs

```bash
pydoc-markdown -I iq_sim -m iq_sim --render-toc > docs/iq_sim.md
```

## Documentation Available 

https://intelligent-quads.gitbook.io/python-iq-sim-documentation/

## Example

```python
import iq_sim
import os
from pymavlink import mavutil


token = os.getenv("IQ_SIM_TOKEN")

api = iq_sim.iq_sim(token)
sim_id = api.start_sim()
api.wait_for_sim_ready(sim_id)

connection_info = api.get_connection(sim_id)
print(connection_info)
conn_str = f"tcp:{connection_info['ip']}:{connection_info['port']}"

mavlink_conn = mavutil.mavlink_connection(conn_str)
mavlink_conn.wait_heartbeat()
print("Heartbeat from system (system %u component %u)" % (mavlink_conn.target_system, mavlink_conn.target_system))

# add pymavlink script here

api.stop_sim(sim_id)
```

## Customize Simulation Configuration

Simulation Configuration is in the form of:
```json
{
    "sim_config": [
        {
            "sim_type": "default-sitl",
            "vehicle_type": "ArduCopter",
            "vehicle_model": "X",
            "instances": "1",
            "flight_controls": "Ardupilot",
            "fc_version": "Copter-4.2.3",
            "latlonaltheading": [
                "-35.363261",
                "149.16523",
                "584",
                "353"
            ]
        }
    ]
}
```
the default config is available by accessing `iq_sim().sim_config`. This can be modified and passed to the `start_sim` method as shown below:


```python
import iq_sim
import os
from pymavlink import mavutil


token = os.getenv("IQ_SIM_TOKEN")

api = iq_sim.iq_sim(token)
config = api.sim_config
config["sim_config"][0]["instances"] = "2"
sim_id = api.start_sim(config)
api.wait_for_sim_ready(sim_id)

connection_info = api.get_connection(sim_id)
print(connection_info)
conn_str = f"tcp:{connection_info['ip']}:{connection_info['port']}"

mavlink_conn = mavutil.mavlink_connection(conn_str)
mavlink_conn.wait_heartbeat()
print("Heartbeat from system (system %u component %u)" % (mavlink_conn.target_system, mavlink_conn.target_system))

# add pymavlink script here

api.stop_sim(sim_id)

```



            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "python-iq-sim",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,sim,cloud,mavlink,ardupilot,px4",
    "author": "Eric Johnson",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/1c/60/11320a4046e9cb5430f443c7086052bc6d28fc3b6c5e41feb74314438e5f/python-iq-sim-0.0.4.tar.gz",
    "platform": null,
    "description": "\n# Python-IQ-Sim\n\nThis repo is a python library for controlling starting stopping and managing simulations running in the Intelligent Quads Cloud.\n\n## Installation\n\n```bash\npip install python-iq-sim\n```\n\n## Generate Docs\n\n```bash\npydoc-markdown -I iq_sim -m iq_sim --render-toc > docs/iq_sim.md\n```\n\n## Documentation Available \n\nhttps://intelligent-quads.gitbook.io/python-iq-sim-documentation/\n\n## Example\n\n```python\nimport iq_sim\nimport os\nfrom pymavlink import mavutil\n\n\ntoken = os.getenv(\"IQ_SIM_TOKEN\")\n\napi = iq_sim.iq_sim(token)\nsim_id = api.start_sim()\napi.wait_for_sim_ready(sim_id)\n\nconnection_info = api.get_connection(sim_id)\nprint(connection_info)\nconn_str = f\"tcp:{connection_info['ip']}:{connection_info['port']}\"\n\nmavlink_conn = mavutil.mavlink_connection(conn_str)\nmavlink_conn.wait_heartbeat()\nprint(\"Heartbeat from system (system %u component %u)\" % (mavlink_conn.target_system, mavlink_conn.target_system))\n\n# add pymavlink script here\n\napi.stop_sim(sim_id)\n```\n\n## Customize Simulation Configuration\n\nSimulation Configuration is in the form of:\n```json\n{\n    \"sim_config\": [\n        {\n            \"sim_type\": \"default-sitl\",\n            \"vehicle_type\": \"ArduCopter\",\n            \"vehicle_model\": \"X\",\n            \"instances\": \"1\",\n            \"flight_controls\": \"Ardupilot\",\n            \"fc_version\": \"Copter-4.2.3\",\n            \"latlonaltheading\": [\n                \"-35.363261\",\n                \"149.16523\",\n                \"584\",\n                \"353\"\n            ]\n        }\n    ]\n}\n```\nthe default config is available by accessing `iq_sim().sim_config`. This can be modified and passed to the `start_sim` method as shown below:\n\n\n```python\nimport iq_sim\nimport os\nfrom pymavlink import mavutil\n\n\ntoken = os.getenv(\"IQ_SIM_TOKEN\")\n\napi = iq_sim.iq_sim(token)\nconfig = api.sim_config\nconfig[\"sim_config\"][0][\"instances\"] = \"2\"\nsim_id = api.start_sim(config)\napi.wait_for_sim_ready(sim_id)\n\nconnection_info = api.get_connection(sim_id)\nprint(connection_info)\nconn_str = f\"tcp:{connection_info['ip']}:{connection_info['port']}\"\n\nmavlink_conn = mavutil.mavlink_connection(conn_str)\nmavlink_conn.wait_heartbeat()\nprint(\"Heartbeat from system (system %u component %u)\" % (mavlink_conn.target_system, mavlink_conn.target_system))\n\n# add pymavlink script here\n\napi.stop_sim(sim_id)\n\n```\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python Library for starting and managing simulations in the Intelligent Quads Cloud",
    "version": "0.0.4",
    "project_urls": null,
    "split_keywords": [
        "python",
        "sim",
        "cloud",
        "mavlink",
        "ardupilot",
        "px4"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d26da8566d2321b25bc29271a934ce14e8e534782c21cdd671cae11883d76519",
                "md5": "721673e3bb0bfb6a917628ecd7d6778f",
                "sha256": "98a7bae3bab3f2c391b7f51194143cee0ca7efbe077225796d3259eb34ad6c54"
            },
            "downloads": -1,
            "filename": "python_iq_sim-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "721673e3bb0bfb6a917628ecd7d6778f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4803,
            "upload_time": "2023-08-04T21:01:16",
            "upload_time_iso_8601": "2023-08-04T21:01:16.876280Z",
            "url": "https://files.pythonhosted.org/packages/d2/6d/a8566d2321b25bc29271a934ce14e8e534782c21cdd671cae11883d76519/python_iq_sim-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1c6011320a4046e9cb5430f443c7086052bc6d28fc3b6c5e41feb74314438e5f",
                "md5": "e767dcecdbb534eddb40f454f95059d3",
                "sha256": "fa12829d5a7c4575b7697a70472ea08ca678e95f4c1a52f7f2e0453da8cb3889"
            },
            "downloads": -1,
            "filename": "python-iq-sim-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "e767dcecdbb534eddb40f454f95059d3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3903,
            "upload_time": "2023-08-04T21:01:18",
            "upload_time_iso_8601": "2023-08-04T21:01:18.393572Z",
            "url": "https://files.pythonhosted.org/packages/1c/60/11320a4046e9cb5430f443c7086052bc6d28fc3b6c5e41feb74314438e5f/python-iq-sim-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-04 21:01:18",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "python-iq-sim"
}
        
Elapsed time: 2.27625s