[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)
# Fast Wonder SDK
The **Fast Wonder SDK** is a Python library that facilitates communication with the **Hiwonder TurboPi controller**. It provides easy-to-use functions for controlling various peripherals such as RGB LEDs, buzzers, infrared sensors, and more, while ensuring reliable communication with checksum validation using CRC-8.
## Features
- **Control RGB LEDs**: Easily control the colors of RGB LEDs using indexed tuples.
- **Control BUZZER**: Simple API to control the buzzer.
- **Control Infrared Sensors**: Interface with infrared sensors to detect obstacles or follow lines.
- **Control Motors**:
- **Reliable Communication**: Ensures data integrity with CRC-8 checksum validation for communication.
- **Configurable Serial Communication**: Adjust serial communication parameters such as baud rate, timeout, etc.
## Installation
To get started with Fast Wonder SDK, follow these steps:
1. **Clone the repository**:
```bash
git clone https://github.com/dmberezovskyii/fast-hiwonder.git
## Usage
1. **Infra red sensors**
``` python
from fast_hi_wonder import InfraredSensors
# Initialize the sensor with the default I2C address and bus
sensors = InfraredSensors()
# Read sensor data
sensor_states = sensors.read_sensor_data()
# Process sensor states
for i, state in enumerate(sensor_states):
print(f"Sensor {i+1} is {'active' if state else 'inactive'}")
2. **Mecanum wheels**
## Polar Coordinates
In polar coordinates, we describe a point (or movement) in space using two parameters:
- **Radius (r)**: The distance from the origin (0,0) to the point.
- **Angle (θ)**: The direction of the point relative to the X-axis (horizontal axis) in degrees or radians.
In the case of your mechanism:
- **Velocity**: The distance the robot moves per unit of time.
- **Direction**: The angle at which the robot is moving, measured from the X-axis.
## Trigonometry and Coordinate Transformation
To control the robot's movement, we break the velocity down into two components — **vx** and **vy**:
- **vx**: The velocity component along the X-axis (horizontal axis).
- **vy**: The velocity component along the Y-axis (vertical axis).
To calculate these components, we use trigonometric functions:
- **vx** (component along the X-axis) is calculated using the cosine of the direction angle:
\[
vx = \text{velocity} \times \cos(\text{direction})
\]
- **vy** (component along the Y-axis) is calculated using the sine of the direction angle:
\[
vy = \text{velocity} \times \sin(\text{direction})
\]
### Example
If the robot needs to move at a speed of 100 mm/s in the direction of 30 degrees (from the X-axis):
- \( vx = 100 \times \cos(30^\circ) \)
- \( vy = 100 \times \sin(30^\circ) \)
``` python
chassis = Motors()
# Move forward at 100 mm/s in the direction of 0 degrees (forward along the X-axis)
chassis.set_velocity(100, 0, 0)
# Rotate the chassis at an angular rate of 30 degrees per second
chassis.set_velocity(100, 0, 30)
# Translate the chassis based on Cartesian coordinates (e.g., moving diagonally)
chassis.translation(50, 50)
# Stop all motors and reset movement attributes
chassis.reset_motors()
```
## External Links
You can find more information about the TurboPi robot [here](https://www.hiwonder.com/collections/raspberrypi-bionic-robot/products/turbopi?variant=40947238731863).
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-personal-page.svg)](https://stand-with-ukraine.pp.ua)
Raw data
{
"_id": null,
"home_page": "https://github.com/dmberezovskyii/fast-hiwonder",
"name": "turbopi-fast-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "SDK, TurboPi, Python, Hiwonder",
"author": "Dmytro Berezovskyi",
"author_email": "dmberezovskyi@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ba/e9/fb475985046a9473d0fcc046e4f7e75aaaacf80197080e2b9be0b4ceff8f/turbopi_fast_sdk-0.3.3.tar.gz",
"platform": null,
"description": "\n[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)\n\n# Fast Wonder SDK\n\nThe **Fast Wonder SDK** is a Python library that facilitates communication with the **Hiwonder TurboPi controller**. It provides easy-to-use functions for controlling various peripherals such as RGB LEDs, buzzers, infrared sensors, and more, while ensuring reliable communication with checksum validation using CRC-8.\n\n## Features\n\n- **Control RGB LEDs**: Easily control the colors of RGB LEDs using indexed tuples.\n- **Control BUZZER**: Simple API to control the buzzer.\n- **Control Infrared Sensors**: Interface with infrared sensors to detect obstacles or follow lines.\n- **Control Motors**:\n- **Reliable Communication**: Ensures data integrity with CRC-8 checksum validation for communication.\n- **Configurable Serial Communication**: Adjust serial communication parameters such as baud rate, timeout, etc.\n\n## Installation\n\nTo get started with Fast Wonder SDK, follow these steps:\n\n1. **Clone the repository**:\n ```bash\n git clone https://github.com/dmberezovskyii/fast-hiwonder.git\n\n\n## Usage\n1. **Infra red sensors**\n ``` python\n from fast_hi_wonder import InfraredSensors\n\n # Initialize the sensor with the default I2C address and bus\n sensors = InfraredSensors()\n \n # Read sensor data\n sensor_states = sensors.read_sensor_data()\n \n # Process sensor states\n for i, state in enumerate(sensor_states):\n print(f\"Sensor {i+1} is {'active' if state else 'inactive'}\")\n2. **Mecanum wheels**\n ## Polar Coordinates\n\nIn polar coordinates, we describe a point (or movement) in space using two parameters:\n\n- **Radius (r)**: The distance from the origin (0,0) to the point.\n- **Angle (\u03b8)**: The direction of the point relative to the X-axis (horizontal axis) in degrees or radians.\n\nIn the case of your mechanism:\n\n- **Velocity**: The distance the robot moves per unit of time.\n- **Direction**: The angle at which the robot is moving, measured from the X-axis.\n\n## Trigonometry and Coordinate Transformation\n\nTo control the robot's movement, we break the velocity down into two components \u2014 **vx** and **vy**:\n\n- **vx**: The velocity component along the X-axis (horizontal axis).\n- **vy**: The velocity component along the Y-axis (vertical axis).\n\nTo calculate these components, we use trigonometric functions:\n\n- **vx** (component along the X-axis) is calculated using the cosine of the direction angle:\n \\[\n vx = \\text{velocity} \\times \\cos(\\text{direction})\n \\]\n\n- **vy** (component along the Y-axis) is calculated using the sine of the direction angle:\n \\[\n vy = \\text{velocity} \\times \\sin(\\text{direction})\n \\]\n\n### Example\n\nIf the robot needs to move at a speed of 100 mm/s in the direction of 30 degrees (from the X-axis):\n\n- \\( vx = 100 \\times \\cos(30^\\circ) \\)\n- \\( vy = 100 \\times \\sin(30^\\circ) \\)\n\n\n ``` python\n chassis = Motors()\n\n # Move forward at 100 mm/s in the direction of 0 degrees (forward along the X-axis)\n chassis.set_velocity(100, 0, 0)\n\n # Rotate the chassis at an angular rate of 30 degrees per second\n chassis.set_velocity(100, 0, 30)\n\n # Translate the chassis based on Cartesian coordinates (e.g., moving diagonally)\n chassis.translation(50, 50)\n\n # Stop all motors and reset movement attributes\n chassis.reset_motors()\n ```\n## External Links\n\nYou can find more information about the TurboPi robot [here](https://www.hiwonder.com/collections/raspberrypi-bionic-robot/products/turbopi?variant=40947238731863).\n\n[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-personal-page.svg)](https://stand-with-ukraine.pp.ua)\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python SDK for hiwonder TurboPi device communication",
"version": "0.3.3",
"project_urls": {
"Homepage": "https://github.com/dmberezovskyii/fast-hiwonder",
"Repository": "https://github.com/dmberezovskyii/fast-hiwonder"
},
"split_keywords": [
"sdk",
" turbopi",
" python",
" hiwonder"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3774eb41ad85743e68b28db71416777d91237a51277d2faaa57148070d683136",
"md5": "28eae13373a3e2f40c58d8be6c47f13b",
"sha256": "04f955fdf4d6175b7c07ca88cc58c51be6f7c1c7ad1d22a13b4c168b020912f3"
},
"downloads": -1,
"filename": "turbopi_fast_sdk-0.3.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "28eae13373a3e2f40c58d8be6c47f13b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 10316,
"upload_time": "2025-01-03T17:23:40",
"upload_time_iso_8601": "2025-01-03T17:23:40.698721Z",
"url": "https://files.pythonhosted.org/packages/37/74/eb41ad85743e68b28db71416777d91237a51277d2faaa57148070d683136/turbopi_fast_sdk-0.3.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bae9fb475985046a9473d0fcc046e4f7e75aaaacf80197080e2b9be0b4ceff8f",
"md5": "81981d5b655a3338a1d19471fa0e6f8f",
"sha256": "0c45e9065599a8e3213bfc863108db54ca55bba6285a76fe27e6faf0ac33d5a5"
},
"downloads": -1,
"filename": "turbopi_fast_sdk-0.3.3.tar.gz",
"has_sig": false,
"md5_digest": "81981d5b655a3338a1d19471fa0e6f8f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 9204,
"upload_time": "2025-01-03T17:23:42",
"upload_time_iso_8601": "2025-01-03T17:23:42.058804Z",
"url": "https://files.pythonhosted.org/packages/ba/e9/fb475985046a9473d0fcc046e4f7e75aaaacf80197080e2b9be0b4ceff8f/turbopi_fast_sdk-0.3.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-03 17:23:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "dmberezovskyii",
"github_project": "fast-hiwonder",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "turbopi-fast-sdk"
}