#pragma once

#include <stdint.h>

#include "guguji_protocol.h"

typedef struct {
    const char *name;
    uint8_t can_id;
    float direction;
    float zero_offset_rad;
    float lower_limit_rad;
    float upper_limit_rad;
} guguji_joint_config_t;

// 这里的顺序必须和训练配置中的 joint_names 完全一致。
// direction / zero_offset_rad 用于把“仿真关节角”映射到“电机机械角”：
// motor_angle = joint_angle * direction + zero_offset_rad。
// 真机第一次测试时务必悬空，逐个关节确认正方向后再修改 direction。
static const guguji_joint_config_t GUGUJI_JOINTS[GUGUJI_JOINT_COUNT] = {
    {"left_hip_pitch_joint", 1, 1.0f, 0.0f, -1.0f, 1.0f},
    {"left_knee_pitch_joint", 2, 1.0f, 0.0f, -1.2f, 1.2f},
    {"left_ankle_pitch_joint", 3, 1.0f, 0.0f, -0.8f, 0.8f},
    {"left_ankle_joint", 4, 1.0f, 0.0f, -0.6f, 0.6f},
    {"right_hip_pitch_joint", 5, 1.0f, 0.0f, -1.0f, 1.0f},
    {"right_knee_pitch_joint", 6, 1.0f, 0.0f, -1.2f, 1.2f},
    {"right_ankle_pitch_joint", 7, 1.0f, 0.0f, -0.8f, 0.8f},
    {"right_ankle_joint", 8, 1.0f, 0.0f, -0.6f, 0.6f},
};
