{"id":24708684,"url":"https://github.com/leukipp/opencat-web","last_synced_at":"2025-10-09T10:32:11.468Z","repository":{"id":119517571,"uuid":"197976802","full_name":"leukipp/opencat-web","owner":"leukipp","description":"Web API for Petoi OpenCat Robotics","archived":false,"fork":false,"pushed_at":"2020-04-14T08:15:39.000Z","size":1560,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-22T00:53:05.862Z","etag":null,"topics":["api","robotics","serial","wsgi"],"latest_commit_sha":null,"homepage":"https://github.com/PetoiCamp/OpenCat","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leukipp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-20T20:12:09.000Z","updated_at":"2025-01-15T17:40:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"42067b79-6857-46dc-a415-8f0ae7597739","html_url":"https://github.com/leukipp/opencat-web","commit_stats":null,"previous_names":["leukipp/opencat-web"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leukipp%2Fopencat-web","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leukipp%2Fopencat-web/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leukipp%2Fopencat-web/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leukipp%2Fopencat-web/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leukipp","download_url":"https://codeload.github.com/leukipp/opencat-web/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235813546,"owners_count":19048987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","robotics","serial","wsgi"],"created_at":"2025-01-27T06:38:02.551Z","updated_at":"2025-10-09T10:32:10.853Z","avatar_url":"https://github.com/leukipp.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenCatWeb (v0.3)\n\u003e Web API for Petoi OpenCat Robotics\n\nThis is an extension for Petoi OpenCat robotic kittens.\nIt offers a local running Web API for `GET` requests with `JSON` responses.\n\nThere is also a simple web application with the following features included.\n- Control individual servo positions\n- Control walking mode and head with virtual joysticks\n- Send commands by predefined buttons (like on IR remote control)\n- Send individual commands by text (like on serial terminal)\n\n## Requirements\n### Hardware\n- Working and calibrated OpenCat robot (like Nybble) with NyBoard v0_x\n- Working Raspberry Pi mounted on top of NyBoard\n\nThere are no other hardware or software changes necessary on NyBoard side.\nThe following steps are for Raspberry Pi with Raspbian, but the code will also work on any other hardware with serial access to NyBoard.\n\n### Software\n- Working SSH or VNC access on Raspberry Pi\n- Working NyBoard serial communication on Raspberry Pi\n  - Follow the chapter **\"Raspberry Pi serial port as interface\"** in [OpenCat documentation](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/AssemblingInstructions.pdf) \n  \n\n## Installation\n### Dependencies\nOpenCatWeb uses `Flask` as Python Web Server Gateway Interface (WSGI).\n\n    pip install Flask\n\nThat's it, now we need the source code of OpenCatWeb.\n\n### Source code\nCreate the folder `/home/pi/Projects`.\n\n    cd ~\n    mkdir Projects\n    cd Projects\n    \nUse `git` or download the source code as zip.\n\n    sudo apt-get install git\n    git clone https://github.com/leukipp/OpenCatWeb.git\n    \nYou should now have the folder `/home/pi/Projects/OpenCatWeb`.\n\n\n## Running \n### First start\nStart the webserver at port `8080`.\n\n    cd OpenCatWeb\n    chmod +x bus.py app.py\n    ./app.py\n\nOpen the web browser on another device in the same network and enter `http://\u003cIP_OF_YOUR_RASPBERRY_PI\u003e:8080/`.\n\nYou should see the welcome screen (more in **Usage**)\n\u003e- /web/\n\u003e- /api/\n\n _You can modify the webserver settings at `HOST = '0.0.0.0'` and `PORT = 8080` in `app.py` to your requirements._\n_Don't change and leave `DEBUG = true`, your server won't boot up with auto start._\n\n### Auto start on boot\n_You can change the folder structure for auto start at `DAEMON=/home/pi/Projects/OpenCatWeb/app.py` in `ocw.sh` to your requirements._\n\n    chmod +x ocw.sh \n    sudo cp ocw.sh /etc/init.d/\n    sudo update-rc.d ocw.sh defaults\n\nReboot and check if everything is running on startup.\n\n\n## Usage\nThe documentation of available commands is on the webserver and\nin the chapter **\"Arduino IDE as interface\"** in [OpenCat documentation](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/AssemblingInstructions.pdf).\n\n### API\n![Screenshot](https://github.com/leukipp/OpenCatWeb/blob/master/web/img/api.gif?raw=true)\n\nI have decided to use `GET` for several reasons, most of them because of simplicity.\nYou don't have to use any special software to control your robot.\nA simple browser bookmark is enough to do anything!\n\n\u003eYou can navigate through all API path's until you reach the end.\n\u003e- /web/\n\u003e- /api/\n\u003e  - command/\\\u003cstring:name\\\u003e\n\u003e  - communicate/\n\u003e    - u/\\\u003cint:repeat\\\u003e/\\\u003cint:tempo\\\u003e\n\u003e    - b/\\\u003cint:note\u003e/\\\u003cint:duration\\\u003e\n\u003e  - move/\n\u003e      - m/\\\u003cint:index\\\u003e/\\\u003cint:value\\\u003e\n\u003e      - i/\\\u003cint:index\\\u003e/\\\u003cint:value\\\u003e/\\\u003cint:index\\\u003e/\\\u003cint:value\\\u003e/...\n\u003e      - l/\\\u003cint:valueofindex0\u003e/.../\\\u003cint:valueofindex15\\\u003e\n\u003e  - stop/\n\u003e      - d\n\u003e      - p\n\u003e      - r\n\u003e  - status/\n\u003e      - j\n\nFor every `GET` request on the bottom of the list you will get a `application/json` response. For all others you will get a `text/html` response.\nFor status commands the API response contains the parsed text from the serial output.\n\nCommands for calibration (c, s, a) are not implemented for safety reasons. \n\n### WEB\n![Screenshot](https://github.com/leukipp/OpenCatWeb/blob/master/web/img/web.gif?raw=true)\n\nOn the first page you are able to send predefined commands by clicking the individual buttons.\nAt the bottom you have two joystick's, the left one is for walking and the right one for head movements.\n\nOn the second page you are able to control each servo separately or together if you check the checkbox on the left.\nAt the bottom you can send direct commands followed by the enter key.\n\nThey are some experimental features that are not working satisfying at the moment because of limitation in the serial communication.\n- Auto update\n  - If checked, updates from another page or movements from IR remote will be reflected here\n- Lazy update\n  - If unchecked, updates will occur immediately during slider movements \n\n\n#### Library\nIf you want to create your own application you can use the `ocw.api.js` library.\nEvery method returns a jQuery promise object.\n``` js\nlet api = ocw.Api();\napi.command('ksit').done((data) =\u003e {\n    log.debug(data);\n});\n```\nThe library is not final and there is no further documentation about this.\nFor examples just check the code in `ocw.main.js`.\n\n### Examples (Nybble)\nYou can use your `web browser`, `wget` or any other `script` to make the request.\n\nMeow twice:\n\n    http://\u003cIP_OF_YOUR_RASPBERRY_PI\u003e:8080/api/communicate/u/1/10\n    \nTilt head:\n\n    http://\u003cIP_OF_YOUR_RASPBERRY_PI\u003e:8080/api/move/m/1/0\n    \nTilt and pan head:\n\n    http://\u003cIP_OF_YOUR_RASPBERRY_PI\u003e:8080/api/move/i/0/0/1/0\n\nStand up:\n\n    http://\u003cIP_OF_YOUR_RASPBERRY_PI\u003e:8080/api/command/kbalance\n   \nWith the `/api/command/` you can send any command you like, also custom one's.\n\n\n## Known Issues\n- API\n  - Unauthenticated and unencrypted Web API (use it only in your private network)\n  - No upper/lower bound value validations (know what you send)\n- WEB\n  - Experimental functions are lagging in time\n  - Source code is uncommented\n\n\n## Changelog\n\u003e v0.3 - 2019-07-30\n- WEB\n  - Add mimimum/maximum value validations\n\u003e v0.2 - 2019-07-29\n- API\n  - Improve multiple request's behavior\n- WEB\n  - Add navigation menu\n  - Add command buttons\n  - Add joystick control\n\u003e v0.1 - 2019-07-20\n- Initial release\n\n\n## Thanks to\n- Rongzhong, for the awesome OpenCat project and the allowance to use the Petoi logo\n- Zaghaim, for the code in ardSerial.py that inspired me for the serial communication implementation\n\n## License\n[MIT](https://github.com/leukipp/OpenCatWeb/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleukipp%2Fopencat-web","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleukipp%2Fopencat-web","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleukipp%2Fopencat-web/lists"}