Hexapod/include/IRemote.h
2020-04-05 20:25:32 +02:00

42 lines
1001 B
C++

#pragma once
#include <Arduino.h>
class IRemote {
public:
//! @brief Attitude is the "pose" of the Hexapod
//! without movement
//!
//! @arg roll/pitch Tilt it around. Deg [-45, 45]
//! @arg yaw Twist it. Deg [-45, 45]
//! @arg elevator Lower or raise it. m [0, 0.1]
typedef struct {
float roll;
float pitch;
float yaw;
float elevator;
} Attitude;
//! @brief Movement consists of the target velocity for
//!
//! @arg vx Vel back/forward. m [-?, ?]
//! @arg vy Vel left/right. m [-?, ?]
//! @arg w Rotational speed. deg/s [-20, 20]
typedef struct {
float vx;
float vy;
float w;
} Movement;
typedef struct {
Attitude attitude;
Movement movement;
bool isNew;
} Output;
virtual const Output& output() = 0;
virtual void loop() = 0;
virtual void registerCallback(void (*callback)(const Output&)) = 0;
};