Skip to main content

A Python interface to AutomationShield's AeroShield Arduino shield

Project description

python-aeroshield

python-aeroshield is a Python package that implements a Python interface to Automationshield's Aeroshield. Automationshield creates cheap and accessible tools for control engineering education in the form of Arduino shields, of which the Aeroshield is one.

This project was built to allow TU Delft students learning control engineering to use Python in their assignments, since that is what they are thought in the curriculum. This package provides a flexible controller class that lets users conveniently implement a controller and run it on the Arduino hardware.

Installation

python-aeroshield requires Python >= 3.10 and can be installed with the following command:

$ pip install python-aeroshield

Usage

Below is a very simple example to get started. Read more in the documentation.

Use the AeroShield class to interface directly with the Arduino.

from aeroshield import AeroShield


with AeroShield() as aero_shield:
    for _ in range(100):
        aero_shield.write(flag=aero_shield.RUN, motor=50)
        out = aero_shield.read()
        print(f"Potentiomneter [%]: {out[0]}, Angle [°]: {out[1]}")

Use the AeroController class to conveniently implement a controller.

from aeroshield import AeroShield, AeroController


class MyController(AeroController):
    def controller(self, t: float, dt: float, ref: float, pot: float, angle: float) -> float:
        """Set the motor value to the provided reference."""
        return ref

# create controller instance
my_controller = MyController(AeroShield())
# run the controller on the Arduino.
hist = my_controller.run(freq=200, cycles=1000, ref=45)

Plot the experiment data using the plotting.Plotter class

from aeroshield.plotting import Plotter


fig, ax = Plotter.plot(hist)
fig.show()

Below is an example of a figure plotting the result of a PID controller with a constant reference at 45°.

Plot of PID controller output

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

python-aeroshield was created by Bert Van den Abbeele. It is licensed under the terms of the MIT license.

Credits

python-aeroshield was created with cookiecutter and the py-pkgs-cookiecutter template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_aeroshield-0.3.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

python_aeroshield-0.3.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file python_aeroshield-0.3.0.tar.gz.

File metadata

  • Download URL: python_aeroshield-0.3.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Windows/10

File hashes

Hashes for python_aeroshield-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3ba64d9c99f6a3a33133c2fc48d8167614f30cf810606241e3837922faf0d8df
MD5 a7d743ef199b0f60664a5efba6e31bf7
BLAKE2b-256 58f46a1ad0ab794a7e60b68bab705bcd0c638ca67c25ecb3262ef18b5beda2c2

See more details on using hashes here.

File details

Details for the file python_aeroshield-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for python_aeroshield-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f6ff3abfda84a482dcfa1c33cc9b44dbaf4875f5fbfbc1744c84d46885c1e6b
MD5 48d7c4f050710a6b5982c898ee1eaff2
BLAKE2b-256 7e3a81d6a66c16414323fb4eee60f65ef2522d869cccf10f7c9291005f20f003

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page