Kenate

API Reference

Hardware Plugins

Switch hardware platforms by changing one line in your config file, not your Python code. That's the dream.

How Plugins Work

Your Python code calls methods like self.set_motor_speed(). The plugin translates that into the correct hardware commands for your platform.

To switch from Raspberry Pi to Arduino? Change one line in hardware.toml. Your Python states remain untouched. Magic? Nope, just good design.

Available Plugins

kenate-raspberry-pi

type = "raspberry_pi"

GPIO control for Raspberry Pi. Supports PWM motors, digital sensors, and I2C devices.

kenate-serial

type = "serial"

For Arduino, Teensy, or any microcontroller connected via USB. Communicates over serial protocol.

kenate-odrive

type = "odrive"

High-performance brushless motor control. For advanced robotics requiring precise torque control.

kenate-mock

type = "mock"

Virtual hardware for testing. Simulates motors and sensors without real hardware. Perfect for unit tests.

Configuration

Set your driver type in hardware.toml:

[driver]
type = "raspberry_pi"  # Change this line to switch platforms

[motors]
left_wheel = { pin = 18, type = "pwm" }
right_wheel = { pin = 19, type = "pwm" }
arm_servo = { pin = 12, type = "servo" }

[sensors]
front_sonar = { pin = 23, type = "hc-sr04" }
encoder_left = { pin = 5, type = "encoder" }
imu = { address = 0x68, type = "mpu6050" }

Loading Configuration

In your main.py, load the config before registering states:

import kenate

engine = kenate.Engine()
engine.load_config("hardware.toml")  # Load hardware mapping

# Now motor IDs in your states map to real pins
engine.register_state("Idle", IdleState())
engine.start("Idle")