gpio.zeroborg#

Description#

ZeroBorg plugin. It allows you to control a ZeroBorg (https://www.piborg.org/motor-control-1135/zeroborg) motor controller and infrared sensor circuitry for Raspberry Pi

Example configuration that I use to control a simple 4WD robot:

directions = {
    "up": [
        0.4821428571428572,   # Motor 1 power
        0.4821428571428572,   # Motor 2 power
        -0.6707142857142858,  # Motor 3 power
        -0.6707142857142858   # Motor 4 power
    ],
    "down": [
        -0.4821428571428572,
        -0.4821428571428572,
        0.825,
        0.825
    ],
    "left": [
        -0.1392857142857143,
        -0.1392857142857143,
        -1.0553571428571429,
        -1.0553571428571429
    ],
    "right": [
        1.0017857142857143,
        1.0017857142857143,
        0.6214285714285713,
        0.6214285714285713
    ]
}

Configuration#

gpio.zeroborg:
  # [Optional]
  # Configuration for the motor directions. A direction is basically a configuration of the
  # power delivered to each motor to allow whichever object you're controlling (wheels, robotic arms etc.) to
  # move in a certain direction. In my experience the ZeroBorg always needs a bit of calibration, depending on
  # factory defaults and the mechanical properties of the load it controls.
  # directions:   # type=Dict[str, List[float]]

Triggered events#

Actions#

Module reference#

class platypush.plugins.gpio.zeroborg.Direction(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

class platypush.plugins.gpio.zeroborg.GpioZeroborgPlugin(directions: Dict[str, List[float]] = None, **kwargs)[source]#

Bases: Plugin

ZeroBorg plugin. It allows you to control a ZeroBorg (https://www.piborg.org/motor-control-1135/zeroborg) motor controller and infrared sensor circuitry for Raspberry Pi

__init__(directions: Dict[str, List[float]] = None, **kwargs)[source]#
Parameters:

directions – Configuration for the motor directions. A direction is basically a configuration of the power delivered to each motor to allow whichever object you’re controlling (wheels, robotic arms etc.) to move in a certain direction. In my experience the ZeroBorg always needs a bit of calibration, depending on factory defaults and the mechanical properties of the load it controls.

Example configuration that I use to control a simple 4WD robot:

directions = {
    "up": [
        0.4821428571428572,   # Motor 1 power
        0.4821428571428572,   # Motor 2 power
        -0.6707142857142858,  # Motor 3 power
        -0.6707142857142858   # Motor 4 power
    ],
    "down": [
        -0.4821428571428572,
        -0.4821428571428572,
        0.825,
        0.825
    ],
    "left": [
        -0.1392857142857143,
        -0.1392857142857143,
        -1.0553571428571429,
        -1.0553571428571429
    ],
    "right": [
        1.0017857142857143,
        1.0017857142857143,
        0.6214285714285713,
        0.6214285714285713
    ]
}
drive(direction)[source]#

Drive the motors in a certain direction.

status() dict[source]#

Get the current direction and motors power. Example response:

.. code-block:: json

{
    "status": "running",
    "direction": "up",
    "motors": [1.0, 1.0, -1.0, -1.0]
}
stop()[source]#

Turns off the motors