BTS-dji


NameBTS-dji JSON
Version 0.1.10 PyPI version JSON
download
home_pagehttps://github.com/bendigo-tech-school/BTS-dji
SummaryA simplified version of the dji robomaster library with some addons. Made for the bendigo tech school.
upload_time2023-09-07 04:46:50
maintainer
docs_urlNone
authorBevan Matsacos
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements imageio inputs MyQR netaddr netifaces numpy opencv-python Pillow pynput robomaster six
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # BTS-dji
#### Table of Contents
- [BTS-dji.Robomaster](#BTS-djirobomaster)
- [BTS-dji.Tello](#BTS-djitello)
- [BTS-dji.Controler](#BTS-djicontroler)
- [BTS-dji.Keyboard](#BTS-djikeyboard)

## Description
BTS-dji is a library designed to assist children in programming the DJI Robomasters and DJI Tellos in a simple way. It includes additional features to provide extra help to children, and it was specifically created for the Bendigo Tech School.
## BTS-dji.Robomaster

`BTS-dji.Robomaster` is a Python library for controlling a robot. Below is a list of functions that can be used to interact with the robot:

- `robot.start()`: This function starts the robot and shows the camera feed.

- `robot.driveWheels(fr, fl, bl, br)`: This function controls the speed of each wheel individually, setting it to a value between 200 and -200. The variables are:
  - Wheels
  - fr = front right
  - fl = front left
  - bl = back left
  - br = back right
  Example: `robot.driveWheels(w1=w1, w2=w2, w3=w3, w4=w4)  # drive each wheel at a given speed`


- `sleep(t)`: This function pauses your code for a specific amount of time. The variable is:
  - t = time
  Example: `sleep(10)  # sleep for 10 seconds`


- `robot.gripper(t, d)`: Use this function to open or close the gripper on the robot's arm, with "d" indicating the direction (-1 for close, 1 for open). The variables are:
  - t = time
  - d = direction
  Example: `robot.gripper(0.5, 1)  # time | direction 1 or -1`


- `robot.arm(x, y)`: This function moves the robot's arm relative to its current position. For example, if it's currently at position (20, 20), a movement command of (10, 10) would move it to (30, 30). The variables are:
  - x = forward
  - y = up/down
  Example: `robot.arm(10, 10)  # move arm by 10 x and 10 y`


- `robot.LED(r, g, b)`: Use this function to set the color of the robot's LEDs using RGB values ranging from 0 to 255. The variables are:
  - r = red
  - g = green
  - b = blue
  Example: `robot.LED(255, 255, 255)  # r g b`


Here is an example code snippet that demonstrates how to use the `Robomaster` library to control a robot:

```python
from BTS-dji import Robomaster as robot  # import the Robomaster module from BTS-dji library
from time import sleep  # import the sleep function from the time module

robot.start()  # start the robot

def drive():  # define the drive function

    # set the speed of each wheel to 1000 for one second
    w1 = 1000
    w2 = 1000
    w3 = 1000
    w4 = 1000
    robot.driveWheels(w1=w1, w2=w2, w3=w3, w4=w4)
    sleep(1)  # pause for one second

    # set the speed of all wheels to 0
    w1 = 0
    w2 = 0
    w3 = 0
    w4 = 0
    robot.driveWheels(w1=w1, w2=w2, w3=w3, w4=w4)

def gripper():  # define the gripper function

    # open and close the gripper on the robot's arm
    robot.gripper(0.5, 1)
    robot.gripper(0.5, -1)

def arm():  # define the arm function

    # move the robot's arm to two different positions and pause for two seconds in between
    robot.arm(10, 10)
    sleep(2)
    robot.arm(30, 30)

def led():  # define the led function

    # set the color of the robot's LEDs to white for two seconds, then to green
    robot.LED(255, 255, 255)
    sleep(2)
    robot.LED(0, 255, 0)
    
drive()  # calls drive
arm()  # calls arm
gripper()  # calls gripper
led()  # calls led
```
## BTS-dji.Tello

`BTS-dji.Tello` is still in development and not yet available.

## BTS-dji.Controler

`BTS-dji.Controler` is a simple gamepad/joystick input library designed for beginners in Python. To use it, follow these steps:
1. Import the module.
2. Start the script by running `Controler.start()`.
3. To check if a button or joystick is pressed, run `input = Controler.get_state(0)`.
4. The `input` variable is a dictionary that contains the states of all buttons and joysticks. You can access the state of a specific button or joystick by looking it up in the dictionary using its name, for example: `print(input["button_a"])` will return either 0 or 1 depending on whether the 'A' button is currently pressed or not.
```py
from BTS-dji import Controler  # import controler

Controler.start()  # start the controler listener

while True:
    input = Controler.get_state(0)  # get the state of the controler
    print(input["a"])  # print the state of the "a" button
```



## BTS-dji.kbd

`BTS-dji.kbd` is a simple keyboard input library designed for beginners in Python. To use it, follow these steps:
1. Import the module.
2. Start the script by running `kbd.start()`.
3. To check if a key is pressed, run `input = kbd.get_state(0)`.
4. The `input` variable is a dictionary that contains the states of all keys. You can access the state of a specific key by looking it up in the dictionary using its name, for example: `print(input["b"])` will return either 0 or 1 depending on whether the 'b' key is currently pressed or not.

```py
from BTS-dji import kbd  # import kbd

kbd.start()  # start the kbd listener

while True:
    input = kbd.get_state(0)  # get the state of the kbd
    print(input["a"])  # print the state of the "a" key
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bendigo-tech-school/BTS-dji",
    "name": "BTS-dji",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Bevan Matsacos",
    "author_email": "B.Matsacos@latrobe.edu.au",
    "download_url": "https://files.pythonhosted.org/packages/57/8c/d9054f0a62052e8af1077b0683f9f40b460dec1dc114ca4ad7fe16635e45/BTS-dji-0.1.10.tar.gz",
    "platform": null,
    "description": "# BTS-dji\n#### Table of Contents\n- [BTS-dji.Robomaster](#BTS-djirobomaster)\n- [BTS-dji.Tello](#BTS-djitello)\n- [BTS-dji.Controler](#BTS-djicontroler)\n- [BTS-dji.Keyboard](#BTS-djikeyboard)\n\n## Description\nBTS-dji is a library designed to assist children in programming the DJI Robomasters and DJI Tellos in a simple way. It includes additional features to provide extra help to children, and it was specifically created for the Bendigo Tech School.\n## BTS-dji.Robomaster\n\n`BTS-dji.Robomaster` is a Python library for controlling a robot. Below is a list of functions that can be used to interact with the robot:\n\n- `robot.start()`: This function starts the robot and shows the camera feed.\n\n- `robot.driveWheels(fr, fl, bl, br)`: This function controls the speed of each wheel individually, setting it to a value between 200 and -200. The variables are:\n  - Wheels\n  - fr = front right\n  - fl = front left\n  - bl = back left\n  - br = back right\n  Example: `robot.driveWheels(w1=w1, w2=w2, w3=w3, w4=w4)  # drive each wheel at a given speed`\n\n\n- `sleep(t)`: This function pauses your code for a specific amount of time. The variable is:\n  - t = time\n  Example: `sleep(10)  # sleep for 10 seconds`\n\n\n- `robot.gripper(t, d)`: Use this function to open or close the gripper on the robot's arm, with \"d\" indicating the direction (-1 for close, 1 for open). The variables are:\n  - t = time\n  - d = direction\n  Example: `robot.gripper(0.5, 1)  # time | direction 1 or -1`\n\n\n- `robot.arm(x, y)`: This function moves the robot's arm relative to its current position. For example, if it's currently at position (20, 20), a movement command of (10, 10) would move it to (30, 30). The variables are:\n  - x = forward\n  - y = up/down\n  Example: `robot.arm(10, 10)  # move arm by 10 x and 10 y`\n\n\n- `robot.LED(r, g, b)`: Use this function to set the color of the robot's LEDs using RGB values ranging from 0 to 255. The variables are:\n  - r = red\n  - g = green\n  - b = blue\n  Example: `robot.LED(255, 255, 255)  # r g b`\n\n\nHere is an example code snippet that demonstrates how to use the `Robomaster` library to control a robot:\n\n```python\nfrom BTS-dji import Robomaster as robot  # import the Robomaster module from BTS-dji library\nfrom time import sleep  # import the sleep function from the time module\n\nrobot.start()  # start the robot\n\ndef drive():  # define the drive function\n\n    # set the speed of each wheel to 1000 for one second\n    w1 = 1000\n    w2 = 1000\n    w3 = 1000\n    w4 = 1000\n    robot.driveWheels(w1=w1, w2=w2, w3=w3, w4=w4)\n    sleep(1)  # pause for one second\n\n    # set the speed of all wheels to 0\n    w1 = 0\n    w2 = 0\n    w3 = 0\n    w4 = 0\n    robot.driveWheels(w1=w1, w2=w2, w3=w3, w4=w4)\n\ndef gripper():  # define the gripper function\n\n    # open and close the gripper on the robot's arm\n    robot.gripper(0.5, 1)\n    robot.gripper(0.5, -1)\n\ndef arm():  # define the arm function\n\n    # move the robot's arm to two different positions and pause for two seconds in between\n    robot.arm(10, 10)\n    sleep(2)\n    robot.arm(30, 30)\n\ndef led():  # define the led function\n\n    # set the color of the robot's LEDs to white for two seconds, then to green\n    robot.LED(255, 255, 255)\n    sleep(2)\n    robot.LED(0, 255, 0)\n    \ndrive()  # calls drive\narm()  # calls arm\ngripper()  # calls gripper\nled()  # calls led\n```\n## BTS-dji.Tello\n\n`BTS-dji.Tello` is still in development and not yet available.\n\n## BTS-dji.Controler\n\n`BTS-dji.Controler` is a simple gamepad/joystick input library designed for beginners in Python. To use it, follow these steps:\n1. Import the module.\n2. Start the script by running `Controler.start()`.\n3. To check if a button or joystick is pressed, run `input = Controler.get_state(0)`.\n4. The `input` variable is a dictionary that contains the states of all buttons and joysticks. You can access the state of a specific button or joystick by looking it up in the dictionary using its name, for example: `print(input[\"button_a\"])` will return either 0 or 1 depending on whether the 'A' button is currently pressed or not.\n```py\nfrom BTS-dji import Controler  # import controler\n\nControler.start()  # start the controler listener\n\nwhile True:\n    input = Controler.get_state(0)  # get the state of the controler\n    print(input[\"a\"])  # print the state of the \"a\" button\n```\n\n\n\n## BTS-dji.kbd\n\n`BTS-dji.kbd` is a simple keyboard input library designed for beginners in Python. To use it, follow these steps:\n1. Import the module.\n2. Start the script by running `kbd.start()`.\n3. To check if a key is pressed, run `input = kbd.get_state(0)`.\n4. The `input` variable is a dictionary that contains the states of all keys. You can access the state of a specific key by looking it up in the dictionary using its name, for example: `print(input[\"b\"])` will return either 0 or 1 depending on whether the 'b' key is currently pressed or not.\n\n```py\nfrom BTS-dji import kbd  # import kbd\n\nkbd.start()  # start the kbd listener\n\nwhile True:\n    input = kbd.get_state(0)  # get the state of the kbd\n    print(input[\"a\"])  # print the state of the \"a\" key\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simplified version of the dji robomaster library with some addons. Made for the bendigo tech school.",
    "version": "0.1.10",
    "project_urls": {
        "Homepage": "https://github.com/bendigo-tech-school/BTS-dji"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c1be2cc1fce7e064a37da04523124eeff7cb8fb9c7ec4b6549f21aebe02cca6",
                "md5": "f3631288c0a412e356077633a0856369",
                "sha256": "ec7cbc930f6e69d206b256c8941ac40eac0184e991b42d45c855f2cbba478039"
            },
            "downloads": -1,
            "filename": "BTS_dji-0.1.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f3631288c0a412e356077633a0856369",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 10839,
            "upload_time": "2023-09-07T04:46:49",
            "upload_time_iso_8601": "2023-09-07T04:46:49.023702Z",
            "url": "https://files.pythonhosted.org/packages/0c/1b/e2cc1fce7e064a37da04523124eeff7cb8fb9c7ec4b6549f21aebe02cca6/BTS_dji-0.1.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "578cd9054f0a62052e8af1077b0683f9f40b460dec1dc114ca4ad7fe16635e45",
                "md5": "27a8ac53a751d26799accfbf9a420348",
                "sha256": "66ec1b859ffcecc7c4b7fa7c37ef94f701d9243cb4353a3a874ed23cc3f38e75"
            },
            "downloads": -1,
            "filename": "BTS-dji-0.1.10.tar.gz",
            "has_sig": false,
            "md5_digest": "27a8ac53a751d26799accfbf9a420348",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10371,
            "upload_time": "2023-09-07T04:46:50",
            "upload_time_iso_8601": "2023-09-07T04:46:50.621254Z",
            "url": "https://files.pythonhosted.org/packages/57/8c/d9054f0a62052e8af1077b0683f9f40b460dec1dc114ca4ad7fe16635e45/BTS-dji-0.1.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-07 04:46:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bendigo-tech-school",
    "github_project": "BTS-dji",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "imageio",
            "specs": [
                [
                    "==",
                    "2.26.0"
                ]
            ]
        },
        {
            "name": "inputs",
            "specs": [
                [
                    "==",
                    "0.5"
                ]
            ]
        },
        {
            "name": "MyQR",
            "specs": [
                [
                    "==",
                    "2.3.1"
                ]
            ]
        },
        {
            "name": "netaddr",
            "specs": [
                [
                    "==",
                    "0.8.0"
                ]
            ]
        },
        {
            "name": "netifaces",
            "specs": [
                [
                    "==",
                    "0.11.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "1.22.0"
                ]
            ]
        },
        {
            "name": "opencv-python",
            "specs": [
                [
                    "==",
                    "4.7.0.72"
                ]
            ]
        },
        {
            "name": "Pillow",
            "specs": [
                [
                    "==",
                    "9.4.0"
                ]
            ]
        },
        {
            "name": "pynput",
            "specs": [
                [
                    "==",
                    "1.7.6"
                ]
            ]
        },
        {
            "name": "robomaster",
            "specs": [
                [
                    "==",
                    "0.1.1.68"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "==",
                    "1.16.0"
                ]
            ]
        }
    ],
    "lcname": "bts-dji"
}
        
Elapsed time: 0.11844s